Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
235 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
require_dependency 'queries_helper' | ||
|
||
module QueriesHelper | ||
|
||
def column_content_with_subtasks(column, issue, query) | ||
if column.is_a?(QueryCustomFieldColumn) | ||
cv = issue.custom_values.detect {|v| v.custom_field_id == column.custom_field.id} | ||
show_value(cv) | ||
else | ||
value = issue.send(column.name) | ||
if value.is_a?(Date) | ||
format_date(value) | ||
elsif value.is_a?(Time) | ||
format_time(value) | ||
else | ||
case column.name | ||
when :subject | ||
subject_in_tree(issue, value, query) | ||
when :done_ratio | ||
progress_bar(value, :width => '80px') | ||
when :fixed_version | ||
link_to(h(value), { :controller => 'versions', :action => 'show', :id => issue.fixed_version_id }) | ||
else | ||
h(value) | ||
end | ||
end | ||
end | ||
end | ||
alias_method_chain :column_content, :subtasks | ||
|
||
def subject_in_tree(issue, value, query) | ||
RAILS_DEFAULT_LOGGER.info "QUERY: #{query.view_options}" | ||
case query.view_options['show_parents'] | ||
when Query::VIEW_OPTIONS_SHOW_PARENTS_NEVER | ||
content_tag('div', subject_text(issue, value), :class=>'issue-subject') | ||
else | ||
content_tag('span', content_tag('div', subject_text(issue, value), :class=>'issue-subject'), :class=>"issue-subject-level-#{issue.hierarchical_level}") | ||
end | ||
end | ||
|
||
def subject_text(issue, value) | ||
subject_text = link_to(h(value), :controller => 'issues', :action => 'show', :id => issue) | ||
h((@project.nil? || @project != issue.project) ? "#{issue.project.name} - " : '') + subject_text | ||
end | ||
|
||
def issue_content(issue, query, options = { }) | ||
html = "" | ||
html << "<tr id=\"issue-#{issue.id}\" class=\"issue hascontextmenu " + | ||
( options[:unfiltered] ? 'issue-unfiltered ' : '') + | ||
"status-#{issue.status.position} priority-#{issue.priority.position} " + | ||
cycle('odd', 'even') + '">' | ||
html << '<td class="checkbox">' + check_box_tag( "ids[]", issue.id, false, :id => nil) + '</td>' | ||
html << '<td>' + link_to( issue.id, :controller => 'issues', :action => 'show', :id => issue) + '</td>' | ||
query.columns.each do |column| | ||
html << content_tag( 'td', column_content(column, issue, query), :class => column.name) | ||
end | ||
html << "</tr>" | ||
html | ||
end | ||
|
||
def issues_family_content( parent, issues_to_show, query) | ||
html = "" | ||
html << issue_content( parent, query, :unfiltered => !( issues_to_show.include? parent)) | ||
unless parent.children.empty? | ||
parent.children.each do |child| | ||
if issues_to_show.include?( child) || issues_to_show.detect { |i| i.ancestors.include? child } | ||
html << issues_family_content( child, issues_to_show, query) | ||
end | ||
end | ||
end | ||
html | ||
end | ||
|
||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<% form_tag({}) do -%> | ||
<table class="list issues"> | ||
<thead><tr> | ||
<th><%= link_to image_tag('toggle_check.png'), {}, :onclick => 'toggleIssuesSelection(Element.up(this, "form")); return false;', | ||
:title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}" %> | ||
</th> | ||
<%= sort_header_tag('id', :caption => '#', :default_order => 'desc') %> | ||
<% query.columns.each do |column| %> | ||
<%= column_header(column) %> | ||
<% end %> | ||
</tr></thead> | ||
<tbody> | ||
<% if query.view_options['show_parents'] == Query::VIEW_OPTIONS_SHOW_PARENTS_NEVER -%> | ||
<% issues.each do |issue| -%> | ||
<%= issue_content( issue, query) %> | ||
<% end -%> | ||
<% elsif query.view_options['show_parents'] == Query::VIEW_OPTIONS_SHOW_PARENTS_ALWAYS -%> | ||
<% issues.each do |issue| -%> | ||
<% issue.ancestors.reverse.each do |parent_issue| -%> | ||
<%= issue_content( parent_issue, query, :unfiltered => true) %> | ||
<% end -%> | ||
<%= issue_content( issue, query) %> | ||
<% end -%> | ||
<% elsif query.view_options['show_parents'] == Query::VIEW_OPTIONS_SHOW_PARENTS_ORGANIZE_BY_PARENT -%> | ||
<% parents_on_first_lvl = [] | ||
issues.each do |i| | ||
if i.parent | ||
first_parent = i.root | ||
else | ||
first_parent = i | ||
end | ||
parents_on_first_lvl += [ first_parent ] unless parents_on_first_lvl.include?( first_parent) | ||
end -%> | ||
<% parents_on_first_lvl.each do |parent| -%> | ||
<%= issues_family_content( parent, issues, query) %> | ||
<% end -%> | ||
<% end -%> | ||
</tbody> | ||
</table> | ||
<% end -%> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
<% if @query.new_record? %> | ||
<h2><%=l(:label_issue_plural)%></h2> | ||
<% html_title(l(:label_issue_plural)) %> | ||
<% form_tag({ :controller => 'queries', :action => 'new' }, :id => 'query_form') do %> | ||
<%= hidden_field_tag('project_id', @project.to_param) if @project %> | ||
<fieldset id="view"><legend><%= l(:label_view) %></legend> | ||
<%= render :partial => 'queries/view_options', :locals => {:query => @query } %> | ||
</fieldset> | ||
<fieldset id="filters"><legend><%= l(:label_filter_plural) %></legend> | ||
<%= render :partial => 'queries/filters', :locals => {:query => @query} %> | ||
</fieldset> | ||
<p class="buttons"> | ||
<%= link_to_remote l(:button_apply), | ||
{ :url => { :set_filter => 1 }, | ||
:update => "content", | ||
:with => "Form.serialize('query_form')" | ||
}, :class => 'icon icon-checked' %> | ||
<%= link_to_remote l(:button_clear), | ||
{ :url => { :set_filter => 1, :project_id => @project }, | ||
:method => :get, | ||
:update => "content", | ||
}, :class => 'icon icon-reload' %> | ||
<% if User.current.allowed_to?(:save_queries, @project, :global => true) %> | ||
<%= link_to l(:button_save), {}, :onclick => "$('query_form').submit(); return false;", :class => 'icon icon-save' %> | ||
<% end %> | ||
</p> | ||
<% end %> | ||
<% else %> | ||
<div class="contextual"> | ||
<% if @query.editable_by?(User.current) %> | ||
<%= link_to l(:button_edit), {:controller => 'queries', :action => 'edit', :id => @query}, :class => 'icon icon-edit' %> | ||
<%= link_to l(:button_delete), {:controller => 'queries', :action => 'destroy', :id => @query}, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-del' %> | ||
<% end %> | ||
</div> | ||
<h2><%=h @query.name %></h2> | ||
<div id="query_form"></div> | ||
<% html_title @query.name %> | ||
<% end %> | ||
<%= error_messages_for 'query' %> | ||
<% if @query.valid? %> | ||
<% if @issues.empty? %> | ||
<p class="nodata"><%= l(:label_no_data) %></p> | ||
<% else %> | ||
<%= render :partial => 'issues/list', :locals => {:issues => @issues, :query => @query} %> | ||
<p class="pagination"><%= pagination_links_full @issue_pages, @issue_count %></p> | ||
<% end %> | ||
<% other_formats_links do |f| %> | ||
<%= f.link_to 'Atom', :url => { :project_id => @project, :query_id => (@query.new_record? ? nil : @query), :key => User.current.rss_key } %> | ||
<%= f.link_to 'CSV', :url => { :project_id => @project } %> | ||
<%= f.link_to 'PDF', :url => { :project_id => @project } %> | ||
<% end %> | ||
<% end %> | ||
<% content_for :sidebar do %> | ||
<%= render :partial => 'issues/sidebar' %> | ||
<% end %> | ||
<% content_for :header_tags do %> | ||
<%= auto_discovery_link_tag(:atom, {:query_id => @query, :format => 'atom', :page => nil, :key => User.current.rss_key}, :title => l(:label_issue_plural)) %> | ||
<%= auto_discovery_link_tag(:atom, {:action => 'changes', :query_id => @query, :format => 'atom', :page => nil, :key => User.current.rss_key}, :title => l(:label_changes_details)) %> | ||
<%= javascript_include_tag 'context_menu' %> | ||
<%= stylesheet_link_tag 'context_menu' %> | ||
<% end %> | ||
|
||
<div id="context-menu" style="display: none;"></div> | ||
<%= javascript_tag "new ContextMenu('#{url_for(:controller => 'issues', :action => 'context_menu')}')" %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<% query.view_options.each_key do |voption| -%> | ||
<%= query.caption_for_view_option( voption) %>: | ||
<%= select_tag( "view_options[#{voption}]", | ||
options_for_select( query.values_for_view_option( voption), | ||
query.view_options[voption])) %> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.