diff --git a/app/views/admin/api_users/_form.haml b/app/views/admin/api_users/_form.haml deleted file mode 100644 index 23b245aea..000000000 --- a/app/views/admin/api_users/_form.haml +++ /dev/null @@ -1,39 +0,0 @@ -= form_for([:admin, @api_user.registrar, @api_user], html: {class: 'form-horizontal', autocomplete: 'off'}) do |f| - = render 'shared/full_errors', object: @api_user - - .row - .col-md-8 - .form-group - .col-md-4.control-label - = f.label :username, nil, class: 'required' - .col-md-7 - = f.text_field :username, required: true, autofocus: true, class: 'form-control' - .form-group - .col-md-4.control-label - = f.label :plain_text_password, nil, class: 'required' - .col-md-7 - = f.text_field :plain_text_password, required: true, class: 'form-control' - - .form-group - .col-md-4.control-label - = f.label :identity_code - .col-md-7 - = f.text_field(:identity_code, class: 'form-control') - - .form-group - .col-md-4.control-label - = f.label :role, nil, class: 'required' - .col-md-7 - = select_tag 'api_user[roles][]', - options_for_select(ApiUser::ROLES.map {|x| [x, x] }, @api_user.roles.try(:first)), - class: 'form-control selectize' - .checkbox - %label{for: 'api_user_active'} - = f.check_box(:active) - = t('.active') - - %hr - - .row - .col-md-8.text-right - = button_tag(t(:save), class: 'btn btn-primary') diff --git a/app/views/admin/api_users/_form.html.erb b/app/views/admin/api_users/_form.html.erb new file mode 100644 index 000000000..b97d45539 --- /dev/null +++ b/app/views/admin/api_users/_form.html.erb @@ -0,0 +1,51 @@ +<%= form_for([:admin, @api_user.registrar, @api_user], html: { class: 'form-horizontal', autocomplete: 'off' }) do |f| %> + <%= render 'shared/full_errors', object: @api_user %> +
+
+
+
+ <%= f.label :username, nil, class: 'required' %> +
+
+ <%= f.text_field :username, required: true, autofocus: true, class: 'form-control' %> +
+
+
+
+ <%= f.label :plain_text_password, nil, class: 'required' %> +
+
+ <%= f.text_field :plain_text_password, required: true, class: 'form-control' %> +
+
+
+
+ <%= f.label :identity_code %> +
+
+ <%= f.text_field(:identity_code, class: 'form-control') %> +
+
+
+
+ <%= f.label :role, nil, class: 'required' %> +
+
+ <%= select_tag 'api_user[roles][]', options_for_select(ApiUser::ROLES.map { |x| [x, x] }, @api_user.roles.try(:first)), class: 'form-control selectize' %> +
+ +
+
+
+
+
+
+
+
+ <%= button_tag(t(:save), class: 'btn btn-primary') %> +
+
+<% end %> diff --git a/app/views/admin/api_users/edit.haml b/app/views/admin/api_users/edit.haml deleted file mode 100644 index cd32618fa..000000000 --- a/app/views/admin/api_users/edit.haml +++ /dev/null @@ -1,5 +0,0 @@ -- content_for :actions do - = link_to(t(:back_to_api_user), admin_registrar_api_user_path(@api_user.registrar, @api_user), class: 'btn btn-default') -= render 'shared/title', name: "#{t(:edit)}: #{@api_user.username}" - -= render 'form' diff --git a/app/views/admin/api_users/edit.html.erb b/app/views/admin/api_users/edit.html.erb new file mode 100644 index 000000000..5fee5b941 --- /dev/null +++ b/app/views/admin/api_users/edit.html.erb @@ -0,0 +1,5 @@ +<% content_for :actions do %> + <%= link_to(t(:back_to_api_user), admin_registrar_api_user_path(@api_user.registrar, @api_user), class: 'btn btn-default') %> +<% end %> +<%= render 'shared/title', name: "#{t(:edit)}: #{@api_user.username}" %> +<%= render 'form' %> diff --git a/app/views/admin/api_users/index.haml b/app/views/admin/api_users/index.haml deleted file mode 100644 index 3d5e6a320..000000000 --- a/app/views/admin/api_users/index.haml +++ /dev/null @@ -1,23 +0,0 @@ -= render 'shared/title', name: t('.title') - -.row - .col-md-12 - .table-responsive - %table.table.table-hover.table-bordered.table-condensed - %thead - %tr - %th{class: 'col-xs-2'} - = sort_link(@q, 'username') - %th{class: 'col-xs-2'} - = sort_link(@q, 'registrar_name', t(:registrar_name)) - %th{class: 'col-xs-2'} - = sort_link(@q, 'active', t('.active')) - %tbody - - @api_users.each do |api_user| - %tr - %td= link_to api_user, admin_registrar_api_user_path(api_user.registrar, api_user) - %td= link_to api_user.registrar, [:admin, api_user.registrar] - %td= api_user.active -.row - .col-md-12 - = paginate @api_users diff --git a/app/views/admin/api_users/index.html.erb b/app/views/admin/api_users/index.html.erb new file mode 100644 index 000000000..dacd6398a --- /dev/null +++ b/app/views/admin/api_users/index.html.erb @@ -0,0 +1,42 @@ +<%= render 'shared/title', name: t('.title') %> +
+
+
+ + + + + + + + + + <% @api_users.each do |api_user| %> + + + + + + <% end %> + +
+ <%= sort_link(@q, 'username') %> + + <%= sort_link(@q, 'registrar_name', t(:registrar_name)) %> + + <%= sort_link(@q, 'active', t('.active')) %> +
+ <%= link_to api_user, admin_registrar_api_user_path(api_user.registrar, api_user) %> + + <%= link_to api_user.registrar, [:admin, api_user.registrar] %> + + <%= api_user.active %> +
+
+
+
+
+
+ <%= paginate @api_users %> +
+
diff --git a/app/views/admin/api_users/new.haml b/app/views/admin/api_users/new.haml deleted file mode 100644 index f8282f44f..000000000 --- a/app/views/admin/api_users/new.haml +++ /dev/null @@ -1,3 +0,0 @@ -= render 'shared/title', name: t('.title') - -= render 'form' diff --git a/app/views/admin/api_users/new.html.erb b/app/views/admin/api_users/new.html.erb new file mode 100644 index 000000000..f9a096937 --- /dev/null +++ b/app/views/admin/api_users/new.html.erb @@ -0,0 +1,2 @@ +<%= render 'shared/title', name: t('.title') %> +<%= render 'form' %> diff --git a/app/views/admin/api_users/show.haml b/app/views/admin/api_users/show.haml deleted file mode 100644 index 998a6c078..000000000 --- a/app/views/admin/api_users/show.haml +++ /dev/null @@ -1,61 +0,0 @@ -- content_for :actions do - = link_to(t(:edit), edit_admin_registrar_api_user_path(@api_user.registrar, @api_user), class: 'btn btn-default') - = link_to(t(:delete), admin_registrar_api_user_path(@api_user.registrar, @api_user), - method: :delete, data: { confirm: t(:are_you_sure) }, class: 'btn btn-danger') -= render 'shared/title', name: @api_user.username - -- if @api_user.errors.any? - - @api_user.errors.each do |attr, err| - = err - %br -- if @api_user.errors.any? - %hr -.row - .col-md-12 - .panel.panel-default - .panel-heading - %h3.panel-title= t(:general) - .panel-body - %dl.dl-horizontal - %dt= t(:username) - %dd= @api_user.username - - %dt= t(:password) - %dd= @api_user.plain_text_password - - %dt= t(:registrar_name) - %dd= link_to(@api_user.registrar, admin_registrar_path(@api_user.registrar)) - - %dt= t(:role) - %dd= @api_user.roles.join(', ') - - %dt= t('.active') - %dd= @api_user.active -.row - .col-md-12 - .panel.panel-default - .panel-heading.clearfix - .pull-left - = t(:certificates) - .pull-right - = 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') - - .table-responsive - %table.table.table-hover.table-bordered.table-condensed - %thead - %tr - %th{class: 'col-xs-10'}= t('.subject') - %th{class: 'col-xs-2'}= t(:status) - %tbody - - @api_user.certificates.each do |x| - - if x.csr - %tr - %td= link_to(x.parsed_csr.try(:subject), admin_api_user_certificate_path(@api_user, x)) - %td= x.status - - elsif x.crt - %tr - %td= link_to(x.parsed_crt.try(:subject), admin_api_user_certificate_path(@api_user, x)) - %td= x.status diff --git a/app/views/admin/api_users/show.html.erb b/app/views/admin/api_users/show.html.erb new file mode 100644 index 000000000..ace211f52 --- /dev/null +++ b/app/views/admin/api_users/show.html.erb @@ -0,0 +1,111 @@ +<% content_for :actions do %> + <%= link_to(t(:edit), edit_admin_registrar_api_user_path(@api_user.registrar, @api_user), class: 'btn btn-default') %> + <%= link_to(t(:delete), admin_registrar_api_user_path(@api_user.registrar, @api_user), method: :delete, data: { confirm: t(:are_you_sure) }, class: 'btn btn-danger') %> +<% end %> +<%= render 'shared/title', name: @api_user.username %> +<% if @api_user.errors.any? %> + <% @api_user.errors.each do |attr, err| %> + <%= err %> +
+ <% end %> +<% end %> +<% if @api_user.errors.any? %> +
+<% end %> +
+
+
+
+

+ <%= t(:general) %> +

+
+
+
+
+ <%= t(:username) %> +
+
+ <%= @api_user.username %> +
+
+ <%= t(:password) %> +
+
+ <%= @api_user.plain_text_password %> +
+
+ <%= t(:registrar_name) %> +
+
+ <%= link_to(@api_user.registrar, admin_registrar_path(@api_user.registrar)) %> +
+
+ <%= t(:role) %> +
+
+ <%= @api_user.roles.join(', ') %> +
+
+ <%= t('.active') %> +
+
+ <%= @api_user.active %> +
+
+
+
+
+
+
+
+
+
+
+ <%= 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 %> +
+
+
+
+