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 @@ +

+ <%= l(:label_time_entry_plural) %> +

+ +
+ <%= form_tag(my_page_path, :remote => true) do %> +
+

+ +

+
+

+ <%= submit_tag l(:button_save) %> +

+ <% end %> +
Index: app/views/my/blocks/_timelogs.erb new file mode 100644 =================================================================== --- /dev/null +++ app/views/my/blocks/_timelogs.erb @@ -0,0 +1,41 @@ +
+ <%= link_to_function l(:label_options), "$('##{block}-settings').toggle();", :class => 'icon-only icon-settings', :title => l(:label_options) %> +
+ +

+ <%= "#{query.project} |" if query.project %> + <%= link_to query.name, _project_issues_path(query.project, query.as_params) %> + (<%= scope.count %>) +

+ + + +<% if entries.any? %> + <%= render :partial => 'timelog/list', + :locals => { + :entries => entries, + :query => query, + :query_options => { + :sort_param => "settings[#{block}][sort]", + :sort_link_options => {:method => :post, :remote => true} + } + } %> +<% else %> +

<%= l(:label_no_data) %>

+<% end %> + +<% content_for :header_tags do %> +<%= auto_discovery_link_tag(:atom, + _project_issues_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 %> -<% grouped_query_results(entries, @query) do |entry, group_name, group_count, group_totals| -%> +<% grouped_query_results(entries, query) do |entry, group_name, group_count, group_totals| -%> <% if group_name %> <% reset_cycle %> - +   <%= group_name %> <% if group_count %> @@ -33,7 +33,7 @@ <% end %> hascontextmenu"> <%= check_box_tag("ids[]", entry.id, false, :id => nil) %> - <% @query.inline_columns.each do |column| %> + <% query.inline_columns.each do |column| %> <%= content_tag('td', column_content(column, entry), :class => column.css_classes) %> <% end %> @@ -50,10 +50,10 @@ <%= link_to_context_menu %> - <% @query.block_columns.each do |column| + <% query.block_columns.each do |column| if (text = column_content(column, issue)) && text.present? -%> - + <% if query.block_columns.count > 1 %> <%= column.caption %> <% end %> Index: app/views/timelog/index.html.erb =================================================================== --- app/views/timelog/index.html.erb +++ app/views/timelog/index.html.erb @@ -15,7 +15,7 @@

<%= 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} }