This commit is contained in:
Artur Beljajev 2019-12-09 22:01:56 +02:00
parent e010fdbc00
commit c91c12ab30
3 changed files with 81 additions and 82 deletions

View file

@ -1,5 +1,6 @@
<%= form_for([:admin, @api_user.registrar, @api_user], html: { class: 'form-horizontal', autocomplete: 'off' }) do |f| %>
<%= render 'shared/full_errors', object: @api_user %>
<div class="row">
<div class="col-md-8">
<div class="form-group">
@ -10,6 +11,7 @@
<%= f.text_field :username, required: true, autofocus: true, class: 'form-control' %>
</div>
</div>
<div class="form-group">
<div class="col-md-4 control-label">
<%= f.label :plain_text_password, nil, class: 'required' %>
@ -18,6 +20,7 @@
<%= f.text_field :plain_text_password, required: true, class: 'form-control' %>
</div>
</div>
<div class="form-group">
<div class="col-md-4 control-label">
<%= f.label :identity_code %>
@ -26,10 +29,12 @@
<%= f.text_field(:identity_code, class: 'form-control') %>
</div>
</div>
<div class="form-group">
<div class="col-md-4 control-label">
<%= f.label :role, nil, class: 'required' %>
</div>
<div class="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' %>
<div class="checkbox">
@ -42,10 +47,13 @@
</div>
</div>
</div>
<hr/>
<div class="row">
<div class="col-md-8 text-right">
<%= button_tag(t(:save), class: 'btn btn-primary') %>
</div>
</div>
<% end %>

View file

@ -1,42 +1,41 @@
<div class="page-header">
<h1><%= t '.header' %></h1>
</div>
<div class="row">
<div class="col-md-12">
<div class="table-responsive">
<table class="table table-hover table-bordered table-condensed">
<thead>
<tr>
<th class="col-xs-2">
<%= sort_link(@q, 'username') %>
</th>
<th class="col-xs-2">
<%= sort_link(@q, 'registrar_name', t(:registrar_name)) %>
</th>
<th class="col-xs-2">
<%= sort_link(@q, 'active', t('.active')) %>
</th>
</tr>
</thead>
<tbody>
<% @api_users.each do |api_user| %>
<tr>
<td>
<%= link_to api_user, admin_registrar_api_user_path(api_user.registrar, api_user) %>
</td>
<td>
<%= link_to api_user.registrar, [:admin, api_user.registrar] %>
</td>
<td>
<%= api_user.active %>
</td>
<th class="col-xs-2">
<%= sort_link(@q, 'username') %>
</th>
<th class="col-xs-2">
<%= sort_link(@q, 'registrar_name', t(:registrar_name)) %>
</th>
<th class="col-xs-2">
<%= sort_link(@q, 'active', t('.active')) %>
</th>
</tr>
<% end %>
</thead>
<tbody>
<% @api_users.each do |api_user| %>
<tr>
<td><%= link_to api_user,
admin_registrar_api_user_path(api_user.registrar,
api_user) %></td>
<td><%= link_to api_user.registrar, [:admin, api_user.registrar] %></td>
<td><%= api_user.active %></td>
</tr>
<% end %>
</tbody>
</table>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<%= paginate @api_users %>

View file

@ -32,43 +32,29 @@
<%= t(:general) %>
</h3>
</div>
<div class="panel-body">
<dl class="dl-horizontal">
<dt>
<%= t(:username) %>
</dt>
<dd>
<%= @api_user.username %>
</dd>
<dt>
<%= t(:password) %>
</dt>
<dd>
<%= @api_user.plain_text_password %>
</dd>
<dt>
<%= t(:registrar_name) %>
</dt>
<dd>
<%= link_to(@api_user.registrar, admin_registrar_path(@api_user.registrar)) %>
</dd>
<dt>
<%= t(:role) %>
</dt>
<dd>
<%= @api_user.roles.join(', ') %>
</dd>
<dt>
<%= t('.active') %>
</dt>
<dd>
<%= @api_user.active %>
</dd>
<dt><%= t(:username) %></dt>
<dd><%= @api_user.username %></dd>
<dt><%= t(:password) %></dt>
<dd><%= @api_user.plain_text_password %></dd>
<dt><%= t(:registrar_name) %></dt>
<dd><%= link_to(@api_user.registrar, admin_registrar_path(@api_user.registrar)) %></dd>
<dt><%= t(:role) %></dt>
<dd><%= @api_user.roles.join(', ') %></dd>
<dt><%= t('.active') %></dt>
<dd><%= @api_user.active %></dd>
</dl>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="panel panel-default">
@ -81,40 +67,46 @@
<%= link_to(t(:upload_csr), new_admin_api_user_certificate_path(@api_user), class: 'btn btn-primary btn-xs') %>
</div>
</div>
<div class="table-responsive">
<table class="table table-hover table-bordered table-condensed">
<thead>
<tr>
<th class="col-xs-10">
<%= t('.subject') %>
</th>
<th class="col-xs-2">
<%= t(:status) %>
</th>
</tr>
<tr>
<th class="col-xs-10">
<%= t('.subject') %>
</th>
<th class="col-xs-2">
<%= t(:status) %>
</th>
</tr>
</thead>
<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>
<td>
<%= x.status %>
</td>
</tr>
<% elsif x.crt %>
<tr>
<td>
<%= link_to(x.parsed_crt.try(:subject), admin_api_user_certificate_path(@api_user, x)) %>
</td>
<td>
<%= x.status %>
</td>
</tr>
<% @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>
<td>
<%= x.status %>
</td>
</tr>
<% elsif x.crt %>
<tr>
<td>
<%= link_to(x.parsed_crt.try(:subject),
admin_api_user_certificate_path(@api_user,
x)) %>
</td>
<td>
<%= x.status %>
</td>
</tr>
<% end %>
<% end %>
<% end %>
</tbody>
</table>
</div>