Refactors account_info partial
This commit is contained in:
@@ -6,6 +6,8 @@ class Verification::Management::Document
|
||||
|
||||
validates :document_type, :document_number, presence: true
|
||||
|
||||
delegate :username, :email, to: :user, allow_nil: true
|
||||
|
||||
def user
|
||||
@user = User.by_document(document_type, document_number).first
|
||||
end
|
||||
|
||||
@@ -9,6 +9,8 @@ class Verification::Management::Email
|
||||
validates :email, format: { with: Devise.email_regexp }, allow_blank: true
|
||||
validate :validate_user
|
||||
|
||||
delegate :username, to: :user, allow_nil: true
|
||||
|
||||
def user
|
||||
@user ||= User.where(email: email).first
|
||||
end
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
<p class="account-info">
|
||||
<%= t("management.document_type_label") %> <strong><%= humanize_document_type(verification.document_type) %></strong>
|
||||
<%= t("management.document_number") %> <strong><%= verification.document_number %></strong>
|
||||
<% if verification.user? %>
|
||||
<%= t("management.username_label") %> <strong><%= verification.user.username %></strong>
|
||||
<%= t("management.email_label") %> <strong><%= verification.user.email %></strong>
|
||||
<%= t("management.document_type_label") %> <strong><%= humanize_document_type(account.document_type) %></strong>
|
||||
<%= t("management.document_number") %> <strong><%= account.document_number %></strong>
|
||||
<% if account.username.present? %>
|
||||
<%= t("management.username_label") %> <strong><%= account.username %></strong>
|
||||
<% end %>
|
||||
<% if account.email.present? %>
|
||||
<%= t("management.email_label") %> <strong><%= account.email %></strong>
|
||||
<% end %>
|
||||
</p>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<%= render 'management/account_info.html', verification: @document_verification %>
|
||||
<%= render 'management/account_info.html', account: @document_verification %>
|
||||
|
||||
<div class="alert-box alert radius">
|
||||
<%= t("management.document_verifications.not_in_census") %>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<%= render 'management/account_info.html', verification: @document_verification %>
|
||||
<%= render 'management/account_info.html', account: @document_verification %>
|
||||
|
||||
<div class="alert-box success radius">
|
||||
<%= t("management.document_verifications.please_check_account_data") %>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<%= render 'management/account_info.html', verification: @document_verification %>
|
||||
<%= render 'management/account_info.html', account: @document_verification %>
|
||||
|
||||
<div class="alert-box success radius">
|
||||
<%= t("management.document_verifications.already_verified") %>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<%= render 'management/account_info.html', verification: @email_verification %>
|
||||
<%= render 'management/account_info.html', account: @email_verification %>
|
||||
|
||||
<div class="alert-box success radius">
|
||||
<%= t("management.email_verifications.document_found_in_census") %>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<%= render 'management/account_info.html', verification: @email_verification %>
|
||||
<%= render 'management/account_info.html', account: @email_verification %>
|
||||
|
||||
<div class="alert-box success radius">
|
||||
<%= t("management.email_verifications.email_sent_instructions") %>
|
||||
|
||||
Reference in New Issue
Block a user