Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

move xls export trigger to toolbar

ulfertsde720189fa2a
diff --git a/app/helpers/meta_tags_helper.rb b/app/helpers/meta_tags_helper.rb
index a7da86c822a..ff90eab8181 100644
--- a/app/helpers/meta_tags_helper.rb
+++ b/app/helpers/meta_tags_helper.rb
@@ -41,8 +41,6 @@ module MetaTagsHelper
##
# Writer of html_title as string
def html_title(*args)
- title = []
-
raise "Don't use html_title getter" if args.empty?
@html_title ||= []
diff --git a/modules/reporting/app/views/cost_reports/index.html.erb b/modules/reporting/app/views/cost_reports/index.html.erb
index 749d607b961..ffef8badf06 100644
--- a/modules/reporting/app/views/cost_reports/index.html.erb
+++ b/modules/reporting/app/views/cost_reports/index.html.erb
@@ -35,21 +35,30 @@ See docs/COPYRIGHT.rdoc for more details.
<% end %>
<% end %>
-<% html_title (@query.persisted? ? "#{l(:label_cost_report)}: #{@query.name}" : l(:label_new_report)) %>
+<% html_title (@query.persisted? ? "#{t(:label_cost_report)}: #{@query.name}" : t(:label_new_report)) %>
+
+<div class="toolbar-container">
+ <div class="toolbar">
+ <div class="title-container">
+ <h2 id="ur_caption">
+ <%= render_widget Widget::Controls::QueryName, @query, :can_rename => allowed_to?(:rename, @query, current_user) %>
+ </h2>
+ </div>
+ <ul class="toolbar-items">
+ <%= call_hook(:view_cost_report_toolbar) %>
+ </ul>
+ </div>
+</div>
-<h2 id="ur_caption">
- <%= render_widget Widget::Controls::QueryName, @query, :can_rename => allowed_to?(:rename, @query, current_user) %>
-</h2>
<%= render_widget Widget::Settings, @query, :cost_types => @cost_types, :selected_type_id => @unit_id %>
<div id="result-table">
<%= render_widget Widget::Table, @query %>
</div>
<p class="footnote">
- <%= l(:text_costs_are_rounded_note) %>
- <%= "<br />#{l(:information_restricted_depending_on_permission)}".html_safe if !User.current.admin?%>
+ <%= t(:text_costs_are_rounded_note) %>
+ <%= "<br />#{t(:information_restricted_depending_on_permission)}".html_safe unless User.current.admin?%>
</p>
-<%= call_hook(:view_cost_report_table_bottom) %>
<% content_for :sidebar do %>
<% [:private, :public].each do |type| %>
diff --git a/modules/xls_export/app/views/hooks/xls_report/_view_cost_report_other_formats.html.erb b/modules/xls_export/app/views/hooks/xls_report/_view_cost_report_other_formats.html.erb
deleted file mode 100644
index 9a1f2aa8549..00000000000
--- a/modules/xls_export/app/views/hooks/xls_report/_view_cost_report_other_formats.html.erb
+++ /dev/null
@@ -1,7 +0,0 @@
-<% content_for :header_tags do %>
- <%= stylesheet_link_tag 'excel_export', :plugin => 'xls_export' %>
-<% end %>
-<% if User.current.allowed_to? :export_work_packages, @project, :global => @project.nil? %>
- <%= link_to(l(:export_to_excel), { :controller => "cost_reports" , :action => :index,
- :format => 'xls', :project_id => @project }, :class => "icon icon-export-xls-descr") %>
-<% end %>
diff --git a/modules/xls_export/app/views/hooks/xls_report/_view_cost_report_toolbar.html.erb b/modules/xls_export/app/views/hooks/xls_report/_view_cost_report_toolbar.html.erb
new file mode 100644
index 00000000000..25419b6ba6c
--- /dev/null
+++ b/modules/xls_export/app/views/hooks/xls_report/_view_cost_report_toolbar.html.erb
@@ -0,0 +1,10 @@
+<% if User.current.allowed_to? :export_work_packages, @project, :global => @project.nil? %>
+ <li class="toolbar-item">
+ <%= link_to(t(:export_to_excel),
+ { controller: "cost_reports" ,
+ action: :index,
+ format: 'xls',
+ project_id: @project },
+ :class => "button icon-export-xls-descr") %>
+ </li>
+<% end %>
diff --git a/modules/xls_export/config/locales/en.yml b/modules/xls_export/config/locales/en.yml
index ce2580c893e..ff907b35a7b 100644
--- a/modules/xls_export/config/locales/en.yml
+++ b/modules/xls_export/config/locales/en.yml
@@ -1,5 +1,5 @@
en:
- export_to_excel: "Export as excel spreadsheet"
+ export_to_excel: "Export XLS"
print_with_description: "Print preview with description"
sentence_separator_or: "or"
different_formats: Different formats
diff --git a/modules/xls_export/lib/open_project/xls_export/hooks/cost_report_hook.rb b/modules/xls_export/lib/open_project/xls_export/hooks/cost_report_hook.rb
index 2d52bfbb3eb..6c103e90105 100644
--- a/modules/xls_export/lib/open_project/xls_export/hooks/cost_report_hook.rb
+++ b/modules/xls_export/lib/open_project/xls_export/hooks/cost_report_hook.rb
@@ -1,7 +1,6 @@
# Hooks to attach to the Redmine Issues.
module XlsReport
- class CostReportHook < Redmine::Hook::ViewListener
- # Renders the Cost Object subject and basic costs information
- render_on :view_cost_report_table_bottom, :partial => 'hooks/xls_report/view_cost_report_other_formats'
+ class CostReportHook < Redmine::Hook::ViewListener
+ render_on :view_cost_report_toolbar, partial: 'hooks/xls_report/view_cost_report_toolbar'
end
end
\ No newline at end of file