From 0e4d4a791116f51ca211b8a881618e86a46a4597 Mon Sep 17 00:00:00 2001 From: Victor Costa Date: Mon, 24 Feb 2014 19:36:46 -0300 Subject: [PATCH] rails3: fix community_track plugin --- plugins/community_track/lib/community_track_plugin/activation_job.rb | 2 +- plugins/community_track/lib/community_track_plugin/step.rb | 8 +++++--- plugins/community_track/lib/community_track_plugin/track.rb | 8 +++++--- plugins/community_track/lib/community_track_plugin/track_list_block.rb | 6 +++--- plugins/community_track/test/functional/community_track_plugin_content_viewer_controller_test.rb | 12 ++++++------ plugins/community_track/test/functional/community_track_plugin_environment_design_controller_test.rb | 6 +++--- plugins/community_track/test/functional/community_track_plugin_public_controller_test.rb | 4 ++-- plugins/community_track/test/unit/community_track_plugin/step_test.rb | 6 +++--- plugins/community_track/test/unit/community_track_plugin/track_card_list_block_test.rb | 2 +- plugins/community_track/test/unit/community_track_plugin/track_list_block_test.rb | 4 ++-- plugins/community_track/test/unit/community_track_plugin/track_test.rb | 4 ++-- plugins/community_track/views/blocks/_track.html.erb | 26 ++++++++++++++++++++++++++ plugins/community_track/views/blocks/_track.rhtml | 26 -------------------------- plugins/community_track/views/blocks/_track_card.html.erb | 29 +++++++++++++++++++++++++++++ plugins/community_track/views/blocks/_track_card.rhtml | 29 ----------------------------- plugins/community_track/views/blocks/_track_list_more.html.erb | 12 ++++++++++++ plugins/community_track/views/blocks/_track_list_more.rhtml | 12 ------------ plugins/community_track/views/blocks/track_list.html.erb | 6 ++++++ plugins/community_track/views/blocks/track_list.rhtml | 6 ------ plugins/community_track/views/box_organizer/community_track_plugin/_track_list_block.html.erb | 6 ++++++ plugins/community_track/views/box_organizer/community_track_plugin/_track_list_block.rhtml | 6 ------ plugins/community_track/views/cms/community_track_plugin/_step.html.erb | 21 +++++++++++++++++++++ plugins/community_track/views/cms/community_track_plugin/_step.rhtml | 21 --------------------- plugins/community_track/views/cms/community_track_plugin/_track.html.erb | 16 ++++++++++++++++ plugins/community_track/views/cms/community_track_plugin/_track.rhtml | 16 ---------------- plugins/community_track/views/community_track_plugin_public/all_tracks.html.erb | 10 ++++++++++ plugins/community_track/views/community_track_plugin_public/all_tracks.rhtml | 10 ---------- plugins/community_track/views/community_track_plugin_public/select_community.html.erb | 41 +++++++++++++++++++++++++++++++++++++++++ plugins/community_track/views/community_track_plugin_public/select_community.rhtml | 41 ----------------------------------------- plugins/community_track/views/content_viewer/_step_item.html.erb | 41 +++++++++++++++++++++++++++++++++++++++++ plugins/community_track/views/content_viewer/_step_item.rhtml | 41 ----------------------------------------- plugins/community_track/views/content_viewer/step.html.erb | 28 ++++++++++++++++++++++++++++ plugins/community_track/views/content_viewer/step.rhtml | 28 ---------------------------- plugins/community_track/views/content_viewer/track.html.erb | 42 ++++++++++++++++++++++++++++++++++++++++++ plugins/community_track/views/content_viewer/track.rhtml | 42 ------------------------------------------ 35 files changed, 311 insertions(+), 307 deletions(-) create mode 100644 plugins/community_track/views/blocks/_track.html.erb delete mode 100644 plugins/community_track/views/blocks/_track.rhtml create mode 100644 plugins/community_track/views/blocks/_track_card.html.erb delete mode 100644 plugins/community_track/views/blocks/_track_card.rhtml create mode 100644 plugins/community_track/views/blocks/_track_list_more.html.erb delete mode 100644 plugins/community_track/views/blocks/_track_list_more.rhtml create mode 100644 plugins/community_track/views/blocks/track_list.html.erb delete mode 100644 plugins/community_track/views/blocks/track_list.rhtml create mode 100644 plugins/community_track/views/box_organizer/community_track_plugin/_track_list_block.html.erb delete mode 100644 plugins/community_track/views/box_organizer/community_track_plugin/_track_list_block.rhtml create mode 100644 plugins/community_track/views/cms/community_track_plugin/_step.html.erb delete mode 100644 plugins/community_track/views/cms/community_track_plugin/_step.rhtml create mode 100644 plugins/community_track/views/cms/community_track_plugin/_track.html.erb delete mode 100644 plugins/community_track/views/cms/community_track_plugin/_track.rhtml create mode 100644 plugins/community_track/views/community_track_plugin_public/all_tracks.html.erb delete mode 100644 plugins/community_track/views/community_track_plugin_public/all_tracks.rhtml create mode 100644 plugins/community_track/views/community_track_plugin_public/select_community.html.erb delete mode 100644 plugins/community_track/views/community_track_plugin_public/select_community.rhtml create mode 100644 plugins/community_track/views/content_viewer/_step_item.html.erb delete mode 100644 plugins/community_track/views/content_viewer/_step_item.rhtml create mode 100644 plugins/community_track/views/content_viewer/step.html.erb delete mode 100644 plugins/community_track/views/content_viewer/step.rhtml create mode 100644 plugins/community_track/views/content_viewer/track.html.erb delete mode 100644 plugins/community_track/views/content_viewer/track.rhtml diff --git a/plugins/community_track/lib/community_track_plugin/activation_job.rb b/plugins/community_track/lib/community_track_plugin/activation_job.rb index abae756..d10b50c 100644 --- a/plugins/community_track/lib/community_track_plugin/activation_job.rb +++ b/plugins/community_track/lib/community_track_plugin/activation_job.rb @@ -1,7 +1,7 @@ class CommunityTrackPlugin::ActivationJob < Struct.new(:step_id) def self.find(step_id) - Delayed::Job.where(:handler => "--- !ruby/struct:CommunityTrackPlugin::ActivationJob \nstep_id: #{step_id}\n") + Delayed::Job.where(:handler => "--- !ruby/struct:CommunityTrackPlugin::ActivationJob\nstep_id: #{step_id}\n") end def perform diff --git a/plugins/community_track/lib/community_track_plugin/step.rb b/plugins/community_track/lib/community_track_plugin/step.rb index e697e26..a390918 100644 --- a/plugins/community_track/lib/community_track_plugin/step.rb +++ b/plugins/community_track/lib/community_track_plugin/step.rb @@ -3,6 +3,8 @@ class CommunityTrackPlugin::Step < Folder settings_items :hidden, :type => :boolean, :default => false settings_items :tool_type, :type => String + attr_accessible :start_date, :end_date, :tool_type, :hidden + alias :tools :children acts_as_list :scope => :parent @@ -64,8 +66,8 @@ class CommunityTrackPlugin::Step < Folder def to_html(options = {}) step = self - lambda do - render :file => 'content_viewer/step.rhtml', :locals => {:step => step} + proc do + render :file => 'content_viewer/step', :locals => {:step => step} end end @@ -86,7 +88,7 @@ class CommunityTrackPlugin::Step < Folder if Date.today <= end_date || accept_comments schedule_date = !accept_comments ? start_date : end_date + 1.day CommunityTrackPlugin::ActivationJob.find(id).destroy_all - Delayed::Job.enqueue(CommunityTrackPlugin::ActivationJob.new(self.id), 0, schedule_date) + Delayed::Job.enqueue(CommunityTrackPlugin::ActivationJob.new(self.id), :run_at => schedule_date) end end diff --git a/plugins/community_track/lib/community_track_plugin/track.rb b/plugins/community_track/lib/community_track_plugin/track.rb index 2f2f1ea..4aa1d7c 100644 --- a/plugins/community_track/lib/community_track_plugin/track.rb +++ b/plugins/community_track/lib/community_track_plugin/track.rb @@ -5,6 +5,8 @@ class CommunityTrackPlugin::Track < Folder validate :validate_categories + attr_accessible :goals, :expected_results + def validate_categories errors.add(:categories, _('should not be blank.')) if categories.empty? && pending_categorizations.blank? end @@ -48,7 +50,7 @@ class CommunityTrackPlugin::Track < Folder end def comments_count - steps_unsorted.joins(:children).sum('childrens_articles.comments_count') + steps_unsorted.joins(:children).sum('children_articles.comments_count') end def css_class_name @@ -68,8 +70,8 @@ class CommunityTrackPlugin::Track < Folder def to_html(options = {}) track = self - lambda do - render :file => 'content_viewer/track.rhtml', :locals => {:track => track} + proc do + render :file => 'content_viewer/track', :locals => {:track => track} end end diff --git a/plugins/community_track/lib/community_track_plugin/track_list_block.rb b/plugins/community_track/lib/community_track_plugin/track_list_block.rb index d664984..8cce31b 100644 --- a/plugins/community_track/lib/community_track_plugin/track_list_block.rb +++ b/plugins/community_track/lib/community_track_plugin/track_list_block.rb @@ -48,8 +48,8 @@ class CommunityTrackPlugin::TrackListBlock < Block def content(args={}) block = self - lambda do - render :file => 'blocks/track_list.rhtml', :locals => {:block => block} + proc do + render :file => 'blocks/track_list', :locals => {:block => block} end end @@ -60,7 +60,7 @@ class CommunityTrackPlugin::TrackListBlock < Block def footer block = self return nil if !has_page?(2) - lambda do + proc do render :partial => 'blocks/track_list_more', :locals => {:block => block, :page => 2, :per_page => block.limit} end end 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 151f409..8f13670 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 @@ -88,7 +88,7 @@ class ContentViewerControllerTest < ActionController::TestCase should 'render a div with block id for track list block' do box = fast_create(Box, :owner_id => @profile.id, :owner_type => @profile.class.name) - @block = CommunityTrackPlugin::TrackListBlock.create!(:box => box) + @block = create(CommunityTrackPlugin::TrackListBlock, :box => box) @profile.boxes << box get :view_page, @step.url assert_tag :tag => 'div', :attributes => { :class => 'track_list', :id => "track_list_#{@block.id}" } @@ -96,7 +96,7 @@ class ContentViewerControllerTest < ActionController::TestCase should 'render a div with block id for track card list block' do box = fast_create(Box, :owner_id => @profile.id, :owner_type => @profile.class.name) - @block = CommunityTrackPlugin::TrackCardListBlock.create!(:box => box) + @block = create(CommunityTrackPlugin::TrackCardListBlock, :box => box) @profile.boxes << box get :view_page, @step.url assert_tag :tag => 'div', :attributes => { :class => 'track_list', :id => "track_list_#{@block.id}" } @@ -104,7 +104,7 @@ class ContentViewerControllerTest < ActionController::TestCase should 'render tracks in track list block' do box = fast_create(Box, :owner_id => @profile.id, :owner_type => @profile.class.name) - @block = CommunityTrackPlugin::TrackListBlock.create!(:box => box) + @block = create(CommunityTrackPlugin::TrackListBlock, :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 => 'span', :attributes => { :class => "step #{@block.status_class(@step)}" } } } @@ -112,7 +112,7 @@ class ContentViewerControllerTest < ActionController::TestCase should 'render tracks in track card list block' do box = fast_create(Box, :owner_id => @profile.id, :owner_type => @profile.class.name) - @block = CommunityTrackPlugin::TrackCardListBlock.create!(:box => box) + @block = create(CommunityTrackPlugin::TrackCardListBlock, :box => box) @profile.boxes << box get :view_page, @step.url assert_tag :tag => 'div', :attributes => { :class => "item_card category_#{@track.category_name}" }, :descendant => { :tag => 'div', :attributes => { :class => 'track_content' } } @@ -121,7 +121,7 @@ class ContentViewerControllerTest < ActionController::TestCase should 'render link to display more tracks in track list block' do box = fast_create(Box, :owner_id => @profile.id, :owner_type => @profile.class.name) - @block = CommunityTrackPlugin::TrackCardListBlock.create!(:box => box) + @block = create(CommunityTrackPlugin::TrackCardListBlock, :box => box) @profile.boxes << box (@block.limit+1).times { |i| create_track("track#{i}", @profile) } @@ -132,7 +132,7 @@ class ContentViewerControllerTest < ActionController::TestCase should 'render link to show all tracks in track list block' do box = fast_create(Box, :owner_id => @profile.id, :owner_type => @profile.class.name) - @block = CommunityTrackPlugin::TrackCardListBlock.create!(:box => box) + @block = create(CommunityTrackPlugin::TrackCardListBlock, :box => box) @profile.boxes << box @block.more_another_page = true @block.save! diff --git a/plugins/community_track/test/functional/community_track_plugin_environment_design_controller_test.rb b/plugins/community_track/test/functional/community_track_plugin_environment_design_controller_test.rb index 2d30668..fe69082 100644 --- a/plugins/community_track/test/functional/community_track_plugin_environment_design_controller_test.rb +++ b/plugins/community_track/test/functional/community_track_plugin_environment_design_controller_test.rb @@ -15,9 +15,9 @@ class EnvironmentDesignControllerTest < ActionController::TestCase @environment.add_admin(user.person) login_as(user.login) - box = Box.create!(:owner => @environment) - @block = CommunityTrackPlugin::TrackListBlock.create!(:box => box) - @block_card = CommunityTrackPlugin::TrackCardListBlock.create!(:box => box) + box = create(Box, :owner => @environment) + @block = create(CommunityTrackPlugin::TrackListBlock, :box => box) + @block_card = create(CommunityTrackPlugin::TrackCardListBlock, :box => box) end should 'be able to edit TrackListBlock' do diff --git a/plugins/community_track/test/functional/community_track_plugin_public_controller_test.rb b/plugins/community_track/test/functional/community_track_plugin_public_controller_test.rb index 18e9359..40f19ea 100644 --- a/plugins/community_track/test/functional/community_track_plugin_public_controller_test.rb +++ b/plugins/community_track/test/functional/community_track_plugin_public_controller_test.rb @@ -11,8 +11,8 @@ class CommunityTrackPluginPublicControllerTest < ActionController::TestCase @track = create_track('track', @community) box = fast_create(Box, :owner_id => @community.id, :owner_type => 'Community') - @card_block = CommunityTrackPlugin::TrackCardListBlock.create!(:box => box) - @block = CommunityTrackPlugin::TrackListBlock.create!(:box => box) + @card_block = create(CommunityTrackPlugin::TrackCardListBlock, :box => box) + @block = create(CommunityTrackPlugin::TrackListBlock, :box => box) end should 'display tracks for card block' do diff --git a/plugins/community_track/test/unit/community_track_plugin/step_test.rb b/plugins/community_track/test/unit/community_track_plugin/step_test.rb index 7f545ea..00f298b 100644 --- a/plugins/community_track/test/unit/community_track_plugin/step_test.rb +++ b/plugins/community_track/test/unit/community_track_plugin/step_test.rb @@ -4,7 +4,7 @@ class StepTest < ActiveSupport::TestCase def setup @profile = fast_create(Community) - @track = CommunityTrackPlugin::Track.new(:profile_id => @profile.id, :name => 'track') + @track = CommunityTrackPlugin::Track.new(:profile => @profile, :name => 'track') @category = fast_create(Category) @track.add_category(@category) @track.save! @@ -61,13 +61,13 @@ class StepTest < ActiveSupport::TestCase should 'do not validate date period if start date is nil' do @step.start_date = nil @step.end_date_equal_or_after_start_date.inspect - assert [], @step.errors + assert @step.errors.empty? end should 'do not validate date period if end date is nil' do @step.end_date = nil @step.end_date_equal_or_after_start_date.inspect - assert [], @step.errors + assert @step.errors.empty? end should 'be active if today is between start and end dates' do diff --git a/plugins/community_track/test/unit/community_track_plugin/track_card_list_block_test.rb b/plugins/community_track/test/unit/community_track_plugin/track_card_list_block_test.rb index 2bfa47f..c8fc228 100644 --- a/plugins/community_track/test/unit/community_track_plugin/track_card_list_block_test.rb +++ b/plugins/community_track/test/unit/community_track_plugin/track_card_list_block_test.rb @@ -5,7 +5,7 @@ class TrackCardListBlockTest < ActiveSupport::TestCase def setup @community = fast_create(Community) box = fast_create(Box, :owner_id => @community.id, :owner_type => @community.class.name) - @block = CommunityTrackPlugin::TrackCardListBlock.create!(:box => box) + @block = create(CommunityTrackPlugin::TrackCardListBlock, :box => box) end should 'describe yourself' do diff --git a/plugins/community_track/test/unit/community_track_plugin/track_list_block_test.rb b/plugins/community_track/test/unit/community_track_plugin/track_list_block_test.rb index d47edf2..864dd2d 100644 --- a/plugins/community_track/test/unit/community_track_plugin/track_list_block_test.rb +++ b/plugins/community_track/test/unit/community_track_plugin/track_list_block_test.rb @@ -6,7 +6,7 @@ class TrackListBlockTest < ActiveSupport::TestCase @profile = fast_create(Community) @track = create_track('track', profile) box = fast_create(Box, :owner_id => @profile.id, :owner_type => @profile.class.name) - @block = CommunityTrackPlugin::TrackListBlock.create!(:box => box) + @block = create(CommunityTrackPlugin::TrackListBlock, :box => box) end attr_reader :profile @@ -31,7 +31,7 @@ class TrackListBlockTest < ActiveSupport::TestCase should 'list of articles be limited by block configuration' do (@block.limit + 1).times { |i| create_track("track#{i}", profile) } - assert_equal @block.limit, @block.tracks.count + assert_equal @block.limit, @block.tracks.size end should 'return more link if has more tracks to show' do diff --git a/plugins/community_track/test/unit/community_track_plugin/track_test.rb b/plugins/community_track/test/unit/community_track_plugin/track_test.rb index d939824..ce4602d 100644 --- a/plugins/community_track/test/unit/community_track_plugin/track_test.rb +++ b/plugins/community_track/test/unit/community_track_plugin/track_test.rb @@ -130,13 +130,13 @@ class TrackTest < ActiveSupport::TestCase should 'not be able to create a track without category' do track = CommunityTrackPlugin::Track.create(:profile => @profile, :name => 'track') - assert track.errors.invalid?(:categories) + assert track.errors.include?(:categories) end should 'not be able to save a track without category' do @track.categories.delete_all @track.save - assert @track.errors.invalid?(:categories) + assert @track.errors.include?(:categories) end end diff --git a/plugins/community_track/views/blocks/_track.html.erb b/plugins/community_track/views/blocks/_track.html.erb new file mode 100644 index 0000000..e0a14ac --- /dev/null +++ b/plugins/community_track/views/blocks/_track.html.erb @@ -0,0 +1,26 @@ +<% extend CommunityTrackPlugin::TrackHelper %> +<% extend CommunityTrackPlugin::StepHelper %> +
+
+
+

