Project

General

Profile

Feature #1422 » activitydaterange.patch

Preethi Sriram, 2012-04-06 19:43

View differences:

app/controllers/activities_controller.rb (working copy)
menu_item :activity
before_filter :find_optional_project
accept_rss_auth :index
def index
@days = Setting.activity_days_default.to_i
if params[:from]
begin; @date_to = params[:from].to_date + 1; rescue; end
end
@date_to ||= Date.today + 1
@date_from = @date_to - @days
if params[:date_from]
begin; @date_from = params[:date_from].to_date; rescue; end
end
if params[:date_to]
begin; @date_to = params[:date_to].to_date; rescue; end
end
@with_subprojects = params[:with_subprojects].nil? ? Setting.display_subprojects_issues? : (params[:with_subprojects] == '1')
@author = (params[:user_id].blank? ? nil : User.active.find(params[:user_id]))
......
:author => @author)
@activity.scope_select {|t| !params["show_#{t}"].nil?}
@activity.scope = (@author.nil? ? :default : :all) if @activity.scope.empty?
events = @activity.events(@date_from, @date_to)
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)
<h2><%= @author.nil? ? l(:label_activity) : l(:label_user_activity, link_to_user(@author)) %></h2>
<p class="subtitle"><%= l(:label_date_from_to, :start => format_date(@date_to - @days), :end => format_date(@date_to-1)) %></p>
<p class="subtitle"><%= l(:label_date_from_to, :start => format_date(@date_from), :end => format_date(@date_to)) %></p>
<% form_tag({:controller => 'activities', :action => 'index', :project_id => @project}, :method => :get, :id => 'query_form') do %>
<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')%>
<%= link_to_function l(:button_apply), '$("query_form").submit()', :class => 'icon icon-checked' %>
</p>
<% end %>
<div id="activity">
<% @events_by_day.keys.sort.reverse.each do |day| %>
<h3><%= format_activity_day(day) %></h3>
config/locales/en.yml (working copy)
label_ascending: Ascending
label_descending: Descending
label_date_from_to: From %{start} to %{end}
label_date_from: From
label_date_to: To
label_wiki_content_added: Wiki page added
label_wiki_content_updated: Wiki page updated
label_group: Group
(1-1/7)