# HG changeset patch # User Chris Cannam # Date 1301909394 -3600 # Node ID f25c73364bfb9577aea1e955142ea350201fb506 # Parent 773777b12fa15aeaf81dbd6546c02831c72678f5# Parent c80fd1ef305fc10ff5a5dbdc96bfe6cf94fc376a Merge from branch "feature_121" diff -r c80fd1ef305f -r f25c73364bfb app/controllers/application_controller.rb --- a/app/controllers/application_controller.rb Mon Apr 04 10:28:08 2011 +0100 +++ b/app/controllers/application_controller.rb Mon Apr 04 10:29:54 2011 +0100 @@ -263,12 +263,17 @@ uri = URI.parse(back_url) # do not redirect user to another host or to the login or register page if (uri.relative? || (uri.host == request.host)) && !uri.path.match(%r{/(login|account/register)}) + # soundsoftware: if back_url is the home page, + # change it to My Page (#125) + if (uri.path == home_path) + uri.path = uri.path + "/my" + end # soundsoftware: if login page is https but back_url http, # switch back_url to https to ensure cookie validity (#83) if (uri.scheme == "http") && (URI.parse(request.url).scheme == "https") uri.scheme = "https" - back_url = uri.to_s end + back_url = uri.to_s redirect_to(back_url) return end diff -r c80fd1ef305f -r f25c73364bfb app/controllers/files_controller.rb --- a/app/controllers/files_controller.rb Mon Apr 04 10:28:08 2011 +0100 +++ b/app/controllers/files_controller.rb Mon Apr 04 10:29:54 2011 +0100 @@ -8,7 +8,7 @@ include SortHelper def index - sort_init 'active', 'asc' + sort_init 'active', 'desc' sort_update 'filename' => "#{Attachment.table_name}.filename", 'active' => "#{Attachment.table_name}.active", 'created_on' => "#{Attachment.table_name}.created_on", diff -r c80fd1ef305f -r f25c73364bfb app/controllers/my_controller.rb --- a/app/controllers/my_controller.rb Mon Apr 04 10:28:08 2011 +0100 +++ b/app/controllers/my_controller.rb Mon Apr 04 10:29:54 2011 +0100 @@ -26,12 +26,13 @@ 'issueswatched' => :label_watched_issues, 'activitymyprojects' => :label_activity_my_recent, 'news' => :label_news_latest, + 'tipoftheday' => :label_tipoftheday, 'calendar' => :label_calendar, 'documents' => :label_document_plural, 'timelog' => :label_spent_time }.merge(Redmine::Views::MyPage::Block.additional_blocks).freeze - DEFAULT_LAYOUT = { 'left' => ['activitymyprojects'], + DEFAULT_LAYOUT = { 'left' => ['tipoftheday', 'activitymyprojects'], 'right' => ['issueswatched','calendar'] }.freeze diff -r c80fd1ef305f -r f25c73364bfb app/controllers/projects_controller.rb --- a/app/controllers/projects_controller.rb Mon Apr 04 10:28:08 2011 +0100 +++ b/app/controllers/projects_controller.rb Mon Apr 04 10:29:54 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 c80fd1ef305f -r f25c73364bfb app/controllers/welcome_controller.rb --- a/app/controllers/welcome_controller.rb Mon Apr 04 10:28:08 2011 +0100 +++ b/app/controllers/welcome_controller.rb Mon Apr 04 10:29:54 2011 +0100 @@ -22,10 +22,12 @@ helper :projects def index - @news = News.latest User.current + @site_project = Project.find_by_identifier "soundsoftware-site" + @site_news = [] + @site_news = News.latest_for @site_project if @site_project @projects = Project.latest User.current - # tests if user is logged in to gfenerate the tips of the day list + # tests if user is logged in to generate the tips of the day list if User.current.logged? @tipsoftheday = Setting.tipoftheday_text else diff -r c80fd1ef305f -r f25c73364bfb app/helpers/projects_helper.rb --- a/app/helpers/projects_helper.rb Mon Apr 04 10:28:08 2011 +0100 +++ b/app/helpers/projects_helper.rb Mon Apr 04 10:29:54 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 c80fd1ef305f -r f25c73364bfb app/models/news.rb --- a/app/models/news.rb Mon Apr 04 10:28:08 2011 +0100 +++ b/app/models/news.rb Mon Apr 04 10:29:54 2011 +0100 @@ -37,4 +37,9 @@ def self.latest(user = User.current, count = 5) find(:all, :limit => count, :conditions => Project.allowed_to_condition(user, :view_news), :include => [ :author, :project ], :order => "#{News.table_name}.created_on DESC") end + + # returns latest news for a specific project + def self.latest_for(project, count = 5) + find(:all, :limit => count, :conditions => [ "#{News.table_name}.project_id = #{project.id}", Project.allowed_to_condition(User.current, :view_news) ], :include => [ :author, :project ], :order => "#{News.table_name}.created_on DESC") + end end diff -r c80fd1ef305f -r f25c73364bfb app/views/activities/_recent.rhtml --- a/app/views/activities/_recent.rhtml Mon Apr 04 10:28:08 2011 +0100 +++ b/app/views/activities/_recent.rhtml Mon Apr 04 10:29:54 2011 +0100 @@ -2,11 +2,21 @@ <% max = 5 %> <% if (events.nil?) activity = Redmine::Activity::Fetcher.new(User.current, :project => @project) + + if @project + # Don't show news (duplicated with News box) or wiki edits (too + # tedious) in project front page + activity.scope = [ "changesets", "files", "issues", "documents" ] + end + events = activity.events(Date.today - 28, Date.today + 1) + if defined? user events = events.select { |e| user.member_of? e.project } end + events = events.first(max) + end %> diff -r c80fd1ef305f -r f25c73364bfb app/views/layouts/base.rhtml --- a/app/views/layouts/base.rhtml Mon Apr 04 10:28:08 2011 +0100 +++ b/app/views/layouts/base.rhtml Mon Apr 04 10:29:54 2011 +0100 @@ -88,7 +88,7 @@
diff -r c80fd1ef305f -r f25c73364bfb app/views/my/blocks/_tipoftheday.rhtml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/views/my/blocks/_tipoftheday.rhtml Mon Apr 04 10:29:54 2011 +0100 @@ -0,0 +1,4 @@ +<%= link_to_project(news.project) + ': ' unless @project %>
-<%= link_to h(news.title), news_path(news) %>
-<%= "(#{l(:label_x_comments, :count => news.comments_count)})" if news.comments_count > 0 %>
-
+
<%= 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) %>
+
+
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 c80fd1ef305f -r f25c73364bfb config/routes.rb
--- a/config/routes.rb Mon Apr 04 10:28:08 2011 +0100
+++ b/config/routes.rb Mon Apr 04 10:29:54 2011 +0100
@@ -138,6 +138,7 @@
:copy => [:get, :post],
:settings => :get,
:modules => :post,
+ :overview => :post,
:archive => :post,
:unarchive => :post
} do |project|
diff -r c80fd1ef305f -r f25c73364bfb 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 Mon Apr 04 10:29:54 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 c80fd1ef305f -r f25c73364bfb extra/soundsoftware/reposman-soundsoftware.rb
--- a/extra/soundsoftware/reposman-soundsoftware.rb Mon Apr 04 10:28:08 2011 +0100
+++ b/extra/soundsoftware/reposman-soundsoftware.rb Mon Apr 04 10:29:54 2011 +0100
@@ -346,14 +346,5 @@
log("\trepository #{repos_path} created");
end
- if project.respond_to?(:repository) and project.repository.is_external?
- external_url = project.repository.external_url;
- log("\tproject #{project.identifier} has external repository url #{external_url}");
- if !external_url.match(/^https?:/)
- # wot about git, svn/svn+ssh, etc? should we just check for a scheme at all?
- log("\tthis is not an http(s) url: ignoring");
- end
- end
-
end
diff -r c80fd1ef305f -r f25c73364bfb lib/redmine.rb
--- a/lib/redmine.rb Mon Apr 04 10:28:08 2011 +0100
+++ b/lib/redmine.rb Mon Apr 04 10:29:54 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
@@ -185,6 +185,7 @@
Redmine::MenuManager.map :project_menu do |menu|
menu.push :overview, { :controller => 'projects', :action => 'show' }
+ menu.push :news, { :controller => 'news', :action => 'index' }, :param => :project_id, :caption => :label_news_plural
menu.push :activity, { :controller => 'activities', :action => 'index' }
menu.push :roadmap, { :controller => 'versions', :action => 'index' }, :param => :project_id,
:if => Proc.new { |p| p.shared_versions.any? }
@@ -193,7 +194,6 @@
:html => { :accesskey => Redmine::AccessKeys.key_for(:new_issue) }
menu.push :gantt, { :controller => 'gantts', :action => 'show' }, :param => :project_id, :caption => :label_gantt
menu.push :calendar, { :controller => 'calendars', :action => 'show' }, :param => :project_id, :caption => :label_calendar
- menu.push :news, { :controller => 'news', :action => 'index' }, :param => :project_id, :caption => :label_news_plural
menu.push :documents, { :controller => 'documents', :action => 'index' }, :param => :project_id, :caption => :label_document_plural
menu.push :wiki, { :controller => 'wiki', :action => 'show', :id => nil }, :param => :project_id,
:if => Proc.new { |p| p.wiki && !p.wiki.new_record? }
diff -r c80fd1ef305f -r f25c73364bfb public/stylesheets/application.css
--- a/public/stylesheets/application.css Mon Apr 04 10:28:08 2011 +0100
+++ b/public/stylesheets/application.css Mon Apr 04 10:29:54 2011 +0100
@@ -294,16 +294,19 @@
div#issue-changesets div.changeset { border-bottom: 1px solid #ddd; }
div#issue-changesets p { margin-top: 0; margin-bottom: 1em;}
-div#activity dl, #search-results { margin-left: 2em; }
+div#activity dl, div#news dl, #search-results { margin-left: 2em; }
div#activity .box dl { margin-left: 0; }
-div#activity dd, #search-results dd { margin-bottom: 1em; padding-left: 18px; font-size: 0.9em; }
-div#activity dt, #search-results dt { margin-bottom: 0px; padding-left: 20px; line-height: 18px; background-position: 0 50%; background-repeat: no-repeat; }
-div#activity dt.me .time { border-bottom: 1px solid #999; }
-div#activity dt .time { color: #777; font-size: 80%; }
+div#activity dd, div#news dd, #search-results dd { margin-bottom: 1em; padding-left: 18px; font-size: 0.9em; }
+div#activity dt, div#news dt, #search-results dt { margin-bottom: 0px; padding-left: 20px; line-height: 18px; background-position: 0 50%; background-repeat: no-repeat; }
+div#activity dt.me .time, div#news dt.me .time { border-bottom: 1px solid #999; }
+div#activity dt .time, div#news dt .time, .projects .latest .time { color: #777; font-size: 80%; }
div#activity dd .description, #search-results dd .description { font-style: italic; }
-div#activity span.project:after, #search-results span.project:after { content: " -"; }
+div#activity span.project:after, div#news span.project:after, #search-results span.project:after { content: " -"; }
div#activity dd span.description, #search-results dd span.description { display:block; color: #808080; }
+.projects .latest .title { margin-right: 0.5em; }
+.tipoftheday .tip { margin-left: 2em; margin-top: 0.5em; }
+
#search-results dd { margin-bottom: 1em; padding-left: 20px; margin-left:0px; }
div#search-results-counts { display: block; padding-left: 0; margin-left: 0; }