diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 410e2484..30a8dba1 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -420,12 +420,8 @@ class ProjectsController < ApplicationController # Show changelog for @project def changelog @trackers = Tracker.find(:all, :conditions => ["is_in_chlog=?", true], :order => 'position') - if request.get? - @selected_tracker_ids = @trackers.collect {|t| t.id.to_s } - else - @selected_tracker_ids = params[:tracker_ids].collect { |id| id.to_i.to_s } if params[:tracker_ids] and params[:tracker_ids].is_a? Array - end - @selected_tracker_ids ||= [] + retrieve_selected_tracker_ids(@trackers) + @fixed_issues = @project.issues.find(:all, :include => [ :fixed_version, :status, :tracker ], :conditions => [ "#{IssueStatus.table_name}.is_closed=? and #{Issue.table_name}.tracker_id in (#{@selected_tracker_ids.join(',')}) and #{Issue.table_name}.fixed_version_id is not null", true], @@ -436,12 +432,8 @@ class ProjectsController < ApplicationController def roadmap @trackers = Tracker.find(:all, :conditions => ["is_in_roadmap=?", true], :order => 'position') - if request.get? - @selected_tracker_ids = @trackers.collect {|t| t.id.to_s } - else - @selected_tracker_ids = params[:tracker_ids].collect { |id| id.to_i.to_s } if params[:tracker_ids] and params[:tracker_ids].is_a? Array - end - @selected_tracker_ids ||= [] + retrieve_selected_tracker_ids(@trackers) + @versions = @project.versions.find(:all, :conditions => [ "#{Version.table_name}.effective_date>?", Date.today], :order => "#{Version.table_name}.effective_date ASC" @@ -534,6 +526,9 @@ class ProjectsController < ApplicationController end def calendar + @trackers = Tracker.find(:all, :order => 'position') + retrieve_selected_tracker_ids(@trackers) + if params[:year] and params[:year].to_i > 1900 @year = params[:year].to_i if params[:month] and params[:month].to_i > 0 and params[:month].to_i < 13 @@ -548,18 +543,24 @@ class ProjectsController < ApplicationController # start on monday @date_from = @date_from - (@date_from.cwday-1) # finish on sunday - @date_to = @date_to + (7-@date_to.cwday) - - @issues = @project.issues.find(:all, :include => [:tracker, :status, :assigned_to, :priority], - :conditions => ["((start_date>=? and start_date<=?) or (due_date>=? and due_date<=?))", @date_from, @date_to, @date_from, @date_to]) - + @date_to = @date_to + (7-@date_to.cwday) + + @issues = @project.issues.find(:all, + :include => [:tracker, :status, :assigned_to, :priority], + :conditions => ["((start_date>=? and start_date<=?) or (due_date>=? and due_date<=?)) and #{Issue.table_name}.tracker_id in (#{@selected_tracker_ids.join(',')})", @date_from, @date_to, @date_from, @date_to] + ) unless @selected_tracker_ids.empty? + @issues ||=[] + @ending_issues_by_days = @issues.group_by {|issue| issue.due_date} @starting_issues_by_days = @issues.group_by {|issue| issue.start_date} - + render :layout => false if request.xhr? end def gantt + @trackers = Tracker.find(:all, :order => 'position') + retrieve_selected_tracker_ids(@trackers) + if params[:year] and params[:year].to_i >0 @year_from = params[:year].to_i if params[:month] and params[:month].to_i >=1 and params[:month].to_i <= 12 @@ -577,7 +578,13 @@ class ProjectsController < ApplicationController @date_from = Date.civil(@year_from, @month_from, 1) @date_to = (@date_from >> @months) - 1 - @issues = @project.issues.find(:all, :order => "start_date, due_date", :include => [:tracker, :status, :assigned_to, :priority], :conditions => ["(((start_date>=? and start_date<=?) or (due_date>=? and due_date<=?) or (start_date?)) and start_date is not null and due_date is not null)", @date_from, @date_to, @date_from, @date_to, @date_from, @date_to]) + + @issues = @project.issues.find(:all, + :order => "start_date, due_date", + :include => [:tracker, :status, :assigned_to, :priority], + :conditions => ["(((start_date>=? and start_date<=?) or (due_date>=? and due_date<=?) or (start_date?)) and start_date is not null and due_date is not null and #{Issue.table_name}.tracker_id in (#{@selected_tracker_ids.join(',')}))", @date_from, @date_to, @date_from, @date_to, @date_from, @date_to] + ) unless @selected_tracker_ids.empty? + @issues ||=[] if params[:output]=='pdf' @options_for_rfpdf ||= {} @@ -630,6 +637,14 @@ private render_404 end + def retrieve_selected_tracker_ids(selectable_trackers) + if ids = params[:tracker_ids] + @selected_tracker_ids = (ids.is_a? Array) ? ids.collect { |id| id.to_i.to_s } : ids.split('/').collect { |id| id.to_i.to_s } + else + @selected_tracker_ids = selectable_trackers.collect {|t| t.id.to_s } + end + end + # Retrieve query from session or build a new query def retrieve_query if params[:query_id] diff --git a/app/views/projects/calendar.rhtml b/app/views/projects/calendar.rhtml index 8db92a93..23aba7d7 100644 --- a/app/views/projects/calendar.rhtml +++ b/app/views/projects/calendar.rhtml @@ -1,29 +1,39 @@

<%= l(:label_calendar) %>

-<% form_tag({:action => 'calendar', :id => @project}) do %> +<% form_tag do %> - - - +
+ <%= 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))} + {:update => "content", :url => { :year => (@month==1 ? @year-1 : @year), :month =>(@month==1 ? 12 : @month-1), :tracker_ids => @selected_tracker_ids }}, + {:href => url_for(:action => 'calendar', :year => (@month==1 ? @year-1 : @year), :month =>(@month==1 ? 12 : @month-1), :tracker_ids => @selected_tracker_ids)} %> + <%= select_month(@month, :prefix => "month", :discard_type => true) %> <%= select_year(@year, :prefix => "year", :discard_type => true) %> <%= submit_tag l(:button_submit), :class => "button-small" %> + + <%= l(:label_options) %> + + <%= 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))} + {:update => "content", :url => { :year => (@month==12 ? @year+1 : @year), :month =>(@month==12 ? 1 : @month+1), :tracker_ids => @selected_tracker_ids }}, + {:href => url_for(:action => 'calendar', :year => (@month==12 ? @year+1 : @year), :month =>(@month==12 ? 1 : @month+1), :tracker_ids => @selected_tracker_ids)} %> 
<% end %> -
diff --git a/app/views/projects/gantt.rhtml b/app/views/projects/gantt.rhtml index a846507a..324aa2ba 100644 --- a/app/views/projects/gantt.rhtml +++ b/app/views/projects/gantt.rhtml @@ -1,39 +1,47 @@
<%= l(:label_export_to) %> -<%= link_to 'PDF', {:zoom => @zoom, :year => @year_from, :month => @month_from, :months => @months, :output => 'pdf'}, :class => 'icon icon-pdf' %> +<%= link_to 'PDF', {:zoom => @zoom, :year => @year_from, :month => @month_from, :months => @months, :tracker_ids => @selected_tracker_ids, :output => 'pdf'}, :class => 'icon icon-pdf' %>

<%= l(:label_gantt) %>

+<% form_tag do %>
+
-<% form_tag do %> -

- -<%= l(:label_months_from) %> -<%= select_month(@month_from, :prefix => "month", :discard_type => true) %> -<%= select_year(@year_from, :prefix => "year", :discard_type => true) %> -<%= hidden_field_tag 'zoom', @zoom %> -<%= submit_tag l(:button_submit), :class => "button-small" %> -

-<% end %> + + <%= l(:label_months_from) %> + <%= select_month(@month_from, :prefix => "month", :discard_type => true) %> + <%= select_year(@year_from, :prefix => "year", :discard_type => true) %> + <%= hidden_field_tag 'zoom', @zoom %> + <%= submit_tag l(:button_submit), :class => "button-small" %> +
+ <%= l(:label_options) %> + <%= if @zoom < 4 - link_to image_tag('zoom_in.png'), {:zoom => (@zoom+1), :year => @year_from, :month => @month_from, :months => @months} + link_to image_tag('zoom_in.png'), {:zoom => (@zoom+1), :year => @year_from, :month => @month_from, :months => @months, :tracker_ids => @selected_tracker_ids} else image_tag 'zoom_in_g.png' end %> <%= if @zoom > 1 - link_to image_tag('zoom_out.png'), :zoom => (@zoom-1), :year => @year_from, :month => @month_from, :months => @months + link_to image_tag('zoom_out.png'),{:zoom => (@zoom-1), :year => @year_from, :month => @month_from, :months => @months, :tracker_ids => @selected_tracker_ids} else image_tag 'zoom_out_g.png' end %>
-
+<% end %> <% zoom = 1 @zoom.times { zoom = zoom * 2 } @@ -41,22 +49,22 @@ subject_width = 260 header_heigth = 18 -headers_heigth = header_heigth +headers_height = header_heigth show_weeks = false show_days = false if @zoom >1 show_weeks = true - headers_heigth = 2*header_heigth + headers_height = 2*header_heigth if @zoom > 2 show_days = true - headers_heigth = 3*header_heigth + headers_height = 3*header_heigth end end g_width = (@date_to - @date_from + 1)*zoom g_height = [(20 * @issues.length + 6)+150, 206].max -t_height = g_height + headers_heigth +t_height = g_height + headers_height %> @@ -64,26 +72,26 @@ t_height = g_height + headers_heigth
-
+
<% # # Tasks subjects # -top = headers_heigth + 8 +top = headers_height + 8 @issues.each do |i| %> -
- <%= link_to "#{i.tracker.name} ##{i.id}", { :controller => 'issues', :action => 'show', :id => i }, :title => "#{i.subject}" %>: - <%=h i.subject.sub(/^(.{30}[^\s]*\s).*$/, '\1 (...)') %> -
-<% top = top + 20 +
+ <%= link_to "#{i.tracker.name} ##{i.id}", { :controller => 'issues', :action => 'show', :id => i }, :title => "#{i.subject}" %>: + <%=h i.subject.sub(/^(.{30}[^\s]*\s).*$/, '\1 (...)') %> +
+ <% top = top + 20 end %>
-
 
