From 0dad17a28445562b062e9f927d87b685638da315 Mon Sep 17 00:00:00 2001 From: Victor Costa Date: Thu, 12 Mar 2015 15:36:17 -0300 Subject: [PATCH] Sort blocks by name in block store --- app/controllers/box_organizer_controller.rb | 2 +- test/functional/profile_design_controller_test.rb | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/controllers/box_organizer_controller.rb b/app/controllers/box_organizer_controller.rb index f98bc3a..c942210 100644 --- a/app/controllers/box_organizer_controller.rb +++ b/app/controllers/box_organizer_controller.rb @@ -3,7 +3,7 @@ class BoxOrganizerController < ApplicationController before_filter :login_required def index - @available_blocks = available_blocks.uniq + @available_blocks = available_blocks.uniq.sort_by(&:pretty_name) end def move_block diff --git a/test/functional/profile_design_controller_test.rb b/test/functional/profile_design_controller_test.rb index 57f0f2b..1b0d621 100644 --- a/test/functional/profile_design_controller_test.rb +++ b/test/functional/profile_design_controller_test.rb @@ -362,6 +362,12 @@ class ProfileDesignControllerTest < ActionController::TestCase assert_tag :tag => 'a', :content => 'Back to control panel' end + should 'display avaliable blocks in alphabetical order' do + @controller.stubs(:available_blocks).returns([TagsBlock, ArticleBlock]) + get :index, :profile => 'designtestuser' + assert_equal assigns(:available_blocks), [ArticleBlock, TagsBlock] + end + should 'not allow products block if environment do not let' do env = Environment.default env.disable('products_for_enterprises') -- libgit2 0.21.2