Refactor EPP users to API users

This commit is contained in:
Martin Lensment 2015-01-29 14:13:49 +02:00
parent b8494993ea
commit c91c9c8ebf
44 changed files with 154 additions and 150 deletions

View file

@ -0,0 +1,40 @@
= form_for([:admin, @api_user]) do |f|
- if @api_user.errors.any?
- @api_user.errors.each do |attr, err|
= err
%br
- if @api_user.errors.any?
%hr
.row
.col-md-6
.form-group
= f.label :username
= f.text_field(:username, class: 'form-control')
.form-group
= f.label :password
= f.text_field(:password, class: 'form-control')
.form-group
.form-group.has-feedback.js-typeahead-container
= f.label :registrar_typeahead, t('registrar')
= f.text_field(:registrar_typeahead, class: 'form-control js-registrar-typeahead', placeholder: t('registrar'), autocomplete: 'off')
%span.glyphicon.glyphicon-ok.form-control-feedback.js-typeahead-ok.hidden
%span.glyphicon.glyphicon-remove.form-control-feedback.js-typeahead-remove
= f.hidden_field(:registrar_id, class: 'js-registrar-id')
.form-group
.checkbox
%label{for: 'api_user_active'}
= f.check_box(:active)
= t('active')
.col-md-6.text-left
.form-group
= f.label :csr, t('certificate_signing_req')
= f.text_area :csr, class: 'form-control'
%hr
.row
.col-md-12.text-right
= button_tag(t('save'), class: 'btn btn-primary')
:javascript
Autocomplete.bindAdminRegistrarSearch();

View file

@ -0,0 +1,9 @@
.row
.col-sm-6
%h2.text-center-xs
= "#{t('edit_api_user')}"
.col-sm-6
%h2.text-right.text-center-xs
= link_to(t('back_to_api_user'), [:admin, @api_user], class: 'btn btn-default')
%hr
= render 'form'

View file

@ -0,0 +1,28 @@
.row
.col-sm-6
%h2.text-center-xs= t('api_users')
.col-sm-6
%h2.text-right.text-center-xs
= link_to(t('create_new_api_user'), new_admin_api_user_path, class: 'btn btn-primary')
%hr
.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', t('registrar'))
%th{class: 'col-xs-2'}
= sort_link(@q, 'active', t('active'))
%tbody
- @api_users.each do |x|
%tr
%td= link_to(x, [:admin, x])
%td= link_to(x.registrar, [:admin, x.registrar])
%td= x.active
.row
.col-md-12
= paginate @api_users

View file

@ -0,0 +1,3 @@
%h2= t('create_new_api_user')
%hr
= render 'form'

View file

@ -0,0 +1,43 @@
.row
.col-sm-6
%h2.text-center-xs
= "#{t('api_user_details')}"
.col-sm-6
%h2.text-right.text-center-xs
= link_to(t('edit'), edit_admin_api_user_path(@api_user), class: 'btn btn-primary')
= link_to(t('delete'), admin_api_user_path(@api_user), method: :delete, data: { confirm: t('are_you_sure') }, class: 'btn btn-danger')
%hr
- if @api_user.errors.any?
- @api_user.errors.each do |attr, err|
= err
%br
- if @api_user.errors.any?
%hr
.row
.col-md-6
.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.password
%dt= t('active')
%dd= @api_user.active
.col-md-6
.panel.panel-default
.panel-heading
%h3.panel-title= t('certificates')
.panel-body
%dl.dl-horizontal
%dt= t('csr')
%dd= @api_user.csr
%dt= t('crt')
%dd= @api_user.crt