diff options
author | Douwe Maan <douwe@gitlab.com> | 2015-04-03 13:22:44 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2015-04-03 13:28:47 +0300 |
commit | ed097df62758880eb6412770f661266d4a6e9299 (patch) | |
tree | 488f682bac4c5c9762823a1055f85f9e5c88eca0 /app/views/projects/deploy_keys | |
parent | a243e44ca1ee57dc28ef72bd3521c17726ba5026 (diff) |
Clean up code.
Diffstat (limited to 'app/views/projects/deploy_keys')
-rw-r--r-- | app/views/projects/deploy_keys/_deploy_key.html.haml | 16 | ||||
-rw-r--r-- | app/views/projects/deploy_keys/index.html.haml | 3 |
2 files changed, 7 insertions, 12 deletions
diff --git a/app/views/projects/deploy_keys/_deploy_key.html.haml b/app/views/projects/deploy_keys/_deploy_key.html.haml index 8837a65918c..c577dfa8d55 100644 --- a/app/views/projects/deploy_keys/_deploy_key.html.haml +++ b/app/views/projects/deploy_keys/_deploy_key.html.haml @@ -5,21 +5,15 @@ %i.fa.fa-plus Enable - else - - if deploy_key.projects.count > 1 || deploy_key.public? + - if deploy_key.destroyed_when_orphaned? && deploy_key.almost_orphaned? + = link_to 'Remove', disable_namespace_project_deploy_key_path(@project.namespace, @project, deploy_key), data: { confirm: 'You are going to remove deploy key. Are you sure?'}, method: :put, class: "btn btn-remove delete-key btn-sm pull-right" + - else = link_to disable_namespace_project_deploy_key_path(@project.namespace, @project, deploy_key), class: 'btn btn-sm', method: :put do %i.fa.fa-power-off Disable - - else - = link_to 'Remove', disable_namespace_project_deploy_key_path(@project.namespace, @project, deploy_key), data: { confirm: 'You are going to remove deploy key. Are you sure?'}, method: :put, class: "btn btn-remove delete-key btn-sm pull-right" - - - if deploy_key.projects.include?(@project) - - key_project = @project - - else - - key_project = deploy_key.projects.find { |project| can?(current_user, :read_project, project) } - - - if key_project - = link_to namespace_project_deploy_key_path(key_project.namespace, key_project, deploy_key) do + - if project = project_for_deploy_key(deploy_key) + = link_to namespace_project_deploy_key_path(project.namespace, project, deploy_key) do %i.fa.fa-key %strong= deploy_key.title - else diff --git a/app/views/projects/deploy_keys/index.html.haml b/app/views/projects/deploy_keys/index.html.haml index 186cdfeea33..472a13a8524 100644 --- a/app/views/projects/deploy_keys/index.html.haml +++ b/app/views/projects/deploy_keys/index.html.haml @@ -22,7 +22,8 @@ .light-well .nothing-here-block Create a #{link_to 'new deploy key', new_namespace_project_deploy_key_path(@project.namespace, @project)} or add an existing one .col-md-6.available-keys - - unless @available_project_keys.blank? && @available_public_keys.any? + - # If there are available public deploy keys but no available project deploy keys, only public deploy keys are shown. + - if @available_project_keys.any? || @available_public_keys.blank? %h5 %strong Deploy keys from projects you have access to |