Commit e48e8f422a94e5c11ee465389050b4f94d713270

Authored by Victor Costa
1 parent 983ad76a

Do not show tool label if there is no tool on a step

plugins/community_track/test/functional/community_track_plugin_content_viewer_controller_test.rb
... ... @@ -56,7 +56,7 @@ class ContentViewerControllerTest < ActionController::TestCase
56 56 end
57 57  
58 58 should 'show tools for a step' do
59   - Article.create!(:profile => @profile, :name => 'article', :parent => @step)
  59 + TinyMceArticle.create!(:profile => @profile, :name => 'article', :parent => @step)
60 60 get :view_page, @step.url
61 61 assert_tag :tag => 'div', :attributes => { :class => 'tools' }, :descendant => { :tag => 'div', :attributes => { :class => 'item' } }
62 62 end
... ...
plugins/community_track/views/content_viewer/step.rhtml
... ... @@ -9,17 +9,20 @@
9 9 <div>
10 10 <%= step.body %>
11 11 </div>
12   - <h3><%= _("Tool") %></h3>
13 12 <% if step.allow_create?(user) && !step.tool && step.tool_class %>
  13 + <h3><%= _("Tool") %></h3>
14 14 <div class="actions">
15 15 <a href="<%= url_for({:controller => 'cms', :action => 'new', :type => step.tool_type.constantize, :parent_id => @page}) %>" class="button with-text icon-new icon-new<%= step.tool_class.icon_name %>"><%= _('Create %s' % step.tool_class.short_description) %></a>
16 16 </div>
17 17 <% end %>
18   - <div class="tools">
19   - <div class="item">
20   - <div class="name">
21   - <%= link_to(step.tool.name, step.tool.view_url, :class=>"button with-text icon-new icon-new#{step.tool.class.icon_name}") if step.tool %>
  18 + <% if step.tool %>
  19 + <h3><%= _("Tool") %></h3>
  20 + <div class="tools">
  21 + <div class="item">
  22 + <div class="name">
  23 + <%= link_to(step.tool.name, step.tool.view_url, :class=>"button with-text icon-new icon-new#{step.tool.class.icon_name}") %>
  24 + </div>
22 25 </div>
23   - </div>
24   - </div>
  26 + </div>
  27 + <% end %>
25 28 </div>
... ...