Index: app/views/my/blocks/_timelog_query_selection.html.erb new file mode 100644 =================================================================== --- /dev/null +++ app/views/my/blocks/_timelog_query_selection.html.erb @@ -0,0 +1,19 @@ +
+ +
++ <%= submit_tag l(:button_save) %> +
+ <% end %> +<%= l(:label_no_data) %>
+<% end %> + +<% content_for :header_tags do %> +<%= auto_discovery_link_tag(:atom, + _time_entries_path(query.project, query.as_params.merge(:format => 'atom', :key => User.current.rss_key)), + {:title => query.name}) %> +<% end %> Index: app/helpers/my_helper.rb =================================================================== --- app/helpers/my_helper.rb +++ app/helpers/my_helper.rb @@ -140,6 +140,27 @@ module MyHelper end end + def render_timelogquery_block(block, settings) + query = TimeEntryQuery.visible.find_by_id(settings[:query_id]) + + if query + query.column_names = settings[:columns] if settings[:columns].present? + query.sort_criteria = settings[:sort] if settings[:sort].present? + + scope = query.results_scope + scope = scope. + preload(:issue => [:project, :tracker, :status, :assigned_to, :priority]). + preload(:project, :user) + + entries = scope.limit(10).to_a + + render :partial => 'my/blocks/timelogs', :locals => {:query => query, :scope => scope, :entries => entries, :block => block, :settings => settings} + else + queries = TimeEntryQuery.visible.sorted + render :partial => 'my/blocks/timelog_query_selection', :locals => {:queries => queries, :block => block, :settings => settings} + end + end + def render_news_block(block, settings) news = News.visible. where(:project_id => User.current.projects.pluck(:id)). Index: app/views/timelog/_list.html.erb =================================================================== --- app/views/timelog/_list.html.erb +++ app/views/timelog/_list.html.erb @@ -8,18 +8,18 @@ <%= check_box_tag 'check_all', '', false, :class => 'toggle-selection', :title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}" %> - <% @query.inline_columns.each do |column| %> - <%= column_header(@query, column) %> + <% query.inline_columns.each do |column| %> + <%= column_header(query, column) %> <% end %><%= l(:label_no_data) %>
<% else %> <%= render_query_totals(@query) %> -<%= render :partial => 'list', :locals => { :entries => @entries }%> +<%= render :partial => 'list', :locals => { :entries => @entries, :query => @query }%> <%= pagination_links_full @entry_pages, @entry_count %> <% other_formats_links do |f| %> Index: lib/redmine/my_page.rb =================================================================== --- lib/redmine/my_page.rb +++ lib/redmine/my_page.rb @@ -26,10 +26,11 @@ module Redmine 'issuesreportedbyme' => {:label => :label_reported_issues}, 'issueswatched' => {:label => :label_watched_issues}, 'issuequery' => {:label => :label_issue_plural, :max_occurs => 3}, + 'timelogquery' => {:label => :label_time_entry_plural, :max_occurs => 3}, 'news' => {:label => :label_news_latest}, 'calendar' => {:label => :label_calendar}, 'documents' => {:label => :label_document_plural}, - 'timelog' => {:label => :label_spent_time}, + 'timelog' => {:label => :label_time_by_activity}, 'activity' => {:label => :label_activity} }