Commit fbe9c8769b84012dc09f69e5976275c054d564bf
Committed by
Daniela Feitosa
1 parent
cf4d226c
Exists in
master
and in
29 other branches
Showing selected article in editing ArticleBlock
(ActionItem1957)
Showing
2 changed files
with
8 additions
and
1 deletions
Show diff stats
app/views/box_organizer/_article_block.rhtml
@@ -5,6 +5,6 @@ | @@ -5,6 +5,6 @@ | ||
5 | </p> | 5 | </p> |
6 | <% else %> | 6 | <% else %> |
7 | <% articles = @block.available_articles.select {|article| !article.folder? } %> | 7 | <% articles = @block.available_articles.select {|article| !article.folder? } %> |
8 | - <%= select_tag('block[article_id]', options_for_select_with_title(articles.map {|item| [item.path, item.id]})) %> | 8 | + <%= select_tag('block[article_id]', options_for_select_with_title(articles.map {|item| [item.path, item.id]}, @block.article ? @block.article.id : nil)) %> |
9 | <% end %> | 9 | <% end %> |
10 | </div> | 10 | </div> |
test/functional/profile_design_controller_test.rb
@@ -401,4 +401,11 @@ class ProfileDesignControllerTest < Test::Unit::TestCase | @@ -401,4 +401,11 @@ class ProfileDesignControllerTest < Test::Unit::TestCase | ||
401 | assert_equal [], @controller.available_blocks - ENTERPRISE_BLOCKS_WITH_PRODUCTS_ENABLE | 401 | assert_equal [], @controller.available_blocks - ENTERPRISE_BLOCKS_WITH_PRODUCTS_ENABLE |
402 | end | 402 | end |
403 | 403 | ||
404 | + should 'editing article block displays right selected article' do | ||
405 | + selected_article = fast_create(Article, :profile_id => profile.id) | ||
406 | + ArticleBlock.any_instance.stubs(:article).returns(selected_article) | ||
407 | + get :edit, :profile => 'designtestuser', :id => @b1.id | ||
408 | + assert_tag :tag => 'option', :attributes => {:value => selected_article.id, :selected => 'selected'} | ||
409 | + end | ||
410 | + | ||
404 | end | 411 | end |