Project

General

Profile

Feature #1422 » activitydaterange-for-2.6.0.patch

The feature patch for redmine V2.6.0 - Frei-Cedric Hackbarth - macio GmbH, 2014-11-13 10:07

View differences:

app/controllers/activities_controller.rb (working copy)
24 24
    @days = Setting.activity_days_default.to_i
25 25

  
26 26
    if params[:from]
27
      begin; @date_to = params[:from].to_date + 1; rescue; end
27
      begin; @date_from = params[:from].to_date; rescue; end
28 28
    end
29
    
30
    if params[:to]
31
      begin; @date_to = params[:to].to_date + 1; rescue; end
32
    end
33
	
34
    if (@date_from == nil) || (@date_to == nil)
35
      @date_to = Date.today + 1
36
      @date_from = @date_to - @days
37
    end
29 38

  
30
    @date_to ||= Date.today + 1
31
    @date_from = @date_to - @days
32 39
    @with_subprojects = params[:with_subprojects].nil? ? Setting.display_subprojects_issues? : (params[:with_subprojects] == '1')
33 40
    @author = (params[:user_id].blank? ? nil : User.active.find(params[:user_id]))
34 41

  
app/views/activities/index.html.erb (working copy)
1 1
<h2><%= @author.nil? ? l(:label_activity) : l(:label_user_activity, link_to_user(@author)).html_safe %></h2>
2
<p class="subtitle"><%= l(:label_date_from_to, :start => format_date(@date_to - @days), :end => format_date(@date_to-1)) %></p>
2
<p class="subtitle"><%= l(:label_date_from_to, :start => format_date(@date_from), :end => format_date(@date_to - 1)) %></p>
3 3

  
4
<%=form_tag({:controller => 'activities', :action => 'index', :project_id => @project}, :method => :get, :id => 'query_form') do %>
5
	<%= l(:label_date_from) %>
6
	<%= text_field_tag 'from',@date_from,:size => 10 %> 
7
	<%= calendar_for('from') %>  
8
	<%= l(:label_date_to) %>
9
	<%= text_field_tag 'to',@date_to - 1,:size => 10 %>
10
	<%= calendar_for('to') %>
11
	<%= submit_tag( l(:button_apply) , :class => 'button-small' ) %>
12
<% end %>
13

  
4 14
<div id="activity">
5 15
<% @events_by_day.keys.sort.reverse.each do |day| %>
6 16
<h3><%= format_activity_day(day) %></h3>
......
23 33

  
24 34
<div style="float:left;">
25 35
<%= link_to_content_update("\xc2\xab " + l(:label_previous),
26
                   params.merge(:from => @date_to - @days - 1),
27
                   :title => l(:label_date_from_to, :start => format_date(@date_to - 2*@days), :end => format_date(@date_to - @days - 1))) %>
36
                   params.merge(:from => @date_from - @days, :to => @date_from - 1),
37
                   :title => l(:label_date_from_to, :start => format_date(@date_from - @days), :end => format_date(@date_from - 1))) %>
28 38
</div>
29 39
<div style="float:right;">
30 40
<%= link_to_content_update(l(:label_next) + " \xc2\xbb",
31
                   params.merge(:from => @date_to + @days - 1),
32
                   :title => l(:label_date_from_to, :start => format_date(@date_to), :end => format_date(@date_to + @days - 1))) unless @date_to >= Date.today %>
41
                   params.merge(:from => @date_to, :to => @date_to + @days - 1),
42
                   :title => l(:label_date_from_to, :start => format_date(@date_to), :end => format_date(@date_to + @days - 1))) unless @date_to > Date.today %>
33 43
</div>
34 44
&nbsp;
35 45
<% other_formats_links do |f| %>
36
  <%= f.link_to 'Atom', :url => params.merge(:from => nil, :key => User.current.rss_key) %>
46
  <%= f.link_to 'Atom', :url => params.merge(:from => nil, :to => nil, :key => User.current.rss_key) %>
37 47
<% end %>
38 48

  
39 49
<% content_for :header_tags do %>
40
<%= auto_discovery_link_tag(:atom, params.merge(:format => 'atom', :from => nil, :key => User.current.rss_key)) %>
50
<%= auto_discovery_link_tag(:atom, params.merge(:format => 'atom', :from => nil, :to => nil, :key => User.current.rss_key)) %>
41 51
<% end %>
42 52

  
43 53
<% content_for :sidebar do %>
......
49 59
    <%= check_box_tag "show_#{t}", 1, @activity.scope.include?(t) %>
50 60
    <label for="show_<%=t%>">
51 61
      <%= link_to(l("label_#{t.singularize}_plural"),
52
                  {"show_#{t}" => 1, :user_id => params[:user_id], :from => params[:from]})%>
62
                  {"show_#{t}" => 1, :user_id => params[:user_id], :from => params[:from], :to => params[:to]})%>
53 63
    </label>
54 64
  </li>
55 65
<% end %>
app/views/users/show.html.erb (working copy)
37 37
<% unless @events_by_day.empty? %>
38 38
<h3><%= link_to l(:label_activity), :controller => 'activities',
39 39
                :action => 'index', :id => nil, :user_id => @user,
40
                :from => @events_by_day.keys.first %></h3>
40
                :from => @events_by_day.keys.first - Setting.activity_days_default.to_i, 
41
                :to => @events_by_day.keys.first %>
42
</h3>
41 43

  
42 44
<p>
43 45
<%=l(:label_reported_issues)%>: <%= Issue.where(:author_id => @user.id).count %>
(3-3/7)