# HG changeset patch # User Chris Cannam # Date 1301647045 -3600 # Node ID 9ccc63655a21c92634cd69af2241ccbb6da7fcf9 # Parent c46fbe5d58ce1df2458a0a0d440dd641127407aa# Parent 8c804ce943db3932b65032fa9b62d18947de66b2 Merge from branch "feature_123" diff -r c46fbe5d58ce -r 9ccc63655a21 app/controllers/projects_controller.rb --- a/app/controllers/projects_controller.rb Thu Mar 31 15:23:55 2011 +0100 +++ b/app/controllers/projects_controller.rb Fri Apr 01 09:37:25 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) diff -r c46fbe5d58ce -r 9ccc63655a21 app/helpers/projects_helper.rb --- a/app/helpers/projects_helper.rb Thu Mar 31 15:23:55 2011 +0100 +++ b/app/helpers/projects_helper.rb Fri Apr 01 09:37:25 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_welcome_page}, {: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}, diff -r c46fbe5d58ce -r 9ccc63655a21 app/views/projects/settings/_overview.rhtml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/views/projects/settings/_overview.rhtml Fri Apr 01 09:37:25 2011 +0100 @@ -0,0 +1,30 @@ + +<% form_for :project, @project, + :url => { :action => 'overview', :id => @project }, + :html => {:id => 'overview-form'} do |f| %> + +
+ +

<%= l(:text_has_welcome_page_info, { :overview_link => link_to(l(:label_overview), { :controller => 'projects', :action => 'show' } ) } ) %>

+ +<% if @project.module_enabled? :wiki %> + +

<%= link_to(l(:button_welcome_page_edit), {:controller => 'wiki', :action => 'edit', :project_id => @project, :id => Wiki.titleize("Overview")}, :class => 'icon icon-edit') %> + +<% else %> + +

<%= l(:text_has_welcome_page_wiki_disabled, { :modules_link => link_to(l(:label_module_plural), { :controller => 'projects', :action => 'settings', :tab => 'modules' } ) } ) %>

+ +<% end %> + +

+<%= check_box_tag 'has_welcome_page', 1, @project.has_welcome_page? -%> +
<%= l(:setting_has_welcome_page) %> + +

+ +
+ +<%= submit_tag l(:button_save) %> + +<% end %> diff -r c46fbe5d58ce -r 9ccc63655a21 app/views/projects/show.rhtml --- a/app/views/projects/show.rhtml Thu Mar 31 15:23:55 2011 +0100 +++ b/app/views/projects/show.rhtml Fri Apr 01 09:37:25 2011 +0100 @@ -4,6 +4,29 @@ <% end %> +<% if @project.has_welcome_page %> +<% page = @project.wiki.find_page("Overview") %> +<% end %> + +<% if page %> + +
+ +
+ +<%= render(:partial => "wiki/content", :locals => {:content => page.content_for_version()}) %> + +<% else %> +

<%=l(:label_overview)%>

@@ -79,6 +102,8 @@ <%= call_hook(:view_projects_show_sidebar_bottom, :project => @project) %> <% end %> +<% end %> + <% content_for :header_tags do %> <%= auto_discovery_link_tag(:atom, {:controller => 'activities', :action => 'index', :id => @project, :format => 'atom', :key => User.current.rss_key}) %> <% end %> diff -r c46fbe5d58ce -r 9ccc63655a21 config/locales/en.yml --- a/config/locales/en.yml Thu Mar 31 15:23:55 2011 +0100 +++ b/config/locales/en.yml Fri Apr 01 09:37:25 2011 +0100 @@ -373,6 +373,7 @@ setting_rest_api_enabled: Enable REST web service setting_cache_formatted_text: Cache formatted text setting_default_notification_option: Default notification option + setting_has_welcome_page: Select this to replace the project overview page with your own welcome page permission_add_project: Create project permission_add_subprojects: Create subprojects @@ -819,6 +820,8 @@ label_project_copy_notifications: Send email notifications during the project copy label_principal_search: "Search by name:" label_user_search: "Search for user:" + label_welcome_page: "Welcome page" + label_has_welcome_page: "Use your own welcome page" button_login: Login button_submit: Submit @@ -864,6 +867,7 @@ button_quote: Quote button_duplicate: Duplicate button_show: Show + button_welcome_page_edit: Create or edit welcome page status_active: active status_registered: registered @@ -945,6 +949,8 @@ 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 contact us if you need help deciding how best to set this up.
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: Welcome page

You can replace the standard {{overview_link}} page for this project with your own welcome page.
This page will be editable using the project Wiki. + text_has_welcome_page_wiki_disabled: Note: You must enable the Wiki module in the {{modules_link}} tab before you can create or edit this page. default_role_manager: Manager diff -r c46fbe5d58ce -r 9ccc63655a21 config/routes.rb --- a/config/routes.rb Thu Mar 31 15:23:55 2011 +0100 +++ b/config/routes.rb Fri Apr 01 09:37:25 2011 +0100 @@ -138,6 +138,7 @@ :copy => [:get, :post], :settings => :get, :modules => :post, + :overview => :post, :archive => :post, :unarchive => :post } do |project| diff -r c46fbe5d58ce -r 9ccc63655a21 db/migrate/20110331152140_add_has_welcome_page_to_projects.rb --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/db/migrate/20110331152140_add_has_welcome_page_to_projects.rb Fri Apr 01 09:37:25 2011 +0100 @@ -0,0 +1,9 @@ +class AddHasWelcomePageToProjects < ActiveRecord::Migration + def self.up + add_column :projects, :has_welcome_page, :boolean + end + + def self.down + remove_column :projects, :has_welcome_page + end +end diff -r c46fbe5d58ce -r 9ccc63655a21 lib/redmine.rb --- a/lib/redmine.rb Thu Mar 31 15:23:55 2011 +0100 +++ b/lib/redmine.rb Fri Apr 01 09:37:25 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