From c815da3afd356c3766663a01b57df1a31c2f5cae Mon Sep 17 00:00:00 2001 From: Artur Beljajev Date: Tue, 10 Dec 2019 16:11:51 +0200 Subject: [PATCH] Extract partials --- app/views/admin/api_users/show.html.erb | 82 +------------------ .../api_users/show/_certificates.html.erb | 55 +++++++++++++ .../admin/api_users/show/_details.html.erb | 26 ++++++ config/locales/admin/api_users.en.yml | 8 +- 4 files changed, 89 insertions(+), 82 deletions(-) create mode 100644 app/views/admin/api_users/show/_certificates.html.erb create mode 100644 app/views/admin/api_users/show/_details.html.erb diff --git a/app/views/admin/api_users/show.html.erb b/app/views/admin/api_users/show.html.erb index bba7a698f..05c5651ce 100644 --- a/app/views/admin/api_users/show.html.erb +++ b/app/views/admin/api_users/show.html.erb @@ -26,90 +26,12 @@
-
-
-

- <%= t '.header' %> -

-
- -
-
-
<%= ApiUser.human_attribute_name :username %>
-
<%= @api_user.username %>
- -
<%= ApiUser.human_attribute_name :plain_text_password %>
-
<%= @api_user.plain_text_password %>
- -
<%= Registrar.model_name.human %>
-
<%= link_to(@api_user.registrar, admin_registrar_path(@api_user.registrar)) %>
- -
<%= ApiUser.human_attribute_name :roles %>
-
<%= @api_user.roles.join(', ') %>
- -
<%= ApiUser.human_attribute_name :active %>
-
<%= @api_user.active %>
-
-
-
+ <%= render 'admin/api_users/show/details' %>
-
-
-
- <%= t(:certificates) %> -
-
- <%= link_to(t(:upload_crt), new_admin_api_user_certificate_path(@api_user, crt: true), class: 'btn btn-primary btn-xs') %> - <%= link_to(t(:upload_csr), new_admin_api_user_certificate_path(@api_user), class: 'btn btn-primary btn-xs') %> -
-
- -
- - - - - - - - - - <% @api_user.certificates.each do |x| %> - <% if x.csr %> - - - - - <% elsif x.crt %> - - - - - <% end %> - <% end %> - -
- <%= t('.subject') %> - - <%= t(:status) %> -
- <%= link_to(x.parsed_csr.try(:subject), - admin_api_user_certificate_path(@api_user, - x)) %> - - <%= x.status %> -
- <%= link_to(x.parsed_crt.try(:subject), - admin_api_user_certificate_path(@api_user, - x)) %> - - <%= x.status %> -
-
-
+ <%= render 'admin/api_users/show/certificates' %>
diff --git a/app/views/admin/api_users/show/_certificates.html.erb b/app/views/admin/api_users/show/_certificates.html.erb new file mode 100644 index 000000000..75a3cc2df --- /dev/null +++ b/app/views/admin/api_users/show/_certificates.html.erb @@ -0,0 +1,55 @@ +
+
+
+ <%= t(:certificates) %> +
+ +
+ <%= link_to(t(:upload_crt), new_admin_api_user_certificate_path(@api_user, crt: true), class: 'btn btn-primary btn-xs') %> + <%= link_to(t(:upload_csr), new_admin_api_user_certificate_path(@api_user), class: 'btn btn-primary btn-xs') %> +
+
+ +
+ + + + + + + + + + <% @api_user.certificates.each do |x| %> + <% if x.csr %> + + + + + <% elsif x.crt %> + + + + + <% end %> + <% end %> + +
+ <%= t('.subject') %> + + <%= t(:status) %> +
+ <%= link_to(x.parsed_csr.try(:subject), + admin_api_user_certificate_path(@api_user, + x)) %> + + <%= x.status %> +
+ <%= link_to(x.parsed_crt.try(:subject), + admin_api_user_certificate_path(@api_user, + x)) %> + + <%= x.status %> +
+
+
diff --git a/app/views/admin/api_users/show/_details.html.erb b/app/views/admin/api_users/show/_details.html.erb new file mode 100644 index 000000000..c98f23866 --- /dev/null +++ b/app/views/admin/api_users/show/_details.html.erb @@ -0,0 +1,26 @@ +
+
+

+ <%= t '.header' %> +

+
+ +
+
+
<%= ApiUser.human_attribute_name :username %>
+
<%= @api_user.username %>
+ +
<%= ApiUser.human_attribute_name :plain_text_password %>
+
<%= @api_user.plain_text_password %>
+ +
<%= Registrar.model_name.human %>
+
<%= link_to(@api_user.registrar, admin_registrar_path(@api_user.registrar)) %>
+ +
<%= ApiUser.human_attribute_name :roles %>
+
<%= @api_user.roles.join(', ') %>
+ +
<%= ApiUser.human_attribute_name :active %>
+
<%= @api_user.active %>
+
+
+
diff --git a/config/locales/admin/api_users.en.yml b/config/locales/admin/api_users.en.yml index bd3772556..9fde2db14 100644 --- a/config/locales/admin/api_users.en.yml +++ b/config/locales/admin/api_users.en.yml @@ -11,12 +11,16 @@ en: created: API user has been successfully created show: - header: Details - subject: Subject edit_btn: Edit delete_btn: Delete delete_btn_confirm: Are you sure you want to delete this API user? + details: + header: Details + + certificates: + subject: Subject + edit: header: Edit API user