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.
This commit is contained in:
parent
1b10724e08
commit
70d2fde492
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in New Issue