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
2 changed files with 10 additions and 12 deletions
|
@ -1,5 +1,11 @@
|
||||||
- is_admin = defined?(admin) ? true : false
|
- is_admin = local_assigns.fetch(:admin, false)
|
||||||
|
|
||||||
- if @keys.any?
|
- if @keys.any?
|
||||||
%ul.well-list
|
%ul.well-list
|
||||||
- @keys.each do |key|
|
= render partial: 'profiles/keys/key', collection: @keys, locals: { is_admin: is_admin }
|
||||||
= render 'profiles/keys/key', key: key, 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"
|
- page_title "SSH Keys"
|
||||||
- header_title page_title, profile_keys_path
|
- header_title page_title, profile_keys_path
|
||||||
- is_admin = defined?(admin) ? true : false
|
|
||||||
|
|
||||||
.row.prepend-top-default
|
.row.prepend-top-default
|
||||||
.col-lg-3.profile-settings-sidebar
|
.col-lg-3.profile-settings-sidebar
|
||||||
|
@ -19,11 +18,4 @@
|
||||||
%h5
|
%h5
|
||||||
Your SSH keys (#{@keys.count})
|
Your SSH keys (#{@keys.count})
|
||||||
%div.append-bottom-default
|
%div.append-bottom-default
|
||||||
- if @keys.any?
|
|
||||||
= render 'key_table'
|
= 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 a new issue