OpenProject is the leading open source project management software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openproject/app/helpers/toolbar_helper.rb

35 lines
829 B

module ToolbarHelper
def toolbar(title:, subtitle: '', html: {})
classes = ['toolbar-container', html[:class]].compact.join(' ')
content_tag :div, class: classes do
toolbar = content_tag :div, class: 'toolbar' do
dom_title(title) + dom_toolbar {
yield if block_given?
}
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, class: 'toolbar-items' do
yield
end
end
def decode(string)
raw(strip_tags(string)).strip
end
end