Patch #31224 » my_page_time_entry_queries_SVN.diff
| app/views/my/blocks/_timelog_query_selection.html.erb | ||
|---|---|---|
|
<h3>
|
||
|
<%= l(:label_time_entry_plural) %>
|
||
|
</h3>
|
||
|
<div id="<%= block %>-settings">
|
||
|
<%= form_tag(my_page_path, :remote => true) do %>
|
||
|
<div class="box">
|
||
|
<p>
|
||
|
<label>
|
||
|
<%= l(:label_query) %>
|
||
|
<%= select_tag "settings[#{block}][query_id]", content_tag("option") + options_from_collection_for_select(queries, :id, :name, settings[:query_id]) %>
|
||
|
</label>
|
||
|
</p>
|
||
|
</div>
|
||
|
<p>
|
||
|
<%= submit_tag l(:button_save) %>
|
||
|
</p>
|
||
|
<% end %>
|
||
|
</div>
|
||
| app/views/my/blocks/_timelogs.erb | ||
|---|---|---|
|
<div class="contextual">
|
||
|
<%= link_to_function l(:label_options), "$('##{block}-settings').toggle();", :class => 'icon-only icon-settings', :title => l(:label_options) %>
|
||
|
</div>
|
||
|
<h3>
|
||
|
<%= "#{query.project} |" if query.project %>
|
||
|
<%= link_to query.name, _project_issues_path(query.project, query.as_params) %>
|
||
|
(<%= scope.count %>)
|
||
|
</h3>
|
||
|
<div id="<%= block %>-settings" style="display:none;">
|
||
|
<%= form_tag(my_page_path, :remote => true) do %>
|
||
|
<div class="box">
|
||
|
<%= render_query_columns_selection(query, :name => "settings[#{block}][columns]") %>
|
||
|
</div>
|
||
|
<p>
|
||
|
<%= submit_tag l(:button_save) %>
|
||
|
<%= link_to_function l(:button_cancel), "$('##{block}-settings').toggle();" %>
|
||
|
</p>
|
||
|
<% end %>
|
||
|
</div>
|
||
|
<% 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 %>
|
||
|
<p class="nodata"><%= l(:label_no_data) %></p>
|
||
|
<% 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 %>
|
||
| app/helpers/my_helper.rb | ||
|---|---|---|
|
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)).
|
||
| app/views/timelog/_list.html.erb | ||
|---|---|---|
|
<%= check_box_tag 'check_all', '', false, :class => 'toggle-selection',
|
||
|
:title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}" %>
|
||
|
</th>
|
||
|
<% @query.inline_columns.each do |column| %>
|
||
|
<%= column_header(@query, column) %>
|
||
|
<% query.inline_columns.each do |column| %>
|
||
|
<%= column_header(query, column) %>
|
||
|
<% end %>
|
||
|
<th></th>
|
||
|
</tr>
|
||
|
</thead>
|
||
|
<tbody>
|
||
|
<% 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 %>
|
||
|
<tr class="group open">
|
||
|
<td colspan="<%= @query.inline_columns.size + 2 %>">
|
||
|
<td colspan="<%= query.inline_columns.size + 2 %>">
|
||
|
<span class="expander" onclick="toggleRowGroup(this);"> </span>
|
||
|
<span class="name"><%= group_name %></span>
|
||
|
<% if group_count %>
|
||
| ... | ... | |
|
<% end %>
|
||
|
<tr id="time-entry-<%= entry.id %>" class="time-entry <%= cycle("odd", "even") %> hascontextmenu">
|
||
|
<td class="checkbox hide-when-print"><%= check_box_tag("ids[]", entry.id, false, :id => nil) %></td>
|
||
|
<% @query.inline_columns.each do |column| %>
|
||
|
<% query.inline_columns.each do |column| %>
|
||
|
<%= content_tag('td', column_content(column, entry), :class => column.css_classes) %>
|
||
|
<% end %>
|
||
|
<td class="buttons">
|
||
| ... | ... | |
|
<%= link_to_context_menu %>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<% @query.block_columns.each do |column|
|
||
|
<% query.block_columns.each do |column|
|
||
|
if (text = column_content(column, issue)) && text.present? -%>
|
||
|
<tr class="<%= current_cycle %>">
|
||
|
<td colspan="<%= @query.inline_columns.size + 1 %>" class="<%= column.css_classes %>">
|
||
|
<td colspan="<%= query.inline_columns.size + 1 %>" class="<%= column.css_classes %>">
|
||
|
<% if query.block_columns.count > 1 %>
|
||
|
<span><%= column.caption %></span>
|
||
|
<% end %>
|
||
| app/views/timelog/index.html.erb | ||
|---|---|---|
|
<p class="nodata"><%= l(:label_no_data) %></p>
|
||
|
<% else %>
|
||
|
<%= render_query_totals(@query) %>
|
||
|
<%= render :partial => 'list', :locals => { :entries => @entries }%>
|
||
|
<%= render :partial => 'list', :locals => { :entries => @entries, :query => @query }%>
|
||
|
<span class="pagination"><%= pagination_links_full @entry_pages, @entry_count %></span>
|
||
|
<% other_formats_links do |f| %>
|
||
| lib/redmine/my_page.rb | ||
|---|---|---|
|
'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}
|
||
|
}
|
||