Mercurial > hg > soundsoftware-site
changeset 355:9ccc63655a21 live
Merge from branch "feature_123"
author | Chris Cannam |
---|---|
date | Fri, 01 Apr 2011 09:37:25 +0100 |
parents | c46fbe5d58ce (current diff) 8c804ce943db (diff) |
children | 3ca3a0255e2a efa1e508bdef |
files | |
diffstat | 8 files changed, 82 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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)
--- 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},
--- /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| %> + +<div class="box tabular"> + +<p><%= l(:text_has_welcome_page_info, { :overview_link => link_to(l(:label_overview), { :controller => 'projects', :action => 'show' } ) } ) %></p> + +<% if @project.module_enabled? :wiki %> + +<p><%= link_to(l(:button_welcome_page_edit), {:controller => 'wiki', :action => 'edit', :project_id => @project, :id => Wiki.titleize("Overview")}, :class => 'icon icon-edit') %> + +<% else %> + +<p><%= l(:text_has_welcome_page_wiki_disabled, { :modules_link => link_to(l(:label_module_plural), { :controller => 'projects', :action => 'settings', :tab => 'modules' } ) } ) %></p> + +<% end %> + +<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(:setting_has_welcome_page) %></em> + +</p> + +</div> + +<%= submit_tag l(:button_save) %> + +<% end %>
--- 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 %> </div> +<% if @project.has_welcome_page %> +<% page = @project.wiki.find_page("Overview") %> +<% end %> + +<% if page %> + +<div class="contextual" style="clear: right"> +<ul> +<% @users_by_role.keys.sort.each do |role| %> +<li><%=h role %>: <%= @users_by_role[role].sort.collect{|u| link_to_user u}.join(", ") %></li> +<% end %> +<% unless @project.homepage.blank? %><li><%=l(:field_homepage)%>: <%= auto_link(h(@project.homepage)) %></li><% end %> +<% if @subprojects.any? %> + <li><%=l(:label_subproject_plural)%>: + <%= @subprojects.collect{|p| link_to(h(p), :action => 'show', :id => p)}.join(", ") %></li> +<% end %> +</ul> +</div> + +<%= render(:partial => "wiki/content", :locals => {:content => page.content_for_version()}) %> + +<% else %> + <h2><%=l(:label_overview)%></h2> <div class="splitcontentleft"> @@ -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 %>
--- 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 <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: <b>Welcome page</b><p>You can replace the standard {{overview_link}} page for this project with your own welcome page.<br>This page will be editable using the project Wiki. + text_has_welcome_page_wiki_disabled: <b>Note:</b> You must enable the Wiki module in the {{modules_link}} tab before you can create or edit this page. default_role_manager: Manager
--- 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|
--- /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
--- 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