From 2c335dbf32f738a06418d6eb5ff64b30d3379e48 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang <jp_lang@yahoo.fr> Date: Wed, 6 Dec 2006 20:54:43 +0000 Subject: [PATCH] calendar and activity views edited (previous/next links) git-svn-id: http://redmine.rubyforge.org/svn/trunk@72 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/controllers/projects_controller.rb | 3 ++- app/helpers/application_helper.rb | 4 ++++ app/views/projects/activity.rhtml | 17 +++++++++++++++-- app/views/projects/calendar.rhtml | 4 ++-- 4 files changed, 23 insertions(+), 5 deletions(-) diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index c968800c3..6718b8312 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -403,7 +403,8 @@ class ProjectsController < ApplicationController } @show_documents = 1 end - + + render :layout => false if request.xhr? end def calendar diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 0f0deeb30..196d91fca 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -61,6 +61,10 @@ module ApplicationHelper def day_name(day) l(:general_day_names).split(',')[day-1] end + + def month_name(month) + l(:actionview_datehelper_select_month_names).split(',')[month-1] + end def pagination_links_full(paginator, options={}, html_options={}) html = '' diff --git a/app/views/projects/activity.rhtml b/app/views/projects/activity.rhtml index d6e5a1a43..4050d62c1 100644 --- a/app/views/projects/activity.rhtml +++ b/app/views/projects/activity.rhtml @@ -1,4 +1,4 @@ -<h2><%=l(:label_activity)%></h2> +<h2><%=l(:label_activity)%>: <%= "#{month_name(@month).downcase} #{@year}" %></h2> <div> <div class="rightbox"> @@ -13,7 +13,7 @@ <%= end_form_tag %> </div> <% @events_by_day.keys.sort {|x,y| y <=> x }.each do |day| %> - <h3><%= day_name(day.cwday) %> <%= format_date(day) %></h3> + <h3><%= day_name(day.cwday) %> <%= day.day %></h3> <ul> <% @events_by_day[day].sort {|x,y| y.created_on <=> x.created_on }.each do |e| %> <li><p> @@ -37,5 +37,18 @@ </ul> <% end %> <% if @events_by_day.empty? %><p><i><%= l(:label_no_data) %></i></p><% end %> + +<div style="float:left;"> +<%= link_to_remote ('« ' + (@month==1 ? "#{month_name(12)} #{@year-1}" : "#{month_name(@month-1)}")), + {:update => "content", :url => { :year => (@month==1 ? @year-1 : @year), :month =>(@month==1 ? 12 : @month-1) }}, + {:href => url_for(:action => 'activity', :year => (@month==1 ? @year-1 : @year), :month =>(@month==1 ? 12 : @month-1))} + %> +</div> +<div style="float:right;"> +<%= link_to_remote ((@month==12 ? "#{month_name(1)} #{@year+1}" : "#{month_name(@month+1)}") + ' »'), + {:update => "content", :url => { :year => (@month==12 ? @year+1 : @year), :month =>(@month==12 ? 1 : @month+1) }}, + {:href => url_for(:action => 'activity', :year => (@month==12 ? @year+1 : @year), :month =>(@month==12 ? 1 : @month+1))} + %> +</div> <br /> </div> \ No newline at end of file diff --git a/app/views/projects/calendar.rhtml b/app/views/projects/calendar.rhtml index fc62921d4..22fcfa021 100644 --- a/app/views/projects/calendar.rhtml +++ b/app/views/projects/calendar.rhtml @@ -55,13 +55,13 @@ end %> <table width="100%"> <tr> <td align="left"> -<%= link_to_remote ('« ' + l(:label_previous)), +<%= link_to_remote ('« ' + (@month==1 ? "#{month_name(12)} #{@year-1}" : "#{month_name(@month-1)}")), {:update => "content", :url => { :year => (@month==1 ? @year-1 : @year), :month =>(@month==1 ? 12 : @month-1) }}, {:href => url_for(:action => 'calendar', :year => (@month==1 ? @year-1 : @year), :month =>(@month==1 ? 12 : @month-1))} %> </td> <td align="right"> -<%= link_to_remote (l(:label_next) + ' »'), +<%= link_to_remote ((@month==12 ? "#{month_name(1)} #{@year+1}" : "#{month_name(@month+1)}") + ' »'), {:update => "content", :url => { :year => (@month==12 ? @year+1 : @year), :month =>(@month==12 ? 1 : @month+1) }}, {:href => url_for(:action => 'calendar', :year => (@month==12 ? @year+1 : @year), :month =>(@month==12 ? 1 : @month+1))} %> -- GitLab