diff options
Diffstat (limited to 'app/helpers/button_helper.rb')
-rw-r--r-- | app/helpers/button_helper.rb | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/app/helpers/button_helper.rb b/app/helpers/button_helper.rb index 494c754e7d5..b13bbbf518b 100644 --- a/app/helpers/button_helper.rb +++ b/app/helpers/button_helper.rb @@ -20,9 +20,9 @@ module ButtonHelper # # See http://clipboardjs.com/#usage def clipboard_button(data = {}) - css_class = data[:class] || 'btn-clipboard btn-transparent' - title = data[:title] || 'Copy to clipboard' - button_text = data[:button_text] || '' + css_class = data[:class] || "btn-clipboard btn-transparent" + title = data[:title] || "Copy to clipboard" + button_text = data[:button_text] || "" hide_tooltip = data[:hide_tooltip] || false hide_button_icon = data[:hide_button_icon] || false @@ -31,7 +31,7 @@ module ButtonHelper if text = data.delete(:text) data[:clipboard_text] = if gfm = data.delete(:gfm) - { text: text, gfm: gfm } + {text: text, gfm: gfm} else text end @@ -41,7 +41,7 @@ module ButtonHelper data[:clipboard_target] = target if target unless hide_tooltip - data = { toggle: 'tooltip', placement: 'bottom', container: 'body' }.merge(data) + data = {toggle: "tooltip", placement: "bottom", container: "body"}.merge(data) end button_attributes = { @@ -49,11 +49,11 @@ module ButtonHelper data: data, type: :button, title: title, - aria: { label: title } + aria: {label: title}, } content_tag :button, button_attributes do - concat(sprite_icon('duplicate')) unless hide_button_icon + concat(sprite_icon("duplicate")) unless hide_button_icon concat(button_text) end end @@ -63,14 +63,14 @@ module ButtonHelper dropdown_description = http_dropdown_description(protocol) append_url = project.http_url_to_repo if append_link - dropdown_item_with_description(protocol, dropdown_description, href: append_url, data: { clone_type: 'http' }) + dropdown_item_with_description(protocol, dropdown_description, href: append_url, data: {clone_type: "http"}) end def http_dropdown_description(protocol) if current_user.try(:require_password_creation_for_git?) - _("Set a password on your account to pull or push via %{protocol}.") % { protocol: protocol } + _("Set a password on your account to pull or push via %{protocol}.") % {protocol: protocol} elsif current_user.try(:require_personal_access_token_creation_for_git_auth?) - _("Create a personal access token on your account to pull or push via %{protocol}.") % { protocol: protocol } + _("Create a personal access token on your account to pull or push via %{protocol}.") % {protocol: protocol} end end @@ -82,18 +82,18 @@ module ButtonHelper append_url = project.ssh_url_to_repo if append_link - dropdown_item_with_description('SSH', dropdown_description, href: append_url, data: { clone_type: 'ssh' }) + dropdown_item_with_description("SSH", dropdown_description, href: append_url, data: {clone_type: "ssh"}) end def dropdown_item_with_description(title, description, href: nil, data: nil, default: false) active_class = "is-active" if default - button_content = content_tag(:strong, title, class: 'dropdown-menu-inner-title') - button_content << content_tag(:span, description, class: 'dropdown-menu-inner-content') if description + button_content = content_tag(:strong, title, class: "dropdown-menu-inner-title") + button_content << content_tag(:span, description, class: "dropdown-menu-inner-content") if description content_tag (href ? :a : :span), (href ? button_content : title), class: "#{title.downcase}-selector #{active_class}", - href: (href if href), - data: (data if data) + href: href, + data: data end end |