changeset 351:ebf53b46f3f3 feature_123

Add the overview setting to the project settings. Still rather clumsy, but it does appear to work!
author Chris Cannam <chris.cannam@soundsoftware.ac.uk>
date Thu, 31 Mar 2011 18:20:16 +0100
parents a1e6dc0e204b
children 13147268cd65 dde1d4de8b32
files app/controllers/projects_controller.rb app/helpers/projects_helper.rb app/views/projects/settings/_overview.rhtml app/views/projects/show.rhtml config/locales/en.yml config/routes.rb lib/redmine.rb
diffstat 7 files changed, 35 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/app/controllers/projects_controller.rb	Thu Mar 31 16:14:38 2011 +0100
+++ b/app/controllers/projects_controller.rb	Thu Mar 31 18:20:16 2011 +0100
@@ -217,7 +217,15 @@
       end
     end
   end
-  
+
+  def overview
+    @project.has_welcome_page = params[:has_welcome_page]
+    if @project.save
+      flash[:notice] = l(:notice_successful_update)
+    end
+    redirect_to :action => 'settings', :id => @project, :tab => 'overview'
+  end
+
   def modules
     @project.enabled_module_names = params[:enabled_modules]
     flash[:notice] = l(:notice_successful_update)
--- a/app/helpers/projects_helper.rb	Thu Mar 31 16:14:38 2011 +0100
+++ b/app/helpers/projects_helper.rb	Thu Mar 31 18:20:16 2011 +0100
@@ -23,6 +23,7 @@
   
   def project_settings_tabs
     tabs = [{:name => 'info', :action => :edit_project, :partial => 'projects/edit', :label => :label_information_plural},
+            {:name => 'overview', :action => :edit_project, :partial => 'projects/settings/overview', :label => :label_overview},
             {:name => 'modules', :action => :select_project_modules, :partial => 'projects/settings/modules', :label => :label_module_plural},
             {:name => 'members', :action => :manage_members, :partial => 'projects/settings/members', :label => :label_member_plural},
             {:name => 'versions', :action => :manage_versions, :partial => 'projects/settings/versions', :label => :label_version_plural},
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/views/projects/settings/_overview.rhtml	Thu Mar 31 18:20:16 2011 +0100
@@ -0,0 +1,18 @@
+
+<% form_for :project, @project,
+            :url => { :action => 'overview', :id => @project },
+            :html => {:id => 'overview-form'} do |f| %>
+
+<div class="box tabular">
+
+<p><label for="has_welcome_page"><%= l(:label_has_welcome_page) %></label>
+<%= check_box_tag 'has_welcome_page', 1, @project.has_welcome_page? -%>
+<br/><em><%= l(:text_has_welcome_page_info) %></em>
+<br/><%= link_to(l(:button_welcome_page_edit), {:controller => 'wiki', :action => 'edit', :project_id => @project, :id => Wiki.titleize("Overview")}, :class => 'icon icon-edit') %>
+</p>
+
+</div>
+
+<%= submit_tag l(:button_save) %>
+
+<% end %>
--- a/app/views/projects/show.rhtml	Thu Mar 31 16:14:38 2011 +0100
+++ b/app/views/projects/show.rhtml	Thu Mar 31 18:20:16 2011 +0100
@@ -4,7 +4,9 @@
 	<% end %>
 </div>
 
+<% if @project.has_welcome_page %>
 <% page = @project.wiki.find_page("Overview") %>
+<% end %>
 
 <% if page %>
 
--- a/config/locales/en.yml	Thu Mar 31 16:14:38 2011 +0100
+++ b/config/locales/en.yml	Thu Mar 31 18:20:16 2011 +0100
@@ -819,6 +819,7 @@
   label_project_copy_notifications: Send email notifications during the project copy
   label_principal_search: "Search by name:"
   label_user_search: "Search for user:"
+  label_has_welcome_page: "Use custom overview page"
   
   button_login: Login
   button_submit: Submit
@@ -864,6 +865,7 @@
   button_quote: Quote
   button_duplicate: Duplicate
   button_show: Show
+  button_welcome_page_edit: Edit custom overview page
   
   status_active: active
   status_registered: registered
@@ -945,6 +947,7 @@
   text_settings_repo_is_internal: Currently the repository hosted at this site is the primary repository for this project.
   text_settings_repo_is_external: Currently the repository hosted at this site is a read-only copy of an external repository.
   text_settings_repo_need_help: Please <a href="/projects/soundsoftware-site/wiki/Help">contact us</a> if you need help deciding how best to set this up.<br>We can also import complete revision history from other systems into a new primary repository for you if you wish.
+  text_has_welcome_page_info: Select this to use your own wiki-editable information page instead of the standard project overview.<br>Please edit the page using the link below and put something in it, before you enable this setting!<br><b>Note:</b> You must enable the Wiki module for this link to work.<br>
 
  
   default_role_manager: Manager
--- a/config/routes.rb	Thu Mar 31 16:14:38 2011 +0100
+++ b/config/routes.rb	Thu Mar 31 18:20:16 2011 +0100
@@ -138,6 +138,7 @@
     :copy => [:get, :post],
     :settings => :get,
     :modules => :post,
+    :overview => :post,
     :archive => :post,
     :unarchive => :post
   } do |project|
--- a/lib/redmine.rb	Thu Mar 31 16:14:38 2011 +0100
+++ b/lib/redmine.rb	Thu Mar 31 18:20:16 2011 +0100
@@ -48,7 +48,7 @@
   map.permission :view_project, {:projects => [:show], :activities => [:index]}, :public => true
   map.permission :search_project, {:search => :index}, :public => true
   map.permission :add_project, {:projects => [:new, :create]}, :require => :loggedin
-  map.permission :edit_project, {:projects => [:settings, :edit, :update]}, :require => :member
+  map.permission :edit_project, {:projects => [:settings, :edit, :update, :overview]}, :require => :member
   map.permission :select_project_modules, {:projects => :modules}, :require => :member
   map.permission :manage_members, {:projects => :settings, :members => [:new, :edit, :destroy, :autocomplete_for_member]}, :require => :member
   map.permission :manage_versions, {:projects => :settings, :versions => [:new, :create, :edit, :update, :close_completed, :destroy]}, :require => :member