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
|
||||
@organization.verify
|
||||
redirect_to action: :index, filter: @filter
|
||||
redirect_to request.query_parameters.merge(action: :index)
|
||||
end
|
||||
|
||||
def reject
|
||||
@organization.reject
|
||||
redirect_to action: :index, filter: @filter
|
||||
redirect_to request.query_parameters.merge(action: :index)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
<% end %>
|
||||
<% if can? :verify, organization %>
|
||||
<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
|
||||
%>
|
||||
</td>
|
||||
@@ -36,7 +36,7 @@
|
||||
<% end %>
|
||||
<% if can? :reject, organization %>
|
||||
<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
|
||||
%>
|
||||
</td>
|
||||
@@ -45,4 +45,4 @@
|
||||
<% end %>
|
||||
</table>
|
||||
|
||||
<%= paginate @organizations %>
|
||||
<%= paginate @organizations %>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
require 'rails_helper'
|
||||
|
||||
feature 'Moderations::Organizations' do
|
||||
feature 'Admin::Organizations' do
|
||||
|
||||
|
||||
background do
|
||||
@@ -111,4 +111,18 @@ feature 'Moderations::Organizations' do
|
||||
expect(page).to_not have_content('Verified Organization')
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user