Patch #31224 » my_page_time_entry_queries_SVN.diff
| app/views/my/blocks/_timelog_query_selection.html.erb | ||
|---|---|---|
| 1 | <h3> | |
| 2 | <%= l(:label_time_entry_plural) %> | |
| 3 | </h3> | |
| 4 | ||
| 5 | <div id="<%= block %>-settings"> | |
| 6 | <%= form_tag(my_page_path, :remote => true) do %> | |
| 7 | <div class="box"> | |
| 8 | <p> | |
| 9 | <label> | |
| 10 | <%= l(:label_query) %> | |
| 11 |           <%= select_tag "settings[#{block}][query_id]", content_tag("option") + options_from_collection_for_select(queries, :id, :name, settings[:query_id]) %> | |
| 12 | </label> | |
| 13 | </p> | |
| 14 | </div> | |
| 15 | <p> | |
| 16 | <%= submit_tag l(:button_save) %> | |
| 17 | </p> | |
| 18 | <% end %> | |
| 19 | </div> | |
| app/views/my/blocks/_timelogs.erb | ||
|---|---|---|
| 1 | <div class="contextual"> | |
| 2 |   <%= link_to_function l(:label_options), "$('##{block}-settings').toggle();", :class => 'icon-only icon-settings', :title => l(:label_options) %> | |
| 3 | </div> | |
| 4 | ||
| 5 | <h3> | |
| 6 |   <%= "#{query.project} |" if query.project %> | |
| 7 | <%= link_to query.name, _project_issues_path(query.project, query.as_params) %> | |
| 8 | (<%= scope.count %>) | |
| 9 | </h3> | |
| 10 | ||
| 11 | <div id="<%= block %>-settings" style="display:none;"> | |
| 12 | <%= form_tag(my_page_path, :remote => true) do %> | |
| 13 | <div class="box"> | |
| 14 |       <%= render_query_columns_selection(query, :name => "settings[#{block}][columns]") %> | |
| 15 | </div> | |
| 16 | <p> | |
| 17 | <%= submit_tag l(:button_save) %> | |
| 18 |       <%= link_to_function l(:button_cancel), "$('##{block}-settings').toggle();" %> | |
| 19 | </p> | |
| 20 | <% end %> | |
| 21 | </div> | |
| 22 | ||
| 23 | <% if entries.any? %> | |
| 24 | <%= render :partial => 'timelog/list', | |
| 25 |              :locals => { | |
| 26 | :entries => entries, | |
| 27 | :query => query, | |
| 28 |                :query_options => { | |
| 29 |                  :sort_param => "settings[#{block}][sort]", | |
| 30 |                  :sort_link_options => {:method => :post, :remote => true} | |
| 31 | } | |
| 32 | } %> | |
| 33 | <% else %> | |
| 34 | <p class="nodata"><%= l(:label_no_data) %></p> | |
| 35 | <% end %> | |
| 36 | ||
| 37 | <% content_for :header_tags do %> | |
| 38 | <%= auto_discovery_link_tag(:atom, | |
| 39 | _project_issues_path(query.project, query.as_params.merge(:format => 'atom', :key => User.current.rss_key)), | |
| 40 |                             {:title => query.name}) %> | |
| 41 | <% end %> | |
| app/helpers/my_helper.rb | ||
|---|---|---|
| 140 | 140 | end | 
| 141 | 141 | end | 
| 142 | 142 | |
| 143 | def render_timelogquery_block(block, settings) | |
| 144 | query = TimeEntryQuery.visible.find_by_id(settings[:query_id]) | |
| 145 | ||
| 146 | if query | |
| 147 | query.column_names = settings[:columns] if settings[:columns].present? | |
| 148 | query.sort_criteria = settings[:sort] if settings[:sort].present? | |
| 149 | ||
| 150 | scope = query.results_scope | |
| 151 | scope = scope. | |
| 152 | preload(:issue => [:project, :tracker, :status, :assigned_to, :priority]). | |
| 153 | preload(:project, :user) | |
| 154 | ||
| 155 | entries = scope.limit(10).to_a | |
| 156 | ||
| 157 |       render :partial => 'my/blocks/timelogs', :locals => {:query => query, :scope => scope, :entries => entries, :block => block, :settings => settings} | |
| 158 | else | |
| 159 | queries = TimeEntryQuery.visible.sorted | |
| 160 |       render :partial => 'my/blocks/timelog_query_selection', :locals => {:queries => queries, :block => block, :settings => settings} | |
| 161 | end | |
| 162 | end | |
| 163 | ||
| 143 | 164 | def render_news_block(block, settings) | 
| 144 | 165 | news = News.visible. | 
| 145 | 166 | where(:project_id => User.current.projects.pluck(:id)). | 
| app/views/timelog/_list.html.erb | ||
|---|---|---|
| 8 | 8 | <%= check_box_tag 'check_all', '', false, :class => 'toggle-selection', | 
| 9 | 9 |         :title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}" %> | 
| 10 | 10 | </th> | 
| 11 |     <% @query.inline_columns.each do |column| %> | |
| 12 |       <%= column_header(@query, column) %> | |
| 11 | <% query.inline_columns.each do |column| %> | |
| 12 | <%= column_header(query, column) %> | |
| 13 | 13 | <% end %> | 
| 14 | 14 | <th></th> | 
| 15 | 15 | </tr> | 
| 16 | 16 | </thead> | 
| 17 | 17 | <tbody> | 
| 18 | <% grouped_query_results(entries, @query) do |entry, group_name, group_count, group_totals| -%> | |
| 18 | <% grouped_query_results(entries, query) do |entry, group_name, group_count, group_totals| -%> | |
| 19 | 19 | <% if group_name %> | 
| 20 | 20 | <% reset_cycle %> | 
| 21 | 21 | <tr class="group open"> | 
| 22 |       <td colspan="<%= @query.inline_columns.size + 2 %>"> | |
| 22 | <td colspan="<%= query.inline_columns.size + 2 %>"> | |
| 23 | 23 | <span class="expander" onclick="toggleRowGroup(this);"> </span> | 
| 24 | 24 | <span class="name"><%= group_name %></span> | 
| 25 | 25 | <% if group_count %> | 
| ... | ... | |
| 33 | 33 | <% end %> | 
| 34 | 34 |   <tr id="time-entry-<%= entry.id %>" class="time-entry <%= cycle("odd", "even") %> hascontextmenu"> | 
| 35 | 35 |     <td class="checkbox hide-when-print"><%= check_box_tag("ids[]", entry.id, false, :id => nil) %></td> | 
| 36 |     <% @query.inline_columns.each do |column| %> | |
| 36 | <% query.inline_columns.each do |column| %> | |
| 37 | 37 |     <%= content_tag('td', column_content(column, entry), :class => column.css_classes) %> | 
| 38 | 38 | <% end %> | 
| 39 | 39 | <td class="buttons"> | 
| ... | ... | |
| 50 | 50 | <%= link_to_context_menu %> | 
| 51 | 51 | </td> | 
| 52 | 52 | </tr> | 
| 53 |   <% @query.block_columns.each do |column| | |
| 53 | <% query.block_columns.each do |column| | |
| 54 | 54 | if (text = column_content(column, issue)) && text.present? -%> | 
| 55 | 55 | <tr class="<%= current_cycle %>"> | 
| 56 |     <td colspan="<%= @query.inline_columns.size + 1 %>" class="<%= column.css_classes %>"> | |
| 56 | <td colspan="<%= query.inline_columns.size + 1 %>" class="<%= column.css_classes %>"> | |
| 57 | 57 | <% if query.block_columns.count > 1 %> | 
| 58 | 58 | <span><%= column.caption %></span> | 
| 59 | 59 | <% end %> | 
| app/views/timelog/index.html.erb | ||
|---|---|---|
| 15 | 15 | <p class="nodata"><%= l(:label_no_data) %></p> | 
| 16 | 16 | <% else %> | 
| 17 | 17 | <%= render_query_totals(@query) %> | 
| 18 | <%= render :partial => 'list', :locals => { :entries => @entries }%> | |
| 18 | <%= render :partial => 'list', :locals => { :entries => @entries, :query => @query }%> | |
| 19 | 19 | <span class="pagination"><%= pagination_links_full @entry_pages, @entry_count %></span> | 
| 20 | 20 | |
| 21 | 21 | <% other_formats_links do |f| %> | 
| lib/redmine/my_page.rb | ||
|---|---|---|
| 26 | 26 |         'issuesreportedbyme' => {:label => :label_reported_issues}, | 
| 27 | 27 |         'issueswatched' => {:label => :label_watched_issues}, | 
| 28 | 28 |         'issuequery' => {:label => :label_issue_plural, :max_occurs => 3}, | 
| 29 |         'timelogquery' => {:label => :label_time_entry_plural, :max_occurs => 3}, | |
| 29 | 30 |         'news' => {:label => :label_news_latest}, | 
| 30 | 31 |         'calendar' => {:label => :label_calendar}, | 
| 31 | 32 |         'documents' => {:label => :label_document_plural}, | 
| 32 |         'timelog' => {:label => :label_spent_time}, | |
| 33 |         'timelog' => {:label => :label_time_by_activity}, | |
| 33 | 34 |         'activity' => {:label => :label_activity} | 
| 34 | 35 | } | 
| 35 | 36 | |