diff options
author | Bob Van Landuyt <bob@gitlab.com> | 2019-06-04 08:02:53 +0000 |
---|---|---|
committer | Bob Van Landuyt <bob@gitlab.com> | 2019-06-04 08:02:53 +0000 |
commit | d16c11ab36d91fc51a01406fa77ee2bf307ad8f5 (patch) | |
tree | ac62fe88a043b54cbad4361321961878f5b30b87 | |
parent | 746531373d25bd99d2d3272d7da6fe2079a3fde7 (diff) | |
parent | 6e83a31f3388d2d1abadcc4775a168db35892e2c (diff) | |
download | gitlab-ce-d16c11ab36d91fc51a01406fa77ee2bf307ad8f5.tar.gz |
Merge branch 'ce-fe-fix-ee-diff-profile-key-views' into 'master'
Resolve EE/CE differences in app/views/profiles/keys
See merge request gitlab-org/gitlab-ce!28900
-rw-r--r-- | app/models/key.rb | 5 | ||||
-rw-r--r-- | app/views/profiles/keys/_key.html.haml | 7 | ||||
-rw-r--r-- | app/views/profiles/keys/_key_details.html.haml | 3 |
3 files changed, 11 insertions, 4 deletions
diff --git a/app/models/key.rb b/app/models/key.rb index b097be8cc89..8aa25924c28 100644 --- a/app/models/key.rb +++ b/app/models/key.rb @@ -59,6 +59,11 @@ class Key < ApplicationRecord "key-#{id}" end + # EE overrides this + def can_delete? + true + end + # rubocop: disable CodeReuse/ServiceClass def update_last_used_at Keys::LastUsedService.new(self).execute diff --git a/app/views/profiles/keys/_key.html.haml b/app/views/profiles/keys/_key.html.haml index 47494fc3f06..b9d73d89334 100644 --- a/app/views/profiles/keys/_key.html.haml +++ b/app/views/profiles/keys/_key.html.haml @@ -18,6 +18,7 @@ .float-right %span.key-created-at = s_('Profiles|Created %{time_ago}'.html_safe) % { time_ago:time_ago_with_tooltip(key.created_at)} - = link_to path_to_key(key, is_admin), data: { confirm: _('Are you sure?')}, method: :delete, class: "btn btn-transparent prepend-left-10" do - %span.sr-only= _('Remove') - = icon('trash') + - if key.can_delete? + = link_to path_to_key(key, is_admin), data: { confirm: _('Are you sure?')}, method: :delete, class: "btn btn-transparent prepend-left-10" do + %span.sr-only= _('Remove') + = icon('trash') diff --git a/app/views/profiles/keys/_key_details.html.haml b/app/views/profiles/keys/_key_details.html.haml index dcdb7fc63b1..0ef01dec493 100644 --- a/app/views/profiles/keys/_key_details.html.haml +++ b/app/views/profiles/keys/_key_details.html.haml @@ -24,4 +24,5 @@ = @key.key .col-md-12 .float-right - = link_to _('Remove'), path_to_key(@key, is_admin), data: {confirm: _('Are you sure?')}, method: :delete, class: "btn btn-remove delete-key qa-delete-key-button" + - if @key.can_delete? + = link_to _('Remove'), path_to_key(@key, is_admin), data: {confirm: _('Are you sure?')}, method: :delete, class: "btn btn-remove delete-key qa-delete-key-button" |