diff --git a/plugins/community_track/lib/community_track_plugin/step_helper.rb b/plugins/community_track/lib/community_track_plugin/step_helper.rb index 625f7ed..f2e2c62 100644 --- a/plugins/community_track/lib/community_track_plugin/step_helper.rb +++ b/plugins/community_track/lib/community_track_plugin/step_helper.rb @@ -21,6 +21,16 @@ module CommunityTrackPlugin::StepHelper nil end + def link_to_step_tool(step, options={}) + if step.tool + link_to step.tool.view_url, options do + yield + end + else + yield + end + end + protected def status_index(step) diff --git a/plugins/community_track/public/style.css b/plugins/community_track/public/style.css index 686293e..a3f930a 100644 --- a/plugins/community_track/public/style.css +++ b/plugins/community_track/public/style.css @@ -3,17 +3,17 @@ background-image: url(/plugins/community_track/icons/community-track.png) } -.step_active, #article .step_active a { +.step_active, #article .step_active { background-color: #CCEBD6; color: #338533; } -.step_waiting, #article .step_waiting a { +.step_waiting, #article .step_waiting { background-color: #FFFFD1; color: #D17519; } -.step_finished, #article .step_finished a { +.step_finished, #article .step_finished { background-color: #D1FFFF; color: #00297A; } @@ -24,6 +24,7 @@ .step { font-weight: bold; + margin-bottom: 3px; } .track_list .item .step { @@ -73,6 +74,11 @@ .steps .step { margin-top: 3px; margin-bottom: 3px; + display: block; +} + +.steps a { + text-decoration: none; } .track_list .item_card .track_stats { @@ -126,11 +132,12 @@ #track .position { font-size: 24px; font-weight: bold; - float: left; margin: 0 10px; + display: inline-block; + vertical-align: top; } -#track .step .name, #track .step .name a { +#track .step .name { font-weight: bold; color: #333; } @@ -151,7 +158,7 @@ #track .content { margin: 6px 0px; - border-bottom: 1px solid #DDDDDD; + display: inline-block; } #track .ui-state-default .content { @@ -201,16 +208,51 @@ } .step_list .step .tools { - text-align: center; + margin-top: 5px; } -.step_list .step .actions { - float: right; +#article .step_list .step .tool_icon, +.tool_icon { + color: #888; + background-color: transparent; + border: 0px; + background-repeat: no-repeat; + line-height: 20px; + height: 20px; + padding: 3px 2px 3px 22px; } -#article .step_list .step .actions .button { +#article .step .tool_link { + cursor: pointer; +} + +#article .step_active .tool_link:hover, +.step_active:hover { + background-color: #B8D4C1; +} + +#article .step_waiting .tool_link:hover, +.step_waiting:hover { + background-color: #E6E6BC; +} + +#article .step_finished .tool_link:hover, +.step_finished:hover { + background-color: #BCE6E6; +} + +.step_list .step .step_actions { + text-align: right; + border-top: 1px solid; +} + +#article .step_list .step .step_actions .button { color: #888; background-color: transparent; border: 0px; - background-image: none; + border-right: 1px solid; +} + +#article .step_list .step .step_actions .button:hover { + color: #444; } diff --git a/plugins/community_track/test/functional/community_track_plugin_content_viewer_controller_test.rb b/plugins/community_track/test/functional/community_track_plugin_content_viewer_controller_test.rb index 42c4752..576bd8f 100644 --- a/plugins/community_track/test/functional/community_track_plugin_content_viewer_controller_test.rb +++ b/plugins/community_track/test/functional/community_track_plugin_content_viewer_controller_test.rb @@ -21,7 +21,7 @@ class ContentViewerControllerTest < ActionController::TestCase should 'show actions for tracks when user has permission for edit' do get :view_page, @track.url - assert_tag :tag => 'div', :attributes => {:id => 'track' }, :descendant => { :tag => 'div', :attributes => { :class => 'actions' } } + assert_tag :tag => 'div', :attributes => {:id => 'track' }, :descendant => { :tag => 'div', :attributes => { :class => 'track actions' } } end should 'do not show actions for tracks when user has not permission to edit' do @@ -107,7 +107,7 @@ class ContentViewerControllerTest < ActionController::TestCase @block = CommunityTrackPlugin::TrackListBlock.create!(:box => box) @profile.boxes << box get :view_page, @step.url - assert_tag :tag => 'div', :attributes => { :class => "item category_#{@track.category_name}" }, :descendant => { :tag => 'div', :attributes => { :class => 'steps' }, :descendant => { :tag => 'div', :attributes => { :class => "step #{@block.status_class(@step)}" } } } + assert_tag :tag => 'div', :attributes => { :class => "item category_#{@track.category_name}" }, :descendant => { :tag => 'div', :attributes => { :class => 'steps' }, :descendant => { :tag => 'span', :attributes => { :class => "step #{@block.status_class(@step)}" } } } end should 'render tracks in track card list block' do diff --git a/plugins/community_track/test/unit/community_track_plugin/step_helper_test.rb b/plugins/community_track/test/unit/community_track_plugin/step_helper_test.rb index edc1b85..ea92be9 100644 --- a/plugins/community_track/test/unit/community_track_plugin/step_helper_test.rb +++ b/plugins/community_track/test/unit/community_track_plugin/step_helper_test.rb @@ -35,4 +35,21 @@ class StepHelperTest < ActiveSupport::TestCase assert !custom_options_for_article(fast_create(Article)) end + should 'return content without link if there is no tool in a step' do + link = link_to_step_tool(@step) do + "content" + end + assert_equal 'content', link + end + + should 'return link to step tool if there is a tool' do + profile = fast_create(Community) + tool = fast_create(Article, :profile_id => profile.id) + @step.stubs(:tool).returns(tool) + expects(:link_to).with(tool.view_url, {}).once + link = link_to_step_tool(@step) do + "content" + end + end + end diff --git a/plugins/community_track/views/blocks/_track.rhtml b/plugins/community_track/views/blocks/_track.rhtml index 1a0feaa..53a1062 100644 --- a/plugins/community_track/views/blocks/_track.rhtml +++ b/plugins/community_track/views/blocks/_track.rhtml @@ -1,4 +1,5 @@ <% extend CommunityTrackPlugin::TrackHelper %> +<% extend CommunityTrackPlugin::StepHelper %>
@@ -10,10 +11,13 @@

<%= _("Steps") %>

<% track.steps.each do |step| %> -
-
<%= step.position %>
- <%= link_to step.name, step.url %> -
+ <% link_to_step_tool(step) do %> + + <%= step.position %> + + <%= step.name %> + + <% end %> <% end %>
diff --git a/plugins/community_track/views/content_viewer/_step_item.rhtml b/plugins/community_track/views/content_viewer/_step_item.rhtml index 87cff76..7c890f9 100644 --- a/plugins/community_track/views/content_viewer/_step_item.rhtml +++ b/plugins/community_track/views/content_viewer/_step_item.rhtml @@ -1,25 +1,36 @@
  • <%= hidden_field_tag "step_ids[]", step_item.id %> -
    <%= step_item.hidden ? '' : step_item.position %>
    -
    + +
    <% if step_item.allow_edit?(user) && !remove_content_button(:edit) %> + <%= button('eyes', _('View'), step_item.url) %> <% content = content_tag('span', label_for_edit_article(step_item)) %> <% url = profile.admin_url.merge({ :controller => 'cms', :action => 'edit', :id => step_item.id, :success_back_to => url_for(step_item.parent.view_url) }) %> <%= expirable_button step_item, :edit, content, url %> <% end %> -
    -
    -
    - <%= show_period(step_item.start_date, step_item.end_date) %> -
    -
    <%= link_to step_item.name, step_item.url %>
    -
    <%= step_item.body %>
    -
    -
    - <% if step_item.tool %> - <%= link_to step_item.tool.name, step_item.tool.view_url %> - <% elsif step_item.allow_create?(user) && step_item.tool_class %> - <%= _('Create %s' % step_item.tool_class.short_description) %> - <% end %> + <% if step_item.accept_uploads? && step_item.allow_create?(user) %> + <%= button('upload-file', _('Upload files'), profile.admin_url.merge(:controller => 'cms', :action => 'upload_files', :parent_id => step_item)) unless remove_content_button(:upload)%> + <% end %>
  • -- libgit2 0.21.2