diff options
author | Robert Speicher <rspeicher@gmail.com> | 2016-03-03 15:49:00 -0500 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2016-03-03 16:14:00 -0500 |
commit | 70d2fde4922eadb50fb720c9afa7a1ce38b1f20f (patch) | |
tree | 39c9605bca6f1a65ad6536208949668e5b43f560 | |
parent | 1b10724e08ebce422366745013fb785fc993f1c7 (diff) | |
download | gitlab-ce-70d2fde4922eadb50fb720c9afa7a1ce38b1f20f.tar.gz |
Restructure SSH key table partial rendering
Prior, we were double-checking `@keys.any?`, and unnecessarily assigning
`is_admin` in a view where it wasn't needed.
-rw-r--r-- | app/views/profiles/keys/_key_table.html.haml | 12 | ||||
-rw-r--r-- | app/views/profiles/keys/index.html.haml | 10 |
2 files changed, 10 insertions, 12 deletions
diff --git a/app/views/profiles/keys/_key_table.html.haml b/app/views/profiles/keys/_key_table.html.haml index 233d79d9467..296cafa6e31 100644 --- a/app/views/profiles/keys/_key_table.html.haml +++ b/app/views/profiles/keys/_key_table.html.haml @@ -1,5 +1,11 @@ -- is_admin = defined?(admin) ? true : false +- is_admin = local_assigns.fetch(:admin, false) + - if @keys.any? %ul.well-list - - @keys.each do |key| - = render 'profiles/keys/key', key: key, is_admin: is_admin + = render partial: 'profiles/keys/key', collection: @keys, locals: { is_admin: is_admin } +- else + %p.profile-settings-message.text-center + - if is_admin + There are no SSH keys associated with this account. + - else + There are no SSH keys with access to your account. diff --git a/app/views/profiles/keys/index.html.haml b/app/views/profiles/keys/index.html.haml index 127c4a5b102..e0f8c9a5733 100644 --- a/app/views/profiles/keys/index.html.haml +++ b/app/views/profiles/keys/index.html.haml @@ -1,6 +1,5 @@ - page_title "SSH Keys" - header_title page_title, profile_keys_path -- is_admin = defined?(admin) ? true : false .row.prepend-top-default .col-lg-3.profile-settings-sidebar @@ -19,11 +18,4 @@ %h5 Your SSH keys (#{@keys.count}) %div.append-bottom-default - - if @keys.any? - = render 'key_table' - - else - %p.profile-settings-message.text-center - - if is_admin - User has no ssh keys - - else - There are no SSH keys with access to your account. + = render 'key_table' |