Renaming of management validations
This commit is contained in:
@@ -0,0 +1,41 @@
|
|||||||
|
class Management::DocumentVerificationsController < Management::BaseController
|
||||||
|
|
||||||
|
def index
|
||||||
|
@document_verification = Verification::Management::Document.new()
|
||||||
|
end
|
||||||
|
|
||||||
|
def check
|
||||||
|
@document_verification = Verification::Management::Document.new(document_verification_params)
|
||||||
|
|
||||||
|
if @document_verification.valid?
|
||||||
|
if @document_verification.verified?
|
||||||
|
render :verified
|
||||||
|
elsif @document_verification.user?
|
||||||
|
render :new
|
||||||
|
elsif @document_verification.in_census?
|
||||||
|
redirect_to new_management_email_verification_path(email_verification: document_verification_params)
|
||||||
|
else
|
||||||
|
render :invalid_document
|
||||||
|
end
|
||||||
|
else
|
||||||
|
render :index
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def create
|
||||||
|
@document_verification = Verification::Management::Document.new(document_verification_params)
|
||||||
|
@document_verification.verify
|
||||||
|
render :verified
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def document_verification_params
|
||||||
|
params.require(:document_verification).permit(:document_type, :document_number)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
25
app/controllers/management/email_verifications_controller.rb
Normal file
25
app/controllers/management/email_verifications_controller.rb
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
class Management::EmailVerificationsController < Management::BaseController
|
||||||
|
|
||||||
|
def new
|
||||||
|
@email_verification = Verification::Management::Email.new(email_verification_params)
|
||||||
|
end
|
||||||
|
|
||||||
|
def create
|
||||||
|
@email_verification = Verification::Email.new(email_verification_params)
|
||||||
|
|
||||||
|
if @email_verification.valid?
|
||||||
|
@email_verification.send_email
|
||||||
|
render :sent
|
||||||
|
else
|
||||||
|
render :new
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def email_verification_params
|
||||||
|
params.require(:email_verification).permit(:document_type, :document_number, :email)
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
class Management::OnSiteVerificationEmailsController < Management::BaseController
|
|
||||||
|
|
||||||
def new
|
|
||||||
@verification_on_site_email = Verification::OnSiteEmail.new(verification_on_site_email_params)
|
|
||||||
end
|
|
||||||
|
|
||||||
def create
|
|
||||||
@verification_on_site_email = Verification::OnSiteEmail.new(verification_on_site_email_params)
|
|
||||||
|
|
||||||
if @verification_on_site_email.valid?
|
|
||||||
@verification_on_site_email.send_email
|
|
||||||
render :sent
|
|
||||||
else
|
|
||||||
render :new
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def verification_on_site_email_params
|
|
||||||
params.require(:verification_on_site_email).permit(:document_type, :document_number, :email)
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
class Management::OnSiteVerificationsController < Management::BaseController
|
|
||||||
|
|
||||||
def index
|
|
||||||
@verification_on_site = Verification::OnSite.new()
|
|
||||||
end
|
|
||||||
|
|
||||||
def check
|
|
||||||
@verification_on_site = Verification::OnSite.new(verification_on_site_params)
|
|
||||||
|
|
||||||
if @verification_on_site.valid?
|
|
||||||
if @verification_on_site.verified?
|
|
||||||
render :verified
|
|
||||||
elsif @verification_on_site.user?
|
|
||||||
render :new
|
|
||||||
elsif @verification_on_site.in_census?
|
|
||||||
redirect_to new_management_on_site_verification_email_path(verification_on_site_email: verification_on_site_params)
|
|
||||||
else
|
|
||||||
render :invalid_document
|
|
||||||
end
|
|
||||||
else
|
|
||||||
render :index
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def create
|
|
||||||
@verification_on_site = Verification::OnSite.new(verification_on_site_params)
|
|
||||||
@verification_on_site.verify
|
|
||||||
render :verified
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def verification_on_site_params
|
|
||||||
params.require(:verification_on_site).permit(:document_type, :document_number)
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
class Verification::OnSite
|
class Verification::Management::Document
|
||||||
include ActiveModel::Model
|
include ActiveModel::Model
|
||||||
|
|
||||||
attr_accessor :document_type
|
attr_accessor :document_type
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
class Verification::OnSiteEmail
|
class Verification::Management::Email
|
||||||
include ActiveModel::Model
|
include ActiveModel::Model
|
||||||
|
|
||||||
attr_accessor :document_type
|
attr_accessor :document_type
|
||||||
@@ -4,8 +4,9 @@
|
|||||||
<%= link_to t("management.dashboard.index.title"), management_root_path %>
|
<%= link_to t("management.dashboard.index.title"), management_root_path %>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li <%= "class=active" if controller_name == "on_site_verifications" %>>
|
<li <%= "class=active" if controller_name == "document_verifications" ||
|
||||||
<%= link_to management_on_site_verifications_path do %>
|
controller_name == "email_verifications" %>>
|
||||||
|
<%= link_to management_document_verifications_path do %>
|
||||||
<i class="icon-tag"></i>
|
<i class="icon-tag"></i>
|
||||||
<%= t("management.menu.on_site_verifications") %>
|
<%= t("management.menu.on_site_verifications") %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -2,7 +2,10 @@
|
|||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="small-12 medium-8 column">
|
<div class="small-12 medium-8 column">
|
||||||
<%= form_for @verification_on_site, url: check_management_on_site_verifications_path do |f| %>
|
<%= form_for(@document_verification,
|
||||||
|
as: :document_verification,
|
||||||
|
url: check_management_document_verifications_path) do |f| %>
|
||||||
|
|
||||||
<div class="small-12 medium-4">
|
<div class="small-12 medium-4">
|
||||||
<%= f.select(:document_type,
|
<%= f.select(:document_type,
|
||||||
[[humanize_document_type("1"), 1],
|
[[humanize_document_type("1"), 1],
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<p class="account-info">
|
<p class="account-info">
|
||||||
<%= t("management.document_type_label") %> <strong><%= humanize_document_type(@verification_on_site.document_type) %></strong>
|
<%= t("management.document_type_label") %> <strong><%= humanize_document_type(@document_verification.document_type) %></strong>
|
||||||
<%= t("management.document_number") %> <strong><%= @verification_on_site.document_number %></strong>
|
<%= t("management.document_number") %> <strong><%= @document_verification.document_number %></strong>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div class="alert-box alert radius">
|
<div class="alert-box alert radius">
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
<p class="account-info">
|
<p class="account-info">
|
||||||
<%= t("management.document_type_label") %> <strong><%= humanize_document_type(@verification_on_site.document_type) %></strong>
|
<%= t("management.document_type_label") %> <strong><%= humanize_document_type(@document_verification.document_type) %></strong>
|
||||||
<%= t("management.document_number") %> <strong><%= @verification_on_site.document_number %></strong>
|
<%= t("management.document_number") %> <strong><%= @document_verification.document_number %></strong>
|
||||||
<%= t("management.username_label") %> <strong><%= @verification_on_site.user.username %></strong>
|
<%= t("management.username_label") %> <strong><%= @document_verification.user.username %></strong>
|
||||||
<%= t("management.email_label") %> <strong><%= @verification_on_site.user.email %></strong>
|
<%= t("management.email_label") %> <strong><%= @document_verification.user.email %></strong>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div class="alert-box success radius">
|
<div class="alert-box success radius">
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
<li><i class="icon-x"></i> <%= t("management.users.user_permission_votes") %></li>
|
<li><i class="icon-x"></i> <%= t("management.users.user_permission_votes") %></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<%= form_for @verification_on_site, url: management_on_site_verifications_path do |f| %>
|
<%= form_for @document_verification, url: management_on_site_verifications_path do |f| %>
|
||||||
<%= f.hidden_field :document_type %>
|
<%= f.hidden_field :document_type %>
|
||||||
<%= f.hidden_field :document_number %>
|
<%= f.hidden_field :document_number %>
|
||||||
<%= f.submit t("management.users.verify"), class: "button success radius" %>
|
<%= f.submit t("management.users.verify"), class: "button success radius" %>
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
<p class="account-info">
|
<p class="account-info">
|
||||||
<%= t("management.document_type_label") %> <strong><%= humanize_document_type(@verification_on_site.document_type) %></strong>
|
<%= t("management.document_type_label") %> <strong><%= humanize_document_type(@document_verification.document_type) %></strong>
|
||||||
<%= t("management.document_number") %> <strong><%= @verification_on_site.document_number %></strong>
|
<%= t("management.document_number") %> <strong><%= @document_verification.document_number %></strong>
|
||||||
<%= t("management.username_label") %> <strong><%= @verification_on_site.user.username %></strong>
|
<%= t("management.username_label") %> <strong><%= @document_verification.user.username %></strong>
|
||||||
<%= t("management.email_label") %> <strong><%= @verification_on_site.user.email %></strong>
|
<%= t("management.email_label") %> <strong><%= @document_verification.user.email %></strong>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div class="alert-box success radius">
|
<div class="alert-box success radius">
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<p class="account-info">
|
<p class="account-info">
|
||||||
<%= t("management.document_type_label") %> <strong><%= humanize_document_type(@verification_on_site_email.document_type) %></strong>
|
<%= t("management.document_type_label") %> <strong><%= humanize_document_type(@email_verification.document_type) %></strong>
|
||||||
<%= t("management.document_number") %> <strong><%= @verification_on_site_email.document_number %></strong>
|
<%= t("management.document_number") %> <strong><%= @email_verification.document_number %></strong>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div class="alert-box success radius">
|
<div class="alert-box success radius">
|
||||||
@@ -13,7 +13,9 @@
|
|||||||
|
|
||||||
<p><%= t("management.users.has_account_note") %></p>
|
<p><%= t("management.users.has_account_note") %></p>
|
||||||
|
|
||||||
<%= form_for @verification_on_site_email, url: management_on_site_verification_emails_path do |f| %>
|
<%= form_for @email_verification,
|
||||||
|
as: :email_verification,
|
||||||
|
url: management_email_verifications_path do |f| %>
|
||||||
<%= f.hidden_field :document_type %>
|
<%= f.hidden_field :document_type %>
|
||||||
<%= f.hidden_field :document_number %>
|
<%= f.hidden_field :document_number %>
|
||||||
<%= f.text_field :email, label: false, placeholder: t('management.users.has_account_placeholder') %>
|
<%= f.text_field :email, label: false, placeholder: t('management.users.has_account_placeholder') %>
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
<p class="account-info">
|
<p class="account-info">
|
||||||
<%= t("management.document_type_label") %> <strong><%= humanize_document_type(@verification_on_site_email.document_type) %></strong>
|
<%= t("management.document_type_label") %> <strong><%= humanize_document_type(@email_verification.document_type) %></strong>
|
||||||
<%= t("management.document_number") %> <strong><%= @verification_on_site_email.document_number %></strong>
|
<%= t("management.document_number") %> <strong><%= @email_verification.document_number %></strong>
|
||||||
<%= t("management.username_label") %> <strong><%= @verification_on_site_email.user.username %></strong>
|
<%= t("management.username_label") %> <strong><%= @email_verification.user.username %></strong>
|
||||||
<%= t("management.email_label") %> <strong><%= @verification_on_site_email.user.email %></strong>
|
<%= t("management.email_label") %> <strong><%= @email_verification.user.email %></strong>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div class="alert-box success radius">
|
<div class="alert-box success radius">
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
<p class="account-info">
|
|
||||||
<%= t("management.document_type_label") %> <strong><%= humanize_document_type(@verification_on_site.document_type) %></strong>
|
|
||||||
<%= t("management.document_number") %> <strong><%= @verification_on_site.document_number %></strong>
|
|
||||||
<%= t("management.username_label") %> <strong><%= @verification_on_site.user.username %></strong>
|
|
||||||
<%= t("management.email_label") %> <strong><%= @verification_on_site.user.email %></strong>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<div class="alert-box success radius">
|
|
||||||
<%= t("management.users.already_verified") %>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="user-permissions">
|
|
||||||
|
|
||||||
<p><%= t("management.users.census_success_info") %></p>
|
|
||||||
|
|
||||||
<ul>
|
|
||||||
<li><i class="icon-check"></i> <%= t("management.users.user_permission_debates") %></li>
|
|
||||||
<li><i class="icon-check"></i> <%= t("management.users.user_permission_proposal") %></li>
|
|
||||||
<li><i class="icon-check"></i> <%= t("management.users.user_permission_support_proposal") %></li>
|
|
||||||
<li><i class="icon-check"></i> <%= t("management.users.user_permission_votes") %></li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<a href="javascript:window.print();" class="button warning radius"><%= t("management.print_info") %></a>
|
|
||||||
@@ -166,15 +166,13 @@ Rails.application.routes.draw do
|
|||||||
namespace :management do
|
namespace :management do
|
||||||
root to: "dashboard#index"
|
root to: "dashboard#index"
|
||||||
|
|
||||||
resources :on_site_verifications, only: [:index, :new, :create] do
|
resources :document_verifications, only: [:index, :new, :create] do
|
||||||
collection do
|
collection do
|
||||||
post :check
|
post :check
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
resources :on_site_verification_emails, only: [:new, :create]
|
resources :email_verifications, only: [:new, :create]
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Example of regular route:
|
# Example of regular route:
|
||||||
|
|||||||
Reference in New Issue
Block a user