Merge pull request #3000 from floriank/feature/18330-use-toolbar
[18330] Use toolbar for harmonizing the headingspull/3007/head
commit
a6fe599f2b
@ -0,0 +1,33 @@ |
||||
module ToolbarHelper |
||||
def toolbar(title:, subtitle: '') |
||||
content_tag :div, class: 'toolbar-container' do |
||||
toolbar = content_tag :div, id: 'toolbar' do |
||||
dom_title(title) + dom_toolbar do |
||||
yield if block_given? |
||||
end |
||||
end |
||||
next toolbar if subtitle.blank? |
||||
toolbar + content_tag(:p, subtitle, class: 'subtitle') |
||||
end |
||||
end |
||||
|
||||
protected |
||||
|
||||
def dom_title(title) |
||||
content_tag :div, class: 'title-container' do |
||||
title_attribute = decode title |
||||
content_tag(:h2, title.html_safe, title: title_attribute) |
||||
end |
||||
end |
||||
|
||||
def dom_toolbar |
||||
return '' unless block_given? |
||||
content_tag :ul, id: 'toolbar-items' do |
||||
yield |
||||
end |
||||
end |
||||
|
||||
def decode(string) |
||||
raw strip_links string |
||||
end |
||||
end |
@ -0,0 +1,18 @@ |
||||
<%= toolbar(title: l("timelines.reporting_for_project.show", |
||||
:title => link_to_project(@reporting.reporting_to_project))) do %> |
||||
<% if show_actions %> |
||||
<% if authorize_for :reportings, :edit %> |
||||
<li class="toolbar-item"> |
||||
<%= link_to edit_project_reporting_path(@project, @reporting), class: 'button' do %> |
||||
<i class="button--icon icon-edit"></i> <%= l(:button_edit) %> |
||||
<% end %> |
||||
</li> |
||||
<% end %> |
||||
<% if authorize_for :reportings, :destroy %> |
||||
<%= link_to confirm_destroy_project_reporting_path(@project, @reporting), class: 'button' do %> |
||||
<i class="button--icon icon-delete"></i> <%= l(:button_delete) %> |
||||
<% end %> |
||||
<% end %> |
||||
<% end %> |
||||
|
||||
<% end %> |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue