From fbe9c8769b84012dc09f69e5976275c054d564bf Mon Sep 17 00:00:00 2001 From: Joenio Costa Date: Mon, 9 May 2011 10:02:26 -0300 Subject: [PATCH] Showing selected article in editing ArticleBlock --- app/views/box_organizer/_article_block.rhtml | 2 +- test/functional/profile_design_controller_test.rb | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/app/views/box_organizer/_article_block.rhtml b/app/views/box_organizer/_article_block.rhtml index 2740795..5de82d8 100644 --- a/app/views/box_organizer/_article_block.rhtml +++ b/app/views/box_organizer/_article_block.rhtml @@ -5,6 +5,6 @@

<% else %> <% articles = @block.available_articles.select {|article| !article.folder? } %> - <%= select_tag('block[article_id]', options_for_select_with_title(articles.map {|item| [item.path, item.id]})) %> + <%= select_tag('block[article_id]', options_for_select_with_title(articles.map {|item| [item.path, item.id]}, @block.article ? @block.article.id : nil)) %> <% end %> diff --git a/test/functional/profile_design_controller_test.rb b/test/functional/profile_design_controller_test.rb index 1d607e3..128fd20 100644 --- a/test/functional/profile_design_controller_test.rb +++ b/test/functional/profile_design_controller_test.rb @@ -401,4 +401,11 @@ class ProfileDesignControllerTest < Test::Unit::TestCase assert_equal [], @controller.available_blocks - ENTERPRISE_BLOCKS_WITH_PRODUCTS_ENABLE end + should 'editing article block displays right selected article' do + selected_article = fast_create(Article, :profile_id => profile.id) + ArticleBlock.any_instance.stubs(:article).returns(selected_article) + get :edit, :profile => 'designtestuser', :id => @b1.id + assert_tag :tag => 'option', :attributes => {:value => selected_article.id, :selected => 'selected'} + end + end -- libgit2 0.21.2