changeset 1164:a943f341c99d feature_550

Make "my projects" box on My Page look nice when user has no projects (invite them to create one)
author Chris Cannam <chris.cannam@soundsoftware.ac.uk>
date Mon, 21 Jan 2013 14:12:05 +0000
parents 5ebdeb79ea9c
children 6a10e5fbf8b2 820314b808cf
files app/controllers/my_controller.rb app/views/activities/_busy.html.erb app/views/my/blocks/_myprojects.html.erb config/locales/en.yml
diffstat 4 files changed, 11 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/app/controllers/my_controller.rb	Fri Nov 23 14:29:55 2012 +0000
+++ b/app/controllers/my_controller.rb	Mon Jan 21 14:12:05 2013 +0000
@@ -35,8 +35,8 @@
              'myprojects' => :label_my_projects
            }.merge(Redmine::Views::MyPage::Block.additional_blocks).freeze
 
-  DEFAULT_LAYOUT = {  'left' => ['tipoftheday', 'activitymyprojects'], 
-                      'right' => ['issueswatched'] 
+  DEFAULT_LAYOUT = {  'left' => ['myprojects', 'activitymyprojects'], 
+                      'right' => ['tipoftheday', 'issueswatched'] 
                    }.freeze
 
   verify :xhr => true,
--- a/app/views/activities/_busy.html.erb	Fri Nov 23 14:29:55 2012 +0000
+++ b/app/views/activities/_busy.html.erb	Mon Jan 21 14:12:05 2013 +0000
@@ -1,7 +1,7 @@
 <% events = @events_by_day %>
 <% if (events.nil?) 
      activity = Redmine::Activity::Fetcher.new(User.anonymous)
-     events = activity.events(Date.today - 14, Date.today + 1)
+     events = activity.events(Date.today - 140, Date.today + 1)
    end
 %>
 
--- a/app/views/my/blocks/_myprojects.html.erb	Fri Nov 23 14:29:55 2012 +0000
+++ b/app/views/my/blocks/_myprojects.html.erb	Mon Jan 21 14:12:05 2013 +0000
@@ -1,9 +1,16 @@
 <%  @user_projects = User.current.projects.all(:order => :name) %>
 
+<% if @user_projects.empty? %>
+<h3><%=l(:label_my_projects)%></h3>
+<div class="box">
+  <p><%= l(:label_have_no_projects)%> <%= link_to(l(:label_project_new), {:controller => 'projects', :action => 'new'}) if User.current.allowed_to?(:add_project, nil, :global => true) %></p>
+</div>
+<% else %>
 <h3><%=l(:label_my_projects)%> (<%= @user_projects.count %>)</h3>
 <div class="box">
 <%=
    render :partial => 'projects/my', :locals => { :user => User.current }
  %>
 </div>
+<% end %>
 
--- a/config/locales/en.yml	Fri Nov 23 14:29:55 2012 +0000
+++ b/config/locales/en.yml	Mon Jan 21 14:12:05 2013 +0000
@@ -485,6 +485,7 @@
   label_project_plural: Projects
   label_my_project_plural: My Projects
   label_other_project_plural: Other Projects
+  label_have_no_projects: Not a member of any projects.
   label_x_projects:
     zero:  no projects
     one:   1 project