Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
36c05b31
Commit
36c05b31
authored
Jul 05, 2017
by
Alexis Reigel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
convert gpg badge helper methods to partials
parent
084cc718
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
48 additions
and
87 deletions
+48
-87
app/assets/stylesheets/pages/commits.scss
app/assets/stylesheets/pages/commits.scss
+1
-0
app/helpers/commits_helper.rb
app/helpers/commits_helper.rb
+0
-86
app/views/projects/commit/_invalid_signature_badge.html.haml
app/views/projects/commit/_invalid_signature_badge.html.haml
+7
-0
app/views/projects/commit/_signature.html.haml
app/views/projects/commit/_signature.html.haml
+4
-1
app/views/projects/commit/_signature_badge.html.haml
app/views/projects/commit/_signature_badge.html.haml
+17
-0
app/views/projects/commit/_valid_signature_badge.html.haml
app/views/projects/commit/_valid_signature_badge.html.haml
+19
-0
No files found.
app/assets/stylesheets/pages/commits.scss
View file @
36c05b31
...
...
@@ -295,6 +295,7 @@
}
.gpg-badge-popover-title
{
display
:
inline
;
font-weight
:
normal
;
}
...
...
app/helpers/commits_helper.rb
View file @
36c05b31
...
...
@@ -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
app/views/projects/commit/_invalid_signature_badge.html.haml
0 → 100644
View file @
36c05b31
-
title
=
capture
do
%i
{
class:
'fa fa-question-circle gpg-badge-popover-icon invalid'
,
'aria-hidden'
=>
'true'
}
This commit was signed with an unverified signature.
-
locals
=
{
signature:
signature
,
title:
title
,
label:
'Unverified'
,
css_classes:
[
'invalid'
]
}
=
render
partial:
'projects/commit/signature_badge'
,
locals:
locals
app/views/projects/commit/_signature.html.haml
View file @
36c05b31
-
if
signature
=
commit_gpg_signature_badge
(
signature
)
-
if
signature
.
valid_signature?
=
render
partial:
'projects/commit/valid_signature_badge'
,
locals:
{
signature:
signature
}
-
else
=
render
partial:
'projects/commit/invalid_signature_badge'
,
locals:
{
signature:
signature
}
app/views/projects/commit/_signature_badge.html.haml
0 → 100644
View file @
36c05b31
-
css_classes
=
%w(btn btn-xs gpg-badge)
+
css_classes
-
title
=
capture
do
.gpg-badge-popover-title
=
title
-
content
=
capture
do
.clearfix
=
content
GPG key ID:
=
signature
.
gpg_key_primary_keyid
=
link_to
(
'Learn about signing commits'
,
help_page_path
(
'workflow/gpg_signed_commits/index.md'
),
class:
'gpg-badge-popover-help-link'
)
%button
{
class:
css_classes
,
data:
{
toggle:
'popover'
,
html:
'true'
,
placement:
'auto bottom'
,
title:
title
,
content:
content
}
}
=
label
app/views/projects/commit/_valid_signature_badge.html.haml
0 → 100644
View file @
36c05b31
-
title
=
capture
do
%i
{
class:
'fa fa-check-circle gpg-badge-popover-icon valid'
,
'aria-hidden'
=>
'true'
}
This commit was signed with a verified signature.
-
content
=
capture
do
-
gpg_key
=
signature
.
gpg_key
=
link_to
user_path
(
gpg_key
.
user
),
class:
'gpg-badge-popover-user-link'
do
.gpg-badge-popover-avatar
=
user_avatar_without_link
(
user:
signature
.
gpg_key
.
user
,
size:
32
)
.gpg-badge-popover-username
=
gpg_key
.
user
.
username
%div
=
gpg_key
.
user
.
name
-
locals
=
{
signature:
signature
,
title:
title
,
content:
content
,
label:
'Verified'
,
css_classes:
[
'valid'
]
}
=
render
partial:
'projects/commit/signature_badge'
,
locals:
locals
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment