FIX: keep correct ordering on admin badges

This commit is contained in:
Sam 2014-07-30 08:35:15 +10:00
parent b196de0821
commit 5a3466a6c3
2 changed files with 10 additions and 1 deletions

View file

@ -4,7 +4,9 @@ class Admin::BadgesController < Admin::AdminController
data = {
badge_types: BadgeType.all.order(:id).to_a,
badge_groupings: BadgeGrouping.all.order(:position).to_a,
badges: Badge.all.to_a,
badges: Badge.includes(:badge_grouping)
.references(:badge_grouping)
.order('badge_groupings.position, badge_type_id, badges.name').to_a,
protected_system_fields: Badge.protected_system_fields,
triggers: Badge.trigger_hash
}

View file

@ -6,6 +6,13 @@ describe Admin::BadgesController do
let!(:user) { log_in(:admin) }
let!(:badge) { Fabricate(:badge) }
context 'index' do
it 'returns badge index' do
xhr :get, :index
response.should be_success
end
end
context '.save_badge_groupings' do
it 'can save badge groupings' do