Merge branch 'master' of github.com:domify/registry

This commit is contained in:
Martin Lensment 2015-08-19 13:20:10 +03:00
commit e8a4706e73
16 changed files with 147 additions and 98 deletions

View file

@ -1,3 +1,10 @@
- if @admin_user.new_record?
- overwrite_required = ''
- field_required = 'required'
- else
- overwrite_required = 'not-required' # otherwise automatic one adds required
- field_required = ''
= form_for([:admin, @admin_user], html: { class: 'form-horizontal', autocomplete: 'off' }) do |f|
= render 'shared/full_errors', object: @admin_user
@ -11,22 +18,22 @@
- if @admin_user.new_record? || can?(:update, AdminUser)
.form-group
.col-md-4.control-label
- not_required = @admin_user.new_record? ? '' : 'not-required'
= f.label :password, class: not_required
= f.label :password, class: overwrite_required
.col-md-8
= f.text_field(:password, class: 'form-control')
= f.text_field(:password, class: "form-control #{field_required}")
.form-group
.col-md-4.control-label
= f.label :password_confirmation, class: not_required
= f.label :password_confirmation, class: overwrite_required
.col-md-8
= f.text_field(:password_confirmation, class: 'form-control')
= f.text_field(:password_confirmation, class: "form-control #{field_required}")
%hr
.form-group
.col-md-4.control-label
= f.label :identity_code
.col-md-8
= f.text_field(:identity_code, class: 'form-control')
= f.text_field(:identity_code, class: 'form-control required')
.form-group
.col-md-4.control-label
= f.label :email
@ -37,13 +44,15 @@
= f.label :country_code, t(:country)
.col-md-8
= f.select(:country_code,
SortedCountry.all_options(f.object.country_code), {}, class: 'form-control')
SortedCountry.all_options(f.object.country_code), {}, class: 'form-control required')
%hr
.form-group
.col-md-4.control-label
= f.label :role
= f.label :role, class: 'required'
.col-md-8
= select_tag 'admin_user[roles][]', options_for_select(AdminUser::ROLES.map {|x| [t(x), x] }, @admin_user.roles.try(:first)), class: 'form-control selectize'
= select_tag 'admin_user[roles][]',
options_for_select(AdminUser::ROLES.map {|x| [t(x), x] },
@admin_user.roles.try(:first)), class: 'form-control selectize'
%hr
.row

View file

@ -1,3 +1,11 @@
- if @api_user.new_record?
- overwrite_required = ''
- field_required = 'required'
- else
- overwrite_required = 'not-required' # otherwise automatic one adds required
- field_required = ''
= form_for([:admin, @api_user], multipart: true,
html: {class: 'form-horizontal', autocomplete: 'off'}) do |f|
= render 'shared/full_errors', object: @api_user
@ -11,16 +19,16 @@
= f.text_field(:username, class: 'form-control')
.form-group
.col-md-4.control-label
- not_required = @api_user.new_record? ? '' : 'not-required'
= f.label :password, class: not_required
= f.label :password, class: overwrite_required
.col-md-7
= f.text_field :password, class: 'form-control', autocomplete: 'off'
= f.text_field :password, class: "form-control #{field_required}", autocomplete: 'off'
.form-group
.col-md-4.control-label
= f.label :identity_code
.col-md-7
= f.text_field(:identity_code, class: 'form-control')
.form-group
.form-group.has-feedback.js-typeahead-container
.col-md-4.control-label
@ -32,9 +40,10 @@
%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
.col-md-4.control-label
= f.label :role
= f.label :role, class: 'required'
.col-md-7
= select_tag 'api_user[roles][]',
options_for_select(ApiUser::ROLES.map {|x| [t(x), x] }, @api_user.roles.try(:first)),

View file

@ -54,7 +54,7 @@
= "#{current_user} (#{current_user.roles.first}) - #{current_user.registrar}"
%span.caret
%ul.dropdown-menu{role: "menu"}
- ApiUser.where(identity_code: current_user.identity_code).includes(:registrar).each do |x|
- ApiUser.all_by_identity_code(current_user.identity_code).each do |x|
%li= link_to "#{x} (#{x.roles.first}) - #{x.registrar}", "/registrar/switch_user/#{x.id}"
- if user_signed_in?
%li= link_to t(:log_out_), '/registrar/logout'

View file

@ -4,7 +4,7 @@
= render 'shared/title', name: t(:your_account)
= t(:your_current_account_balance_is,
balance: current_user.registrar.cash_account.balance,
balance: currency(current_user.registrar.cash_account.balance),
currency: current_user.registrar.cash_account.currency)
%h1= t(:invoices)
@ -68,7 +68,7 @@
%td{class: 'text-danger'}= t(:unpaid)
%td= l(x.due_date, format: :date_long)
%td= x.sum
%td= currency(x.sum)
.row
.col-md-12
= paginate @invoices