Project

General

Profile

Feature #1422 » activitydaterange.patch

Preethi Sriram, 2012-04-06 19:43

View differences:

app/controllers/activities_controller.rb (working copy)
19 19
  menu_item :activity
20 20
  before_filter :find_optional_project
21 21
  accept_rss_auth :index
22

  
22
  
23
  
23 24
  def index
24 25
    @days = Setting.activity_days_default.to_i
25 26

  
26 27
    if params[:from]
27 28
      begin; @date_to = params[:from].to_date + 1; rescue; end
28 29
    end
29

  
30
     
31
   
30 32
    @date_to ||= Date.today + 1
31 33
    @date_from = @date_to - @days
34
    
35
    if params[:date_from]
36
      begin; @date_from = params[:date_from].to_date; rescue; end
37
    end
38
    
39
    if params[:date_to]
40
      begin; @date_to = params[:date_to].to_date; rescue; end
41
    end
42
   
32 43
    @with_subprojects = params[:with_subprojects].nil? ? Setting.display_subprojects_issues? : (params[:with_subprojects] == '1')
33 44
    @author = (params[:user_id].blank? ? nil : User.active.find(params[:user_id]))
34 45

  
......
37 48
                                                             :author => @author)
38 49
    @activity.scope_select {|t| !params["show_#{t}"].nil?}
39 50
    @activity.scope = (@author.nil? ? :default : :all) if @activity.scope.empty?
40

  
51
    
52
    
53
    
41 54
    events = @activity.events(@date_from, @date_to)
42 55

  
43 56
    if events.empty? || stale?(:etag => [@activity.scope, @date_to, @date_from, @with_subprojects, @author, events.first, User.current, current_language])
app/views/activities/index.html.erb (working copy)
1 1
<h2><%= @author.nil? ? l(:label_activity) : l(:label_user_activity, link_to_user(@author)) %></h2>
2
<p class="subtitle"><%= l(:label_date_from_to, :start => format_date(@date_to - @days), :end => format_date(@date_to-1)) %></p>
3

  
2
<p class="subtitle"><%= l(:label_date_from_to, :start => format_date(@date_from), :end => format_date(@date_to)) %></p>
3
<% form_tag({:controller => 'activities', :action => 'index', :project_id => @project}, :method => :get, :id => 'query_form') do %>
4
<p><%=l(:label_date_from)%> <%= text_field_tag 'date_from',@date_from,:size => 10 %> <%=calendar_for('date_from')%>  <%=l(:label_date_to) %> <%= text_field_tag 'date_to',@date_to,:size => 10 %> <%=calendar_for('date_to')%>
5
<%= link_to_function l(:button_apply), '$("query_form").submit()', :class => 'icon icon-checked' %>
6
</p>
7
<% end %>
4 8
<div id="activity">
5 9
<% @events_by_day.keys.sort.reverse.each do |day| %>
6 10
<h3><%= format_activity_day(day) %></h3>
config/locales/en.yml (working copy)
796 801
  label_ascending: Ascending
797 802
  label_descending: Descending
798 803
  label_date_from_to: From %{start} to %{end}
804
  label_date_from: From
805
  label_date_to: To
799 806
  label_wiki_content_added: Wiki page added
800 807
  label_wiki_content_updated: Wiki page updated
801 808
  label_group: Group
(1-1/7)