+
 
<% # # Months headers @@ -160,14 +168,14 @@ end %> # Today red line # if Date.today >= @date_from and Date.today <= @date_to %> -
 
+
 
<% end %> <% # # Tasks # -top = headers_heigth + 10 +top = headers_height + 10 @issues.each do |i| %> <% i_start_date = (i.start_date >= @date_from ? i.start_date : @date_from ) @@ -209,7 +217,7 @@ end %> - - + +
<%= link_to ('« ' + l(:label_previous)), :year => (@date_from << @months).year, :month => (@date_from << @months).month, :zoom => @zoom, :months => @months %><%= link_to (l(:label_next) + ' »'), :year => (@date_from >> @months).year, :month => (@date_from >> @months).month, :zoom => @zoom, :months => @months %><%= link_to ('« ' + l(:label_previous)), :year => (@date_from << @months).year, :month => (@date_from << @months).month, :zoom => @zoom, :months => @months, :tracker_ids => @selected_tracker_ids %><%= link_to (l(:label_next) + ' »'), :year => (@date_from >> @months).year, :month => (@date_from >> @months).month, :zoom => @zoom, :months => @months, :tracker_ids => @selected_tracker_ids %>
\ No newline at end of file diff --git a/lang/de.yml b/lang/de.yml index fb5db516..9c2c18a0 100644 --- a/lang/de.yml +++ b/lang/de.yml @@ -351,6 +351,7 @@ label_commits_per_author: Übertragungen pro Autor label_view_diff: View differences label_diff_inline: inline label_diff_side_by_side: side by side +label_options: Options button_login: Einloggen button_submit: OK diff --git a/lang/en.yml b/lang/en.yml index 4ba071d1..ffc13928 100644 --- a/lang/en.yml +++ b/lang/en.yml @@ -351,6 +351,7 @@ label_commits_per_author: Commits per author label_view_diff: View differences label_diff_inline: inline label_diff_side_by_side: side by side +label_options: Options button_login: Login button_submit: Submit diff --git a/lang/es.yml b/lang/es.yml index a8472c06..acd03c53 100644 --- a/lang/es.yml +++ b/lang/es.yml @@ -351,6 +351,7 @@ label_commits_per_author: Commits per author label_view_diff: View differences label_diff_inline: inline label_diff_side_by_side: side by side +label_options: Options button_login: Conexión button_submit: Someter diff --git a/lang/fr.yml b/lang/fr.yml index 89a0ba48..243557e6 100644 --- a/lang/fr.yml +++ b/lang/fr.yml @@ -351,6 +351,7 @@ label_commits_per_author: Commits par auteur label_view_diff: Voir les différences label_diff_inline: en ligne label_diff_side_by_side: côte à côte +label_options: Options button_login: Connexion button_submit: Soumettre diff --git a/lang/it.yml b/lang/it.yml index 9e8399b1..c024b5fc 100644 --- a/lang/it.yml +++ b/lang/it.yml @@ -351,6 +351,7 @@ label_commits_per_author: Commits per author label_view_diff: View differences label_diff_inline: inline label_diff_side_by_side: side by side +label_options: Options button_login: Login button_submit: Invia diff --git a/lang/ja.yml b/lang/ja.yml index 4da2fffd..90fdd9f7 100644 --- a/lang/ja.yml +++ b/lang/ja.yml @@ -352,6 +352,7 @@ label_commits_per_author: 起票者別のコミット label_view_diff: 差分を見る label_diff_inline: インライン label_diff_side_by_side: 横に並べる +label_options: Options button_login: ログイン button_submit: 変更 diff --git a/lang/zh.yml b/lang/zh.yml index 4ac6d55b..b4b57f4a 100644 --- a/lang/zh.yml +++ b/lang/zh.yml @@ -354,6 +354,7 @@ label_commits_per_author: Commits per author label_view_diff: View differences label_diff_inline: inline label_diff_side_by_side: side by side +label_options: Options button_login: 登录 button_submit: 提交 diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index cf67604c..1233231f 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -467,6 +467,12 @@ position: relative; margin: 0 5px 5px; } +.overlay{ +position: absolute; +margin-left:0; +z-index: 50; +} + .layout-active { background: #ECF3E1; }