Moves organization verification to Admin from Moderation
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
class Moderation::OrganizationsController < Moderation::BaseController
|
||||
class Admin::OrganizationsController < Admin::BaseController
|
||||
|
||||
load_and_authorize_resource
|
||||
|
||||
34
app/views/admin/organizations/index.html.erb
Normal file
34
app/views/admin/organizations/index.html.erb
Normal file
@@ -0,0 +1,34 @@
|
||||
<div class="left">
|
||||
|
||||
<h1><%= t('admin.organizations.index.title') %></h1>
|
||||
|
||||
<table>
|
||||
<% @organizations.each do |organization| %>
|
||||
<tr>
|
||||
<td><%= organization.name %></td>
|
||||
<td><%= organization.email %></td>
|
||||
<td><%= organization.phone_number %></td>
|
||||
<% if organization.verified? %>
|
||||
<td><%= t('admin.organizations.index.verified') %></td>
|
||||
<% end %>
|
||||
<% if can? :verify, organization %>
|
||||
<td><%= link_to t('admin.organizations.index.verify'),
|
||||
verify_admin_organization_path(organization),
|
||||
method: :put
|
||||
%>
|
||||
</td>
|
||||
<% end %>
|
||||
<% if organization.rejected? %>
|
||||
<td><%= t('admin.organizations.index.rejected') %></td>
|
||||
<% end %>
|
||||
<% if can? :reject, organization %>
|
||||
<td><%= link_to t('admin.organizations.index.reject'),
|
||||
reject_admin_organization_path(organization),
|
||||
method: :put
|
||||
%>
|
||||
</td>
|
||||
<% end %>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
</div>
|
||||
@@ -1,31 +0,0 @@
|
||||
<h1><%= t('moderation.organizations.index.title') %></h1>
|
||||
|
||||
<table>
|
||||
<% @organizations.each do |organization| %>
|
||||
<tr>
|
||||
<td><%= organization.name %></td>
|
||||
<td><%= organization.email %></td>
|
||||
<td><%= organization.phone_number %></td>
|
||||
<% if organization.verified? %>
|
||||
<td><%= t('moderation.organizations.index.verified') %></td>
|
||||
<% end %>
|
||||
<% if can? :verify, organization %>
|
||||
<td><%= link_to t('moderation.organizations.index.verify'),
|
||||
verify_moderation_organization_path(organization),
|
||||
method: :put
|
||||
%>
|
||||
</td>
|
||||
<% end %>
|
||||
<% if organization.rejected? %>
|
||||
<td><%= t('moderation.organizations.index.rejected') %></td>
|
||||
<% end %>
|
||||
<% if can? :reject, organization %>
|
||||
<td><%= link_to t('moderation.organizations.index.reject'),
|
||||
reject_moderation_organization_path(organization),
|
||||
method: :put
|
||||
%>
|
||||
</td>
|
||||
<% end %>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
@@ -11,3 +11,10 @@ en:
|
||||
name:
|
||||
placeholder: 'Write a topic'
|
||||
destroy: Delete Tag
|
||||
organizations:
|
||||
index:
|
||||
title: Organizations
|
||||
verify: Verify
|
||||
reject: Reject
|
||||
verified: Verified
|
||||
rejected: Rejected
|
||||
|
||||
@@ -3,6 +3,17 @@ es:
|
||||
dashboard:
|
||||
index:
|
||||
title: Administración
|
||||
organizations:
|
||||
index:
|
||||
title: Organizaciones
|
||||
verify: Verificar
|
||||
reject: Rechazar
|
||||
verified: Verificado
|
||||
rejected: Rechazado
|
||||
filter: Filtro
|
||||
filter_all: Todas
|
||||
filter_verified: Verificadas
|
||||
filter_rejected: Rechazadas
|
||||
tags:
|
||||
index:
|
||||
title: 'Temas de debate'
|
||||
|
||||
@@ -3,10 +3,4 @@ en:
|
||||
dashboard:
|
||||
index:
|
||||
title: Moderation
|
||||
organizations:
|
||||
index:
|
||||
title: Organizations
|
||||
verify: Verify
|
||||
reject: Reject
|
||||
verified: Verified
|
||||
rejected: Rejected
|
||||
|
||||
|
||||
@@ -3,11 +3,5 @@ es:
|
||||
dashboard:
|
||||
index:
|
||||
title: Moderación
|
||||
organizations:
|
||||
index:
|
||||
title: Organizaciones
|
||||
verify: Verificar
|
||||
reject: Rechazar
|
||||
verified: Verificado
|
||||
rejected: Rechazado
|
||||
|
||||
|
||||
|
||||
@@ -28,18 +28,18 @@ Rails.application.routes.draw do
|
||||
|
||||
namespace :admin do
|
||||
root to: "dashboard#index"
|
||||
|
||||
resources :tags, only: [:index, :create, :update, :destroy]
|
||||
end
|
||||
|
||||
namespace :moderation do
|
||||
root to: "dashboard#index"
|
||||
resources :organizations, only: :index do
|
||||
member do
|
||||
put :verify
|
||||
put :reject
|
||||
end
|
||||
end
|
||||
|
||||
resources :tags, only: [:index, :create, :update, :destroy]
|
||||
end
|
||||
|
||||
namespace :moderation do
|
||||
root to: "dashboard#index"
|
||||
end
|
||||
|
||||
# Example of regular route:
|
||||
|
||||
@@ -4,21 +4,21 @@ feature 'Moderations::Organizations' do
|
||||
|
||||
|
||||
background do
|
||||
moderator = create(:user)
|
||||
create(:moderator, user: moderator)
|
||||
administrator = create(:user)
|
||||
create(:administrator, user: administrator)
|
||||
|
||||
login_as(moderator)
|
||||
login_as(administrator)
|
||||
end
|
||||
|
||||
scenario "pending organizations have links to verify and reject" do
|
||||
organization = create(:organization)
|
||||
|
||||
visit moderation_organizations_path
|
||||
visit admin_organizations_path
|
||||
expect(page).to have_selector(:link_or_button, 'Verify')
|
||||
expect(page).to have_selector(:link_or_button, 'Reject')
|
||||
|
||||
click_on 'Verify'
|
||||
expect(current_path).to eq(moderation_organizations_path)
|
||||
expect(current_path).to eq(admin_organizations_path)
|
||||
expect(page).to have_content ('Verified')
|
||||
|
||||
expect(organization.reload.verified?).to eq(true)
|
||||
@@ -27,13 +27,13 @@ feature 'Moderations::Organizations' do
|
||||
scenario "verified organizations have link to reject" do
|
||||
organization = create(:verified_organization)
|
||||
|
||||
visit moderation_organizations_path
|
||||
visit admin_organizations_path
|
||||
expect(page).to have_content ('Verified')
|
||||
expect(page).to_not have_selector(:link_or_button, 'Verify')
|
||||
expect(page).to have_selector(:link_or_button, 'Reject')
|
||||
|
||||
click_on 'Reject'
|
||||
expect(current_path).to eq(moderation_organizations_path)
|
||||
expect(current_path).to eq(admin_organizations_path)
|
||||
expect(page).to have_content ('Rejected')
|
||||
|
||||
expect(organization.reload.rejected?).to eq(true)
|
||||
@@ -42,13 +42,13 @@ feature 'Moderations::Organizations' do
|
||||
scenario "rejected organizations have link to verify" do
|
||||
organization = create(:rejected_organization)
|
||||
|
||||
visit moderation_organizations_path
|
||||
visit admin_organizations_path
|
||||
expect(page).to have_content ('Rejected')
|
||||
expect(page).to have_selector(:link_or_button, 'Verify')
|
||||
expect(page).to_not have_selector(:link_or_button, 'Reject')
|
||||
|
||||
click_on 'Verify'
|
||||
expect(current_path).to eq(moderation_organizations_path)
|
||||
expect(current_path).to eq(admin_organizations_path)
|
||||
expect(page).to have_content ('Verified')
|
||||
|
||||
expect(organization.reload.verified?).to eq(true)
|
||||
Reference in New Issue
Block a user