<%= link_to track.name, track.url %>

+
+ <%= track.lead %> +
+
+
+

<%= _("Steps") %>

+ <% track.steps.each do |step| %> + <%= link_to_step(step) do %> + + <%= step.position %> + <%= status_description(step) %> + + <%= step.name %> + + <% end %> + <% end %> +
+
+
+
diff --git a/plugins/community_track/views/blocks/_track.rhtml b/plugins/community_track/views/blocks/_track.rhtml deleted file mode 100644 index 76bea50..0000000 --- a/plugins/community_track/views/blocks/_track.rhtml +++ /dev/null @@ -1,26 +0,0 @@ -<% extend CommunityTrackPlugin::TrackHelper %> -<% extend CommunityTrackPlugin::StepHelper %> -
-
-
-

<%= link_to track.name, track.url %>

-
- <%= track.lead %> -
-
-
-

<%= _("Steps") %>

- <% track.steps.each do |step| %> - <% link_to_step(step) do %> - - <%= step.position %> - <%= status_description(step) %> - - <%= step.name %> - - <% end %> - <% end %> -
-
-
-
diff --git a/plugins/community_track/views/blocks/_track_card.html.erb b/plugins/community_track/views/blocks/_track_card.html.erb new file mode 100644 index 0000000..bde884e --- /dev/null +++ b/plugins/community_track/views/blocks/_track_card.html.erb @@ -0,0 +1,29 @@ +<% extend CommunityTrackPlugin::TrackHelper %> +
+ +
+
+ <%= track_card.category_name %> +
+
+ <%= image_tag track_card.image.public_filename if track_card.image %> +
+
+ <%= track_card.name %> +
+
+ <%= track_card_lead(track_card) %> +
+
+
+
+ <%= "#{track_card.comments_count}" %> + <%= _('comments') %> +
+
+ <%= "#{track_card.hits}" %> + <%= _('hits') %> +
+
+
+
diff --git a/plugins/community_track/views/blocks/_track_card.rhtml b/plugins/community_track/views/blocks/_track_card.rhtml deleted file mode 100644 index bde884e..0000000 --- a/plugins/community_track/views/blocks/_track_card.rhtml +++ /dev/null @@ -1,29 +0,0 @@ -<% extend CommunityTrackPlugin::TrackHelper %> -
- -
-
- <%= track_card.category_name %> -
-
- <%= image_tag track_card.image.public_filename if track_card.image %> -
-
- <%= track_card.name %> -
-
- <%= track_card_lead(track_card) %> -
-
-
-
- <%= "#{track_card.comments_count}" %> - <%= _('comments') %> -
-
- <%= "#{track_card.hits}" %> - <%= _('hits') %> -
-
-
-
diff --git a/plugins/community_track/views/blocks/_track_list_more.html.erb b/plugins/community_track/views/blocks/_track_list_more.html.erb new file mode 100644 index 0000000..41755b6 --- /dev/null +++ b/plugins/community_track/views/blocks/_track_list_more.html.erb @@ -0,0 +1,12 @@ +<% force_same_page ||= false %> +
+ <% if block.more_another_page && !force_same_page %> +
+ <%= link_to _('View All'), :id => block.id, :controller => 'community_track_plugin_public', :action => 'all_tracks' %> +
+ <% else %> +
+ <%= link_to_remote(_('More'), :url => {:id => block.id, :controller => 'community_track_plugin_public', :action => 'view_tracks', :page => page, :per_page => per_page, :force_same_page => force_same_page}, :loaded => visual_effect(:highlight, "track_card_list_#{block.id}")) %> +
+ <% end %> +
diff --git a/plugins/community_track/views/blocks/_track_list_more.rhtml b/plugins/community_track/views/blocks/_track_list_more.rhtml deleted file mode 100644 index 41755b6..0000000 --- a/plugins/community_track/views/blocks/_track_list_more.rhtml +++ /dev/null @@ -1,12 +0,0 @@ -<% force_same_page ||= false %> -
- <% if block.more_another_page && !force_same_page %> -
- <%= link_to _('View All'), :id => block.id, :controller => 'community_track_plugin_public', :action => 'all_tracks' %> -
- <% else %> -
- <%= link_to_remote(_('More'), :url => {:id => block.id, :controller => 'community_track_plugin_public', :action => 'view_tracks', :page => page, :per_page => per_page, :force_same_page => force_same_page}, :loaded => visual_effect(:highlight, "track_card_list_#{block.id}")) %> -
- <% end %> -
diff --git a/plugins/community_track/views/blocks/track_list.html.erb b/plugins/community_track/views/blocks/track_list.html.erb new file mode 100644 index 0000000..713b1dd --- /dev/null +++ b/plugins/community_track/views/blocks/track_list.html.erb @@ -0,0 +1,6 @@ +<%= block_title(block.title) %> + +
+ <%= render :partial => "blocks/#{block.track_partial}", :collection => block.tracks, :locals => {:block => block} %> +
+
diff --git a/plugins/community_track/views/blocks/track_list.rhtml b/plugins/community_track/views/blocks/track_list.rhtml deleted file mode 100644 index 713b1dd..0000000 --- a/plugins/community_track/views/blocks/track_list.rhtml +++ /dev/null @@ -1,6 +0,0 @@ -<%= block_title(block.title) %> - -
- <%= render :partial => "blocks/#{block.track_partial}", :collection => block.tracks, :locals => {:block => block} %> -
-
diff --git a/plugins/community_track/views/box_organizer/community_track_plugin/_track_list_block.html.erb b/plugins/community_track/views/box_organizer/community_track_plugin/_track_list_block.html.erb new file mode 100644 index 0000000..113b86a --- /dev/null +++ b/plugins/community_track/views/box_organizer/community_track_plugin/_track_list_block.html.erb @@ -0,0 +1,6 @@ +
+ <%= labelled_form_field _('Limit of items'), text_field(:block, :limit, :size => 3) %> + <%= labelled_form_field check_box(:block, :more_another_page) + _('Show more at another page'), '' %> + <%= select_categories(:block, _('Select Categories')) %> +
+
diff --git a/plugins/community_track/views/box_organizer/community_track_plugin/_track_list_block.rhtml b/plugins/community_track/views/box_organizer/community_track_plugin/_track_list_block.rhtml deleted file mode 100644 index 113b86a..0000000 --- a/plugins/community_track/views/box_organizer/community_track_plugin/_track_list_block.rhtml +++ /dev/null @@ -1,6 +0,0 @@ -
- <%= labelled_form_field _('Limit of items'), text_field(:block, :limit, :size => 3) %> - <%= labelled_form_field check_box(:block, :more_another_page) + _('Show more at another page'), '' %> - <%= select_categories(:block, _('Select Categories')) %> -
-
diff --git a/plugins/community_track/views/cms/community_track_plugin/_step.html.erb b/plugins/community_track/views/cms/community_track_plugin/_step.html.erb new file mode 100644 index 0000000..a807569 --- /dev/null +++ b/plugins/community_track/views/cms/community_track_plugin/_step.html.erb @@ -0,0 +1,21 @@ +<%= required_fields_message %> + +<%= render :file => 'shared/tiny_mce' %> + +
+ <%= required f.text_field('name', :size => '64', :maxlength => 150) %> + <%= labelled_form_field(_('Period'), ( + date_range_field('article[start_date]', 'article[end_date]', @article.start_date, @article.end_date, + '%Y-%m-%d', + { :change_month => true, :change_year => true, + :date_format => 'yy-mm-dd' }, + { :size => 14 }) + )) %> + + <%= labelled_form_field(_('Tool type'), select(:article, :tool_type, CommunityTrackPlugin::Step.enabled_tools.map {|t| [t.short_description, t.name]} )) %> + <%= hidden_field_tag('success_back_to', url_for(@article.parent.view_url)) %> +
+ +<%= labelled_form_field check_box(:article, :hidden) + _('Hidden Step'), '' %> + +<%= render :partial => 'shared/lead_and_body', :locals => {:tiny_mce => true, :body_label => 'Description:'} %> diff --git a/plugins/community_track/views/cms/community_track_plugin/_step.rhtml b/plugins/community_track/views/cms/community_track_plugin/_step.rhtml deleted file mode 100644 index a807569..0000000 --- a/plugins/community_track/views/cms/community_track_plugin/_step.rhtml +++ /dev/null @@ -1,21 +0,0 @@ -<%= required_fields_message %> - -<%= render :file => 'shared/tiny_mce' %> - -
- <%= required f.text_field('name', :size => '64', :maxlength => 150) %> - <%= labelled_form_field(_('Period'), ( - date_range_field('article[start_date]', 'article[end_date]', @article.start_date, @article.end_date, - '%Y-%m-%d', - { :change_month => true, :change_year => true, - :date_format => 'yy-mm-dd' }, - { :size => 14 }) - )) %> - - <%= labelled_form_field(_('Tool type'), select(:article, :tool_type, CommunityTrackPlugin::Step.enabled_tools.map {|t| [t.short_description, t.name]} )) %> - <%= hidden_field_tag('success_back_to', url_for(@article.parent.view_url)) %> -
- -<%= labelled_form_field check_box(:article, :hidden) + _('Hidden Step'), '' %> - -<%= render :partial => 'shared/lead_and_body', :locals => {:tiny_mce => true, :body_label => 'Description:'} %> diff --git a/plugins/community_track/views/cms/community_track_plugin/_track.html.erb b/plugins/community_track/views/cms/community_track_plugin/_track.html.erb new file mode 100644 index 0000000..cfd2ff4 --- /dev/null +++ b/plugins/community_track/views/cms/community_track_plugin/_track.html.erb @@ -0,0 +1,16 @@ +
+ <%= required_fields_message %> + + <%= render :file => 'shared/tiny_mce' %> + +
+ <%= required labelled_form_field(_('Title'), text_field(:article, 'name', :size => '64', :maxlength => 150)) %> +
+ + <%= render :partial => 'shared/lead_and_body', :locals => {:tiny_mce => true, :body_label => 'Description:'} %> + +
+ <%= labelled_form_field(_('Goals:'), text_area(:article, :goals, :rows => 3, :cols => 64)) %> + <%= labelled_form_field(_('Expected Results:'), text_area(:article, :expected_results, :rows => 3, :cols => 64)) %> +
+
diff --git a/plugins/community_track/views/cms/community_track_plugin/_track.rhtml b/plugins/community_track/views/cms/community_track_plugin/_track.rhtml deleted file mode 100644 index cfd2ff4..0000000 --- a/plugins/community_track/views/cms/community_track_plugin/_track.rhtml +++ /dev/null @@ -1,16 +0,0 @@ -
- <%= required_fields_message %> - - <%= render :file => 'shared/tiny_mce' %> - -
- <%= required labelled_form_field(_('Title'), text_field(:article, 'name', :size => '64', :maxlength => 150)) %> -
- - <%= render :partial => 'shared/lead_and_body', :locals => {:tiny_mce => true, :body_label => 'Description:'} %> - -
- <%= labelled_form_field(_('Goals:'), text_area(:article, :goals, :rows => 3, :cols => 64)) %> - <%= labelled_form_field(_('Expected Results:'), text_area(:article, :expected_results, :rows => 3, :cols => 64)) %> -
-
diff --git a/plugins/community_track/views/community_track_plugin_public/all_tracks.html.erb b/plugins/community_track/views/community_track_plugin_public/all_tracks.html.erb new file mode 100644 index 0000000..3cc50bf --- /dev/null +++ b/plugins/community_track/views/community_track_plugin_public/all_tracks.html.erb @@ -0,0 +1,10 @@ +

