Convert HAML to ERB

This commit is contained in:
Artur Beljajev 2019-12-09 21:39:08 +02:00
parent de6934625c
commit 4d60985138
10 changed files with 211 additions and 131 deletions

View file

@ -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')

View file

@ -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 %>
<div class="row">
<div class="col-md-8">
<div class="form-group">
<div class="col-md-4 control-label">
<%= f.label :username, nil, class: 'required' %>
</div>
<div class="col-md-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' %>
</div>
<div class="col-md-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 %>
</div>
<div class="col-md-7">
<%= 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">
<label for="api_user_active">
<%= f.check_box(:active) %>
<%= t('.active') %>
</label>
</div>
</div>
</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,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'

View file

@ -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' %>

View file

@ -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

View file

@ -0,0 +1,42 @@
<%= render 'shared/title', name: t('.title') %>
<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>
</tr>
<% end %>
</tbody>
</table>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<%= paginate @api_users %>
</div>
</div>

View file

@ -1,3 +0,0 @@
= render 'shared/title', name: t('.title')
= render 'form'

View file

@ -0,0 +1,2 @@
<%= render 'shared/title', name: t('.title') %>
<%= render 'form' %>

View file

@ -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

View file

@ -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 %>
<br/>
<% end %>
<% end %>
<% if @api_user.errors.any? %>
<hr/>
<% end %>
<div class="row">
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
<%= 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>
</dl>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-heading clearfix">
<div class="pull-left">
<%= t(:certificates) %>
</div>
<div class="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') %>
</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>
</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>
<% end %>
<% end %>
</tbody>
</table>
</div>
</div>
</div>
</div>