Commit 0dad17a28445562b062e9f927d87b685638da315
1 parent
560b9c49
Exists in
theme-brasil-digital-from-staging
and in
9 other branches
Sort blocks by name in block store
Showing
2 changed files
with
7 additions
and
1 deletions
Show diff stats
app/controllers/box_organizer_controller.rb
| @@ -3,7 +3,7 @@ class BoxOrganizerController < ApplicationController | @@ -3,7 +3,7 @@ class BoxOrganizerController < ApplicationController | ||
| 3 | before_filter :login_required | 3 | before_filter :login_required |
| 4 | 4 | ||
| 5 | def index | 5 | def index |
| 6 | - @available_blocks = available_blocks.uniq | 6 | + @available_blocks = available_blocks.uniq.sort_by(&:pretty_name) |
| 7 | end | 7 | end |
| 8 | 8 | ||
| 9 | def move_block | 9 | def move_block |
test/functional/profile_design_controller_test.rb
| @@ -362,6 +362,12 @@ class ProfileDesignControllerTest < ActionController::TestCase | @@ -362,6 +362,12 @@ class ProfileDesignControllerTest < ActionController::TestCase | ||
| 362 | assert_tag :tag => 'a', :content => 'Back to control panel' | 362 | assert_tag :tag => 'a', :content => 'Back to control panel' |
| 363 | end | 363 | end |
| 364 | 364 | ||
| 365 | + should 'display avaliable blocks in alphabetical order' do | ||
| 366 | + @controller.stubs(:available_blocks).returns([TagsBlock, ArticleBlock]) | ||
| 367 | + get :index, :profile => 'designtestuser' | ||
| 368 | + assert_equal assigns(:available_blocks), [ArticleBlock, TagsBlock] | ||
| 369 | + end | ||
| 370 | + | ||
| 365 | should 'not allow products block if environment do not let' do | 371 | should 'not allow products block if environment do not let' do |
| 366 | env = Environment.default | 372 | env = Environment.default |
| 367 | env.disable('products_for_enterprises') | 373 | env.disable('products_for_enterprises') |