<%= _('Tracks') %>

+
+
+ <%= render :partial => "blocks/#{@block.track_partial}", :collection => @tracks, :locals => {:block => @block} %> +
+
+ <% if @show_more %> + <%= render :partial => "blocks/track_list_more", :locals => {:block => @block, :force_same_page => true, :page => 2, :per_page => @per_page} %> + <% end %> +
diff --git a/plugins/community_track/views/community_track_plugin_public/all_tracks.rhtml b/plugins/community_track/views/community_track_plugin_public/all_tracks.rhtml deleted file mode 100644 index 3cc50bf..0000000 --- a/plugins/community_track/views/community_track_plugin_public/all_tracks.rhtml +++ /dev/null @@ -1,10 +0,0 @@ -

<%= _('Tracks') %>

-
-
- <%= render :partial => "blocks/#{@block.track_partial}", :collection => @tracks, :locals => {:block => @block} %> -
-
- <% if @show_more %> - <%= render :partial => "blocks/track_list_more", :locals => {:block => @block, :force_same_page => true, :page => 2, :per_page => @per_page} %> - <% end %> -
diff --git a/plugins/community_track/views/community_track_plugin_public/select_community.html.erb b/plugins/community_track/views/community_track_plugin_public/select_community.html.erb new file mode 100644 index 0000000..6e38aea --- /dev/null +++ b/plugins/community_track/views/community_track_plugin_public/select_community.html.erb @@ -0,0 +1,41 @@ +
+ +

