<% if User.current.allowed_to?(:add_issues, @project, :global => true) && (@project.nil? || Issue.allowed_target_trackers(@project).any?) %>
<%= link_to l(:label_issue_new), _new_project_issue_path(@project), :class => 'icon icon-add new-issue' %>
<% end %>
<%= actions_dropdown do %>
<% if @project %>
<%= link_to l(:field_summary), project_issues_report_path(@project), :class => 'icon icon-stats' %>
<% end %>
<% if User.current.allowed_to?(:import_issues, @project, :global => true) && User.current.allowed_to?(:add_issues, @project, :global => true) %>
<%= link_to l(:button_import), new_issues_import_path(:project_id => @project), :class => 'icon icon-import' %>
<% end %>
<%= link_to_if_authorized l(:label_settings),
{:controller => 'projects', :action => 'settings', :id => @project, :tab => 'issues'},
:class => 'icon icon-settings' if User.current.allowed_to?(:edit_project, @project) %>
<% end %>
<%= @query.new_record? ? l(:label_issue_plural) : @query.name %>
<% html_title(@query.new_record? ? l(:label_issue_plural) : @query.name) %>
<%= form_tag(_project_issues_path(@project), :method => :get, :id => 'query_form') do %>
<%= render :partial => 'queries/query_form' %>
<% end %>
<% if @query.valid? %>
<% if @issues.empty? %>
<%= l(:label_no_data) %>
<% else %>
<%= render_query_totals(@query) %>
<%= render :partial => 'issues/list', :locals => {:issues => @issues, :query => @query} %>
<% end %>
<% other_formats_links do |f| %>
<%= f.link_to_with_query_parameters 'Atom', :key => User.current.atom_key %>
<%= f.link_to_with_query_parameters 'CSV', {}, :onclick => "showModal('csv-export-options', '350px'); return false;" %>
<%= f.link_to_with_query_parameters 'PDF' %>
<% end %>
<%= l(:label_export_options, :export_format => 'CSV') %>
<%= form_tag(_project_issues_path(@project, :format => 'csv'), :method => :get, :id => 'csv-export-form') do %>
<%= query_as_hidden_field_tags(@query) %>
<%= hidden_field_tag('query_name', @query.name) %>
<% if @query.available_block_columns.any? %>
<% end %>
<%= export_csv_encoding_select_tag %>
<%= export_csv_separator_select_tag %>
<% if @issue_count > Setting.issues_export_limit.to_i %>
<%= l(:setting_issues_export_limit) %>: <%= Setting.issues_export_limit.to_i %>
<% end %>
<%= submit_tag l(:button_export), :name => nil, :onclick => "hideModal(this);", :data => { :disable_with => false } %>
<%= link_to_function l(:button_cancel), "hideModal(this);" %>
<% end %>
<% end %>
<%= call_hook(:view_issues_index_bottom, { :issues => @issues, :project => @project, :query => @query }) %>
<% 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.atom_key},
:title => l(:label_issue_plural)) %>
<%= auto_discovery_link_tag(:atom,
{:controller => 'journals', :action => 'index',
:query_id => @query, :format => 'atom',
:page => nil, :key => User.current.atom_key},
:title => l(:label_changes_details)) %>
<% end %>
<%= context_menu %>