From 36c05b311c830aef25ecb7ad4416ac77a5c98651 Mon Sep 17 00:00:00 2001 From: Alexis Reigel Date: Wed, 5 Jul 2017 20:59:17 +0200 Subject: convert gpg badge helper methods to partials --- app/helpers/commits_helper.rb | 86 ------------------------------------------- 1 file changed, 86 deletions(-) (limited to 'app/helpers/commits_helper.rb') diff --git a/app/helpers/commits_helper.rb b/app/helpers/commits_helper.rb index 60acc1e2f82..d08e346d605 100644 --- a/app/helpers/commits_helper.rb +++ b/app/helpers/commits_helper.rb @@ -212,90 +212,4 @@ module CommitsHelper [commits, 0] end end - - def commit_gpg_signature_badge(signature) - if signature.valid_signature? - commit_gpg_valid_signature_badge(signature) - else - commit_gpg_invalid_signature_badge(signature) - end - end - - def commit_gpg_valid_signature_badge(signature) - title = capture do - concat content_tag('i', '', class: 'fa fa-check-circle gpg-badge-popover-icon valid', 'aria-hidden' => 'true') - concat 'This commit was signed with a verified signature.' - end - - content = capture do - link_to user_path(signature.gpg_key.user), class: 'gpg-badge-popover-user-link' do - concat( - content_tag(:div, class: 'gpg-badge-popover-avatar') do - user_avatar_without_link(user: signature.gpg_key.user, size: 32) - end - ) - - concat( - content_tag(:div, class: 'gpg-badge-popover-username') do - signature.gpg_key.user.username - end - ) - - concat( - content_tag(:div) do - signature.gpg_key.user.name - end - ) - end - end - - commit_gpg_signature_badge_with(signature, label: 'Verified', title: title, content: content, css_classes: ['valid']) - end - - def commit_gpg_invalid_signature_badge(signature) - title = capture do - concat content_tag('i', '', class: 'fa fa-question-circle gpg-badge-popover-icon invalid', 'aria-hidden' => 'true') - concat 'This commit was signed with an unverified signature.' - end - commit_gpg_signature_badge_with(signature, label: 'Unverified', title: title, css_classes: ['invalid']) - end - - def commit_gpg_signature_badge_with(signature, label:, title: '', content: '', css_classes: []) - css_classes = %w(btn btn-xs gpg-badge) + css_classes - - content = capture do - concat( - content_tag(:div, class: 'clearfix') do - content - end - ) - - concat "GPG key ID: #{signature.gpg_key_primary_keyid}" - concat( - link_to( - 'Learn about signing commits', - help_page_path('workflow/gpg_signed_commits/index.md'), - class: 'gpg-badge-popover-help-link' - ) - ) - end - - title = capture do - content_tag 'span', class: 'gpg-badge-popover-title' do - title - end - end - - data = { - toggle: 'popover', - html: 'true', - placement: 'auto bottom', - title: title, - content: content - } - - content_tag :button, class: css_classes, data: data do - label - end - end end -- cgit v1.2.3