Fixes links in Admin::Organizations to handle filters + pages
This commit is contained in:
@@ -11,12 +11,12 @@ class Admin::OrganizationsController < Admin::BaseController
|
|||||||
|
|
||||||
def verify
|
def verify
|
||||||
@organization.verify
|
@organization.verify
|
||||||
redirect_to action: :index, filter: @filter
|
redirect_to request.query_parameters.merge(action: :index)
|
||||||
end
|
end
|
||||||
|
|
||||||
def reject
|
def reject
|
||||||
@organization.reject
|
@organization.reject
|
||||||
redirect_to action: :index, filter: @filter
|
redirect_to request.query_parameters.merge(action: :index)
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
<% if can? :verify, organization %>
|
<% if can? :verify, organization %>
|
||||||
<td><%= link_to t('admin.organizations.index.verify'),
|
<td><%= link_to t('admin.organizations.index.verify'),
|
||||||
verify_admin_organization_path(organization, filter: @filter),
|
verify_admin_organization_path(organization, request.query_parameters),
|
||||||
method: :put
|
method: :put
|
||||||
%>
|
%>
|
||||||
</td>
|
</td>
|
||||||
@@ -36,7 +36,7 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
<% if can? :reject, organization %>
|
<% if can? :reject, organization %>
|
||||||
<td><%= link_to t('admin.organizations.index.reject'),
|
<td><%= link_to t('admin.organizations.index.reject'),
|
||||||
reject_admin_organization_path(organization, filter: @filter),
|
reject_admin_organization_path(organization, request.query_parameters),
|
||||||
method: :put
|
method: :put
|
||||||
%>
|
%>
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
feature 'Moderations::Organizations' do
|
feature 'Admin::Organizations' do
|
||||||
|
|
||||||
|
|
||||||
background do
|
background do
|
||||||
@@ -111,4 +111,18 @@ feature 'Moderations::Organizations' do
|
|||||||
expect(page).to_not have_content('Verified Organization')
|
expect(page).to_not have_content('Verified Organization')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
scenario "Verifying organization links remember the pagination setting and the filter" do
|
||||||
|
30.times { create(:organization) }
|
||||||
|
|
||||||
|
visit admin_organizations_path(filter: 'pending', page: 2)
|
||||||
|
|
||||||
|
click_on('Verify', match: :first)
|
||||||
|
|
||||||
|
uri = URI.parse(current_url)
|
||||||
|
query_params = Rack::Utils.parse_nested_query(uri.query).symbolize_keys
|
||||||
|
|
||||||
|
expect(query_params[:filter]).to eq('pending')
|
||||||
|
expect(query_params[:page]).to eq('2')
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user