<%= _('Select Community') %>

+ +<% if !@failed.blank? %> +
+
+ <% @failed.each do |error|%> + <%= error %> + <% end %> +
+
+<% end %> + +<% button_bar do %> + <%= button(:add, _('Create a new community'), :controller => 'memberships', :action => 'new_community', :profile => user.identifier, :back_to => @back_to) %> +<% end %> + +<%= form_tag({:controller => 'community_track_plugin_public', :action => 'select_community', :profile => user.identifier}) do %> + +
+
+ <%= submit_button :save, _('New Track') %> +<% end %> +
diff --git a/plugins/community_track/views/community_track_plugin_public/select_community.rhtml b/plugins/community_track/views/community_track_plugin_public/select_community.rhtml deleted file mode 100644 index 47692dd..0000000 --- a/plugins/community_track/views/community_track_plugin_public/select_community.rhtml +++ /dev/null @@ -1,41 +0,0 @@ -
- -

<%= _('Select Community') %>

- -<% if !@failed.blank? %> -
-
- <% @failed.each do |error|%> - <%= error %> - <% end %> -
-
-<% end %> - -<% button_bar do %> - <%= button(:add, __('Create a new community'), :controller => 'memberships', :action => 'new_community', :profile => user.identifier, :back_to => @back_to) %> -<% end %> - -<% form_tag({:controller => 'community_track_plugin_public', :action => 'select_community', :profile => user.identifier}) do %> - -
-
- <%= submit_button :save, _('New Track') %> -<% end %> -
diff --git a/plugins/community_track/views/content_viewer/_step_item.html.erb b/plugins/community_track/views/content_viewer/_step_item.html.erb new file mode 100644 index 0000000..386222a --- /dev/null +++ b/plugins/community_track/views/content_viewer/_step_item.html.erb @@ -0,0 +1,41 @@ +
  • + <%= hidden_field_tag "step_ids[]", step_item.id %> + +
    + <% 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 %> + <% 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 %> +
    +
  • diff --git a/plugins/community_track/views/content_viewer/_step_item.rhtml b/plugins/community_track/views/content_viewer/_step_item.rhtml deleted file mode 100644 index ee0d0f2..0000000 --- a/plugins/community_track/views/content_viewer/_step_item.rhtml +++ /dev/null @@ -1,41 +0,0 @@ -
  • - <%= hidden_field_tag "step_ids[]", step_item.id %> - -
    - <% 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 %> - <% 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 %> -
    -
  • diff --git a/plugins/community_track/views/content_viewer/step.html.erb b/plugins/community_track/views/content_viewer/step.html.erb new file mode 100644 index 0000000..53c3b3f --- /dev/null +++ b/plugins/community_track/views/content_viewer/step.html.erb @@ -0,0 +1,28 @@ +
    +
    +
      +
    • + <%= _('When:') %><%= show_period(step.start_date, step.end_date) %> +
    • +
    +
    +
    + <%= step.body %> +
    + <% if step.allow_create?(user) && !step.tool && step.tool_class %> +

    <%= _("Tool") %>

    + + <% end %> + <% if step.tool %> +

    <%= _("Tool") %>

    +
    +
    +
    + <%= link_to(step.tool.name, step.tool.view_url, :class=>"button with-text icon-new icon-new#{step.tool.class.icon_name}") %> +
    +
    +
    + <% end %> +
    diff --git a/plugins/community_track/views/content_viewer/step.rhtml b/plugins/community_track/views/content_viewer/step.rhtml deleted file mode 100644 index 53c3b3f..0000000 --- a/plugins/community_track/views/content_viewer/step.rhtml +++ /dev/null @@ -1,28 +0,0 @@ -
    -
    -
      -
    • - <%= _('When:') %><%= show_period(step.start_date, step.end_date) %> -
    • -
    -
    -
    - <%= step.body %> -
    - <% if step.allow_create?(user) && !step.tool && step.tool_class %> -

    <%= _("Tool") %>

    - - <% end %> - <% if step.tool %> -

    <%= _("Tool") %>

    -
    -
    -
    - <%= link_to(step.tool.name, step.tool.view_url, :class=>"button with-text icon-new icon-new#{step.tool.class.icon_name}") %> -
    -
    -
    - <% end %> -
    diff --git a/plugins/community_track/views/content_viewer/track.html.erb b/plugins/community_track/views/content_viewer/track.html.erb new file mode 100644 index 0000000..5b4e958 --- /dev/null +++ b/plugins/community_track/views/content_viewer/track.html.erb @@ -0,0 +1,42 @@ +<% extend CommunityTrackPlugin::StepHelper %> + +<%= form_tag({:controller => 'community_track_plugin_myprofile', :action => 'save_order', :track => track}) do %> +
    +
    + <%= track.body %> +
    + +

    <%= _("Steps") %>

    + + <% if track.allow_create?(user) %> +
    + <%= content_tag('a', :href => url_for({:controller => 'cms', :action => 'new', :type => "CommunityTrackPlugin::Step", :parent_id => track.id}), :class => 'button with-text icon-add') do %> + <%= _("New %s") % CommunityTrackPlugin::Step.short_description %> + <% end %> + <%= _('Reorder Steps') %> + <%= submit_button :save, _('Save Order'), :class => "save_button" %> +
    + + <% end %> + + + <% if track.allow_create?(user) && !track.hidden_steps.empty? %> +
    +

    <%= _('Hidden Steps') %>

    +
      + <%= render :partial => 'step_item', :collection => track.hidden_steps %> +
    +
    + <% end %> +
    +<% end %> diff --git a/plugins/community_track/views/content_viewer/track.rhtml b/plugins/community_track/views/content_viewer/track.rhtml deleted file mode 100644 index be2c0fa..0000000 --- a/plugins/community_track/views/content_viewer/track.rhtml +++ /dev/null @@ -1,42 +0,0 @@ -<% extend CommunityTrackPlugin::StepHelper %> - -<% form_tag({:controller => 'community_track_plugin_myprofile', :action => 'save_order', :track => track}) do %> -
    -
    - <%= track.body %> -
    - -

    <%= _("Steps") %>

    - - <% if track.allow_create?(user) %> -
    - <% content_tag('a', :href => url_for({:controller => 'cms', :action => 'new', :type => "CommunityTrackPlugin::Step", :parent_id => track.id}), :class => 'button with-text icon-add') do %> - <%= _("New %s") % CommunityTrackPlugin::Step.short_description %> - <% end %> - <%= _('Reorder Steps') %> - <%= submit_button :save, _('Save Order'), :class => "save_button" %> -
    - - <% end %> - - - <% if track.allow_create?(user) && !track.hidden_steps.empty? %> -
    -

    <%= _('Hidden Steps') %>

    -
      - <%= render :partial => 'step_item', :collection => track.hidden_steps %> -
    -
    - <% end %> -
    -<% end %> -- libgit2 0.21.2