Add confirmation button
This commit is contained in:
parent
d28e77d740
commit
a7d59b4d71
3 changed files with 48 additions and 0 deletions
|
@ -10,6 +10,30 @@
|
|||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<dl class="row">
|
||||
<dt class="col-lg-4">
|
||||
<%= Passport.human_attribute_name :confirmed %>
|
||||
</dt>
|
||||
<dd class="col-lg-8">
|
||||
<% if @passport.confirmed? %>
|
||||
<span class="badge badge-success">
|
||||
<%= Passport.human_attribute_name 'confirmed.true' %>
|
||||
</span>
|
||||
<% else %>
|
||||
<span class="badge badge-warning">
|
||||
<%= Passport.human_attribute_name 'confirmed.false' %>
|
||||
</span>
|
||||
<% end %>
|
||||
</dt>
|
||||
|
||||
<dt class="col-lg-4">
|
||||
<%= Passport.human_attribute_name :passport_confirmations_count %>
|
||||
</dt>
|
||||
<dd class="col-lg-8">
|
||||
<%= @passport.passport_confirmations.count %>
|
||||
/
|
||||
<%= Passport::REQUIRED_CONFIRMATIONS %>
|
||||
</dd>
|
||||
|
||||
<dt class="col-lg-4">
|
||||
<%= Passport.human_attribute_name :surname %>
|
||||
</dt>
|
||||
|
@ -87,6 +111,20 @@
|
|||
<%= localize @passport.date_of_issue %>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<% if user_signed_in? %>
|
||||
<% if @passport.passport_confirmations.where(user: current_user).exists? %>
|
||||
<button class="btn btn-primary" disabled>
|
||||
Confirm
|
||||
</button>
|
||||
<% else %>
|
||||
<%= link_to 'Confirm',
|
||||
passport_passport_confirmations_path(@passport),
|
||||
method: :post,
|
||||
role: :button,
|
||||
class: 'btn btn-primary' %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
|
|
|
@ -25,6 +25,8 @@ en:
|
|||
comment: Comment
|
||||
passport:
|
||||
id: ID
|
||||
confirmed: Confirmed?
|
||||
passport_confirmations_count: Confirmations count
|
||||
image: Image
|
||||
surname: Surname
|
||||
given_name: Given names
|
||||
|
@ -37,6 +39,9 @@ en:
|
|||
issued_by: Issued by
|
||||
unit_code: Unit code
|
||||
date_of_issue: Date of issue
|
||||
passport/confirmed:
|
||||
'true': Confirmed
|
||||
'false': Unconfirmed
|
||||
passport/sex:
|
||||
male: Male
|
||||
female: Female
|
||||
|
|
|
@ -25,6 +25,8 @@ ru:
|
|||
comment: Комментарий
|
||||
passport:
|
||||
id: ID
|
||||
confirmed: Подтверждён?
|
||||
passport_confirmations_count: Количество подтверждений
|
||||
image: Изображение
|
||||
surname: Фамилия
|
||||
given_name: Имя
|
||||
|
@ -37,6 +39,9 @@ ru:
|
|||
issued_by: Кем выдан
|
||||
unit_code: Код подразделения
|
||||
date_of_issue: Дата выдачи
|
||||
passport/confirmed:
|
||||
'true': Подтверждён
|
||||
'false': Не подтверждён
|
||||
passport/sex:
|
||||
male: Мужской
|
||||
female: Женский
|
||||
|
|
Reference in a new issue