Commit e579c8150f4c3d2d59ff09becca374e1512a2c38
1 parent
316ad8fb
Exists in
master
and in
28 other branches
Added new db/schema
Also: - removed whitespaces - added class with plugin name to style a view (ActionItem2837)
Showing
19 changed files
with
66 additions
and
54 deletions
Show diff stats
app/views/memberships/new_community.rhtml
@@ -45,7 +45,7 @@ | @@ -45,7 +45,7 @@ | ||
45 | </div> | 45 | </div> |
46 | 46 | ||
47 | <%= template_options(Community, 'community')%> | 47 | <%= template_options(Community, 'community')%> |
48 | - | 48 | + |
49 | <%= hidden_field_tag('back_to', @back_to) %> | 49 | <%= hidden_field_tag('back_to', @back_to) %> |
50 | 50 | ||
51 | <% button_bar do %> | 51 | <% button_bar do %> |
db/schema.rb
@@ -86,6 +86,8 @@ ActiveRecord::Schema.define(:version => 20131116165327) do | @@ -86,6 +86,8 @@ ActiveRecord::Schema.define(:version => 20131116165327) do | ||
86 | t.string "language" | 86 | t.string "language" |
87 | t.string "source_name" | 87 | t.string "source_name" |
88 | t.integer "license_id" | 88 | t.integer "license_id" |
89 | + t.integer "image_id" | ||
90 | + t.integer "position" | ||
89 | end | 91 | end |
90 | 92 | ||
91 | add_index "article_versions", ["article_id"], :name => "index_article_versions_on_article_id" | 93 | add_index "article_versions", ["article_id"], :name => "index_article_versions_on_article_id" |
@@ -129,6 +131,8 @@ ActiveRecord::Schema.define(:version => 20131116165327) do | @@ -129,6 +131,8 @@ ActiveRecord::Schema.define(:version => 20131116165327) do | ||
129 | t.string "language" | 131 | t.string "language" |
130 | t.string "source_name" | 132 | t.string "source_name" |
131 | t.integer "license_id" | 133 | t.integer "license_id" |
134 | + t.integer "image_id" | ||
135 | + t.integer "position" | ||
132 | end | 136 | end |
133 | 137 | ||
134 | add_index "articles", ["name"], :name => "index_articles_on_name" | 138 | add_index "articles", ["name"], :name => "index_articles_on_name" |
plugins/community_track/controllers/myprofile/community_track_plugin_myprofile_controller.rb
1 | class CommunityTrackPluginMyprofileController < MyProfileController | 1 | class CommunityTrackPluginMyprofileController < MyProfileController |
2 | append_view_path File.join(File.dirname(__FILE__) + '/../../views') | 2 | append_view_path File.join(File.dirname(__FILE__) + '/../../views') |
3 | - | 3 | + |
4 | before_filter :allow_edit_track, :only => :save_order | 4 | before_filter :allow_edit_track, :only => :save_order |
5 | 5 | ||
6 | def save_order | 6 | def save_order |
plugins/community_track/controllers/public/community_track_plugin_public_controller.rb
@@ -15,7 +15,7 @@ class CommunityTrackPluginPublicController < PublicController | @@ -15,7 +15,7 @@ class CommunityTrackPluginPublicController < PublicController | ||
15 | 15 | ||
16 | render :update do |page| | 16 | render :update do |page| |
17 | page.insert_html :bottom, "track_list_#{block.id}", :partial => "blocks/#{block.track_partial}", :collection => tracks, :locals => {:block => block} | 17 | page.insert_html :bottom, "track_list_#{block.id}", :partial => "blocks/#{block.track_partial}", :collection => tracks, :locals => {:block => block} |
18 | - | 18 | + |
19 | if block.has_page?(p+1, per_page) | 19 | if block.has_page?(p+1, per_page) |
20 | page.replace_html "track_list_more_#{block.id}", :partial => 'blocks/track_list_more', :locals => {:block => block, :page => p+1, :force_same_page => params[:force_same_page], :per_page => per_page} | 20 | page.replace_html "track_list_more_#{block.id}", :partial => 'blocks/track_list_more', :locals => {:block => block, :page => p+1, :force_same_page => params[:force_same_page], :per_page => per_page} |
21 | else | 21 | else |
@@ -37,8 +37,8 @@ class CommunityTrackPluginPublicController < PublicController | @@ -37,8 +37,8 @@ class CommunityTrackPluginPublicController < PublicController | ||
37 | if request.post? | 37 | if request.post? |
38 | community_identifier = params[:community_identifier] | 38 | community_identifier = params[:community_identifier] |
39 | if community_identifier.nil? | 39 | if community_identifier.nil? |
40 | - @failed = [_('Select one community to proceed')] | ||
41 | - else | 40 | + @failed = [_('Select one community to proceed')] |
41 | + else | ||
42 | redirect_to :controller => 'cms', :action => 'new', :type => "CommunityTrackPlugin::Track", :profile => community_identifier | 42 | redirect_to :controller => 'cms', :action => 'new', :type => "CommunityTrackPlugin::Track", :profile => community_identifier |
43 | end | 43 | end |
44 | end | 44 | end |
plugins/community_track/lib/community_track_plugin.rb
@@ -15,7 +15,7 @@ class CommunityTrackPlugin < Noosfero::Plugin | @@ -15,7 +15,7 @@ class CommunityTrackPlugin < Noosfero::Plugin | ||
15 | def content_types | 15 | def content_types |
16 | if context.respond_to?(:params) && context.params | 16 | if context.respond_to?(:params) && context.params |
17 | types = [] | 17 | types = [] |
18 | - parent_id = context.params[:parent_id] | 18 | + parent_id = context.params[:parent_id] |
19 | types << CommunityTrackPlugin::Track if context.profile.community? && !parent_id | 19 | types << CommunityTrackPlugin::Track if context.profile.community? && !parent_id |
20 | parent = parent_id ? context.profile.articles.find(parent_id) : nil | 20 | parent = parent_id ? context.profile.articles.find(parent_id) : nil |
21 | types << CommunityTrackPlugin::Step if parent.kind_of?(CommunityTrackPlugin::Track) | 21 | types << CommunityTrackPlugin::Step if parent.kind_of?(CommunityTrackPlugin::Track) |
plugins/community_track/lib/community_track_plugin/step.rb
@@ -13,7 +13,7 @@ class CommunityTrackPlugin::Step < Folder | @@ -13,7 +13,7 @@ class CommunityTrackPlugin::Step < Folder | ||
13 | validate :belong_to_track | 13 | validate :belong_to_track |
14 | validates_presence_of :start_date, :end_date | 14 | validates_presence_of :start_date, :end_date |
15 | validate :end_date_equal_or_after_start_date | 15 | validate :end_date_equal_or_after_start_date |
16 | - | 16 | + |
17 | after_save :schedule_activation | 17 | after_save :schedule_activation |
18 | 18 | ||
19 | before_create do |step| | 19 | before_create do |step| |
@@ -23,13 +23,13 @@ class CommunityTrackPlugin::Step < Folder | @@ -23,13 +23,13 @@ class CommunityTrackPlugin::Step < Folder | ||
23 | 23 | ||
24 | before_create :set_hidden_position | 24 | before_create :set_hidden_position |
25 | before_save :set_hidden_position | 25 | before_save :set_hidden_position |
26 | - | 26 | + |
27 | def set_hidden_position | 27 | def set_hidden_position |
28 | if hidden | 28 | if hidden |
29 | decrement_positions_on_lower_items | 29 | decrement_positions_on_lower_items |
30 | self[:position] = 0 | 30 | self[:position] = 0 |
31 | elsif position == 0 | 31 | elsif position == 0 |
32 | - add_to_list_bottom | 32 | + add_to_list_bottom |
33 | end | 33 | end |
34 | end | 34 | end |
35 | 35 | ||
@@ -65,7 +65,7 @@ class CommunityTrackPlugin::Step < Folder | @@ -65,7 +65,7 @@ class CommunityTrackPlugin::Step < Folder | ||
65 | def active? | 65 | def active? |
66 | (start_date..end_date).include?(Date.today) | 66 | (start_date..end_date).include?(Date.today) |
67 | end | 67 | end |
68 | - | 68 | + |
69 | def finished? | 69 | def finished? |
70 | Date.today > end_date | 70 | Date.today > end_date |
71 | end | 71 | end |
plugins/community_track/lib/community_track_plugin/track.rb
1 | class CommunityTrackPlugin::Track < Folder | 1 | class CommunityTrackPlugin::Track < Folder |
2 | - | 2 | + |
3 | settings_items :goals, :type => :string | 3 | settings_items :goals, :type => :string |
4 | settings_items :expected_results, :type => :string | 4 | settings_items :expected_results, :type => :string |
5 | 5 | ||
@@ -32,7 +32,7 @@ class CommunityTrackPlugin::Track < Folder | @@ -32,7 +32,7 @@ class CommunityTrackPlugin::Track < Folder | ||
32 | end | 32 | end |
33 | end | 33 | end |
34 | end | 34 | end |
35 | - | 35 | + |
36 | def steps_unsorted | 36 | def steps_unsorted |
37 | children.where(:type => 'CommunityTrackPlugin::Step') | 37 | children.where(:type => 'CommunityTrackPlugin::Step') |
38 | end | 38 | end |
@@ -59,7 +59,7 @@ class CommunityTrackPlugin::Track < Folder | @@ -59,7 +59,7 @@ class CommunityTrackPlugin::Track < Folder | ||
59 | category = categories.first | 59 | category = categories.first |
60 | category ? category.name : '' | 60 | category ? category.name : '' |
61 | end | 61 | end |
62 | - | 62 | + |
63 | def to_html(options = {}) | 63 | def to_html(options = {}) |
64 | track = self | 64 | track = self |
65 | lambda do | 65 | lambda do |
plugins/community_track/lib/community_track_plugin/track_helper.rb
1 | module CommunityTrackPlugin::TrackHelper | 1 | module CommunityTrackPlugin::TrackHelper |
2 | - | 2 | + |
3 | def category_class(track) | 3 | def category_class(track) |
4 | 'category_' + (track.categories.empty? ? 'not_defined' : track.categories.first.name.to_slug) | 4 | 'category_' + (track.categories.empty? ? 'not_defined' : track.categories.first.name.to_slug) |
5 | end | 5 | end |
plugins/community_track/lib/community_track_plugin/track_list_block.rb
1 | class CommunityTrackPlugin::TrackListBlock < Block | 1 | class CommunityTrackPlugin::TrackListBlock < Block |
2 | 2 | ||
3 | include CommunityTrackPlugin::StepHelper | 3 | include CommunityTrackPlugin::StepHelper |
4 | - | 4 | + |
5 | settings_items :limit, :type => :integer, :default => 3 | 5 | settings_items :limit, :type => :integer, :default => 3 |
6 | settings_items :more_another_page, :type => :boolean, :default => false | 6 | settings_items :more_another_page, :type => :boolean, :default => false |
7 | settings_items :category_ids, :type => Array, :default => [] | 7 | settings_items :category_ids, :type => Array, :default => [] |
@@ -33,7 +33,7 @@ class CommunityTrackPlugin::TrackListBlock < Block | @@ -33,7 +33,7 @@ class CommunityTrackPlugin::TrackListBlock < Block | ||
33 | def category_ids=(ids) | 33 | def category_ids=(ids) |
34 | settings[:category_ids] = ids.uniq.map{|item| item.to_i unless item.to_i.zero?}.compact | 34 | settings[:category_ids] = ids.uniq.map{|item| item.to_i unless item.to_i.zero?}.compact |
35 | end | 35 | end |
36 | - | 36 | + |
37 | def all_tracks | 37 | def all_tracks |
38 | tracks = owner.articles.where(:type => 'CommunityTrackPlugin::Track') | 38 | tracks = owner.articles.where(:type => 'CommunityTrackPlugin::Track') |
39 | if !category_ids.empty? | 39 | if !category_ids.empty? |
plugins/community_track/public/style.css
1 | -.icon-newcommunity-track { | 1 | +.icon-newcommunity-track, |
2 | +.icon-community-track { | ||
2 | background-image: url(/plugins/community_track/icons/community-track.png) | 3 | background-image: url(/plugins/community_track/icons/community-track.png) |
3 | } | 4 | } |
4 | 5 | ||
@@ -188,3 +189,7 @@ | @@ -188,3 +189,7 @@ | ||
188 | #step .tools .item .name a:hover { | 189 | #step .tools .item .name a:hover { |
189 | color: #888; | 190 | color: #888; |
190 | } | 191 | } |
192 | + | ||
193 | +.community-track textarea { | ||
194 | + width: 100%; | ||
195 | +} |
plugins/community_track/test/functional/community_track_plugin_content_viewer_controller_test.rb
@@ -2,13 +2,13 @@ require File.dirname(__FILE__) + '/../test_helper' | @@ -2,13 +2,13 @@ require File.dirname(__FILE__) + '/../test_helper' | ||
2 | 2 | ||
3 | class ContentViewerController | 3 | class ContentViewerController |
4 | append_view_path File.join(File.dirname(__FILE__) + '/../../views') | 4 | append_view_path File.join(File.dirname(__FILE__) + '/../../views') |
5 | - def rescue_action(e) | ||
6 | - raise e | ||
7 | - end | 5 | + def rescue_action(e) |
6 | + raise e | ||
7 | + end | ||
8 | end | 8 | end |
9 | 9 | ||
10 | class ContentViewerControllerTest < ActionController::TestCase | 10 | class ContentViewerControllerTest < ActionController::TestCase |
11 | - | 11 | + |
12 | def setup | 12 | def setup |
13 | @profile = fast_create(Community) | 13 | @profile = fast_create(Community) |
14 | @track = CommunityTrackPlugin::Track.create!(:abstract => 'abstract', :body => 'body', :name => 'track', :profile => @profile) | 14 | @track = CommunityTrackPlugin::Track.create!(:abstract => 'abstract', :body => 'body', :name => 'track', :profile => @profile) |
plugins/community_track/test/functional/community_track_plugin_public_controller_test.rb
@@ -40,7 +40,7 @@ class CommunityTrackPluginPublicControllerTest < ActionController::TestCase | @@ -40,7 +40,7 @@ class CommunityTrackPluginPublicControllerTest < ActionController::TestCase | ||
40 | xhr :get, :view_tracks, :id => @block.id, :page => 1 | 40 | xhr :get, :view_tracks, :id => @block.id, :page => 1 |
41 | assert_equal @block.limit, @response.body.scan(/item/).size | 41 | assert_equal @block.limit, @response.body.scan(/item/).size |
42 | end | 42 | end |
43 | - | 43 | + |
44 | should 'display page for all tracks' do | 44 | should 'display page for all tracks' do |
45 | get :all_tracks, :id => @block.id | 45 | get :all_tracks, :id => @block.id |
46 | assert_match /track_list_#{@block.id}/, @response.body | 46 | assert_match /track_list_#{@block.id}/, @response.body |
plugins/community_track/test/unit/community_track_plugin/step_helper_test.rb
1 | require File.dirname(__FILE__) + '/../../test_helper' | 1 | require File.dirname(__FILE__) + '/../../test_helper' |
2 | 2 | ||
3 | class StepHelperTest < ActiveSupport::TestCase | 3 | class StepHelperTest < ActiveSupport::TestCase |
4 | - | 4 | + |
5 | include CommunityTrackPlugin::StepHelper | 5 | include CommunityTrackPlugin::StepHelper |
6 | 6 | ||
7 | def setup | 7 | def setup |
plugins/community_track/test/unit/community_track_plugin/step_test.rb
@@ -16,7 +16,7 @@ class StepTest < ActiveSupport::TestCase | @@ -16,7 +16,7 @@ class StepTest < ActiveSupport::TestCase | ||
16 | should 'has a short description' do | 16 | should 'has a short description' do |
17 | assert CommunityTrackPlugin::Step.short_description | 17 | assert CommunityTrackPlugin::Step.short_description |
18 | end | 18 | end |
19 | - | 19 | + |
20 | should 'set published to false on create' do | 20 | should 'set published to false on create' do |
21 | today = Date.today | 21 | today = Date.today |
22 | step = CommunityTrackPlugin::Step.create(:name => 'Step', :body => 'body', :profile => @profile, :parent => @track, :start_date => today, :end_date => today, :published => true) | 22 | step = CommunityTrackPlugin::Step.create(:name => 'Step', :body => 'body', :profile => @profile, :parent => @track, :start_date => today, :end_date => today, :published => true) |
@@ -29,7 +29,7 @@ class StepTest < ActiveSupport::TestCase | @@ -29,7 +29,7 @@ class StepTest < ActiveSupport::TestCase | ||
29 | step = CommunityTrackPlugin::Step.new(:name => 'Step', :body => 'body', :profile => @profile, :parent => blog, :start_date => today, :end_date => today, :published => true) | 29 | step = CommunityTrackPlugin::Step.new(:name => 'Step', :body => 'body', :profile => @profile, :parent => blog, :start_date => today, :end_date => today, :published => true) |
30 | assert !step.save | 30 | assert !step.save |
31 | end | 31 | end |
32 | - | 32 | + |
33 | should 'do not allow step creation without a parent' do | 33 | should 'do not allow step creation without a parent' do |
34 | today = Date.today | 34 | today = Date.today |
35 | step = CommunityTrackPlugin::Step.new(:name => 'Step', :body => 'body', :profile => @profile, :parent => nil, :start_date => today, :end_date => today, :published => true) | 35 | step = CommunityTrackPlugin::Step.new(:name => 'Step', :body => 'body', :profile => @profile, :parent => nil, :start_date => today, :end_date => today, :published => true) |
@@ -65,25 +65,25 @@ class StepTest < ActiveSupport::TestCase | @@ -65,25 +65,25 @@ class StepTest < ActiveSupport::TestCase | ||
65 | @step.end_date_equal_or_after_start_date.inspect | 65 | @step.end_date_equal_or_after_start_date.inspect |
66 | assert [], @step.errors | 66 | assert [], @step.errors |
67 | end | 67 | end |
68 | - | 68 | + |
69 | should 'be active if today is between start and end dates' do | 69 | should 'be active if today is between start and end dates' do |
70 | @step.start_date = Date.today | 70 | @step.start_date = Date.today |
71 | @step.end_date = Date.today + 1.day | 71 | @step.end_date = Date.today + 1.day |
72 | assert @step.active? | 72 | assert @step.active? |
73 | end | 73 | end |
74 | - | 74 | + |
75 | should 'be finished if today is after the end date' do | 75 | should 'be finished if today is after the end date' do |
76 | @step.start_date = Date.today - 2.day | 76 | @step.start_date = Date.today - 2.day |
77 | @step.end_date = Date.today - 1.day | 77 | @step.end_date = Date.today - 1.day |
78 | assert @step.finished? | 78 | assert @step.finished? |
79 | end | 79 | end |
80 | - | 80 | + |
81 | should 'be waiting if today is before the end date' do | 81 | should 'be waiting if today is before the end date' do |
82 | @step.start_date = Date.today + 1.day | 82 | @step.start_date = Date.today + 1.day |
83 | @step.end_date = Date.today + 2.day | 83 | @step.end_date = Date.today + 2.day |
84 | assert @step.waiting? | 84 | assert @step.waiting? |
85 | end | 85 | end |
86 | - | 86 | + |
87 | should 'return delayed job created with a specific step_id' do | 87 | should 'return delayed job created with a specific step_id' do |
88 | step_id = 0 | 88 | step_id = 0 |
89 | CommunityTrackPlugin::ActivationJob.new(step_id) | 89 | CommunityTrackPlugin::ActivationJob.new(step_id) |
@@ -97,7 +97,7 @@ class StepTest < ActiveSupport::TestCase | @@ -97,7 +97,7 @@ class StepTest < ActiveSupport::TestCase | ||
97 | assert_equal 1, Delayed::Job.count | 97 | assert_equal 1, Delayed::Job.count |
98 | assert_equal @step.start_date, Delayed::Job.first.run_at.to_date | 98 | assert_equal @step.start_date, Delayed::Job.first.run_at.to_date |
99 | end | 99 | end |
100 | - | 100 | + |
101 | should 'do not duplicate delayed job' do | 101 | should 'do not duplicate delayed job' do |
102 | @step.start_date = Date.today | 102 | @step.start_date = Date.today |
103 | @step.end_date = Date.today | 103 | @step.end_date = Date.today |
@@ -105,7 +105,7 @@ class StepTest < ActiveSupport::TestCase | @@ -105,7 +105,7 @@ class StepTest < ActiveSupport::TestCase | ||
105 | @step.schedule_activation | 105 | @step.schedule_activation |
106 | assert_equal 1, Delayed::Job.count | 106 | assert_equal 1, Delayed::Job.count |
107 | end | 107 | end |
108 | - | 108 | + |
109 | should 'create delayed job when a step is saved' do | 109 | should 'create delayed job when a step is saved' do |
110 | @step.start_date = Date.today | 110 | @step.start_date = Date.today |
111 | @step.end_date = Date.today | 111 | @step.end_date = Date.today |
@@ -158,7 +158,7 @@ class StepTest < ActiveSupport::TestCase | @@ -158,7 +158,7 @@ class StepTest < ActiveSupport::TestCase | ||
158 | 158 | ||
159 | should 'do not schedule delayed job if save but do not modify date fields and published status' do | 159 | should 'do not schedule delayed job if save but do not modify date fields and published status' do |
160 | @step.start_date = Date.today | 160 | @step.start_date = Date.today |
161 | - @step.end_date = Date.today | 161 | + @step.end_date = Date.today |
162 | @step.published = false | 162 | @step.published = false |
163 | @step.save! | 163 | @step.save! |
164 | assert_equal 1, Delayed::Job.count | 164 | assert_equal 1, Delayed::Job.count |
@@ -171,10 +171,10 @@ class StepTest < ActiveSupport::TestCase | @@ -171,10 +171,10 @@ class StepTest < ActiveSupport::TestCase | ||
171 | should 'set position on save' do | 171 | should 'set position on save' do |
172 | assert !@step.position | 172 | assert !@step.position |
173 | @step.save! | 173 | @step.save! |
174 | - assert_equal 1, @step.position | 174 | + assert_equal 1, @step.position |
175 | step2 = CommunityTrackPlugin::Step.new(:name => 'Step2', :body => 'body', :profile => @profile, :parent => @track, :published => false, :end_date => Date.today, :start_date => Date.today) | 175 | step2 = CommunityTrackPlugin::Step.new(:name => 'Step2', :body => 'body', :profile => @profile, :parent => @track, :published => false, :end_date => Date.today, :start_date => Date.today) |
176 | step2.save! | 176 | step2.save! |
177 | - assert_equal 2, step2.position | 177 | + assert_equal 2, step2.position |
178 | end | 178 | end |
179 | 179 | ||
180 | should 'publish step if it is active' do | 180 | should 'publish step if it is active' do |
plugins/community_track/test/unit/community_track_plugin/track_helper_test.rb
1 | require File.dirname(__FILE__) + '/../../test_helper' | 1 | require File.dirname(__FILE__) + '/../../test_helper' |
2 | 2 | ||
3 | class TrackHelperTest < ActiveSupport::TestCase | 3 | class TrackHelperTest < ActiveSupport::TestCase |
4 | - | 4 | + |
5 | include CommunityTrackPlugin::TrackHelper | 5 | include CommunityTrackPlugin::TrackHelper |
6 | include NoosferoTestHelper | 6 | include NoosferoTestHelper |
7 | include ActionView::Helpers::TextHelper | 7 | include ActionView::Helpers::TextHelper |
@@ -9,7 +9,7 @@ class TrackHelperTest < ActiveSupport::TestCase | @@ -9,7 +9,7 @@ class TrackHelperTest < ActiveSupport::TestCase | ||
9 | def setup | 9 | def setup |
10 | @track = CommunityTrackPlugin::Track.new | 10 | @track = CommunityTrackPlugin::Track.new |
11 | end | 11 | end |
12 | - | 12 | + |
13 | should 'return css class for track with category' do | 13 | should 'return css class for track with category' do |
14 | category = fast_create(Category, :name => 'education') | 14 | category = fast_create(Category, :name => 'education') |
15 | @track.categories << category | 15 | @track.categories << category |
@@ -19,7 +19,7 @@ class TrackHelperTest < ActiveSupport::TestCase | @@ -19,7 +19,7 @@ class TrackHelperTest < ActiveSupport::TestCase | ||
19 | should 'return default css class for a track without category' do | 19 | should 'return default css class for a track without category' do |
20 | assert_equal 'category_not_defined', category_class(@track) | 20 | assert_equal 'category_not_defined', category_class(@track) |
21 | end | 21 | end |
22 | - | 22 | + |
23 | should 'return css class for first category that the class belongs' do | 23 | should 'return css class for first category that the class belongs' do |
24 | category1 = fast_create(Category, :name => 'education') | 24 | category1 = fast_create(Category, :name => 'education') |
25 | @track.categories << category1 | 25 | @track.categories << category1 |
@@ -27,7 +27,7 @@ class TrackHelperTest < ActiveSupport::TestCase | @@ -27,7 +27,7 @@ class TrackHelperTest < ActiveSupport::TestCase | ||
27 | @track.categories << category2 | 27 | @track.categories << category2 |
28 | assert_equal 'category_education', category_class(@track) | 28 | assert_equal 'category_education', category_class(@track) |
29 | end | 29 | end |
30 | - | 30 | + |
31 | should 'return css class with category name properly formated' do | 31 | should 'return css class with category name properly formated' do |
32 | category = fast_create(Category, :name => 'not defined') | 32 | category = fast_create(Category, :name => 'not defined') |
33 | @track.categories << category | 33 | @track.categories << category |
plugins/community_track/test/unit/community_track_plugin/track_test.rb
@@ -68,7 +68,7 @@ class TrackTest < ActiveSupport::TestCase | @@ -68,7 +68,7 @@ class TrackTest < ActiveSupport::TestCase | ||
68 | assert_equal 3, step3.position | 68 | assert_equal 3, step3.position |
69 | assert_equal [step1, step2, step3], @track.steps | 69 | assert_equal [step1, step2, step3], @track.steps |
70 | end | 70 | end |
71 | - | 71 | + |
72 | should 'return steps with order defined by position attribute' do | 72 | should 'return steps with order defined by position attribute' do |
73 | @track.children.destroy_all | 73 | @track.children.destroy_all |
74 | step1 = CommunityTrackPlugin::Step.create!(:parent => @track, :start_date => Date.today, :end_date => Date.today, :name => "step1", :profile => @track.profile) | 74 | step1 = CommunityTrackPlugin::Step.create!(:parent => @track, :start_date => Date.today, :end_date => Date.today, :name => "step1", :profile => @track.profile) |
@@ -85,7 +85,7 @@ class TrackTest < ActiveSupport::TestCase | @@ -85,7 +85,7 @@ class TrackTest < ActiveSupport::TestCase | ||
85 | 85 | ||
86 | should 'save steps in a new order' do | 86 | should 'save steps in a new order' do |
87 | @track.children.destroy_all | 87 | @track.children.destroy_all |
88 | - | 88 | + |
89 | step1 = CommunityTrackPlugin::Step.create!(:parent => @track, :start_date => Date.today, :end_date => Date.today, :name => "step1", :profile => @track.profile) | 89 | step1 = CommunityTrackPlugin::Step.create!(:parent => @track, :start_date => Date.today, :end_date => Date.today, :name => "step1", :profile => @track.profile) |
90 | step2 = CommunityTrackPlugin::Step.create!(:parent => @track, :start_date => Date.today, :end_date => Date.today, :name => "step2", :profile => @track.profile) | 90 | step2 = CommunityTrackPlugin::Step.create!(:parent => @track, :start_date => Date.today, :end_date => Date.today, :name => "step2", :profile => @track.profile) |
91 | step3 = CommunityTrackPlugin::Step.create!(:parent => @track, :start_date => Date.today, :end_date => Date.today, :name => "step3", :profile => @track.profile) | 91 | step3 = CommunityTrackPlugin::Step.create!(:parent => @track, :start_date => Date.today, :end_date => Date.today, :name => "step3", :profile => @track.profile) |
plugins/community_track/test/unit/community_track_plugin_test.rb
@@ -8,7 +8,7 @@ class CommunityTrackPluginTest < ActiveSupport::TestCase | @@ -8,7 +8,7 @@ class CommunityTrackPluginTest < ActiveSupport::TestCase | ||
8 | @params = {} | 8 | @params = {} |
9 | @plugin.stubs(:context).returns(self) | 9 | @plugin.stubs(:context).returns(self) |
10 | end | 10 | end |
11 | - | 11 | + |
12 | attr_reader :profile, :params | 12 | attr_reader :profile, :params |
13 | 13 | ||
14 | should 'has name' do | 14 | should 'has name' do |
@@ -61,7 +61,7 @@ class CommunityTrackPluginTest < ActiveSupport::TestCase | @@ -61,7 +61,7 @@ class CommunityTrackPluginTest < ActiveSupport::TestCase | ||
61 | @params = nil | 61 | @params = nil |
62 | assert_equivalent [CommunityTrackPlugin::Step, CommunityTrackPlugin::Track], @plugin.content_types | 62 | assert_equivalent [CommunityTrackPlugin::Step, CommunityTrackPlugin::Track], @plugin.content_types |
63 | end | 63 | end |
64 | - | 64 | + |
65 | should 'return track card as an extra block' do | 65 | should 'return track card as an extra block' do |
66 | assert_includes CommunityTrackPlugin.extra_blocks, CommunityTrackPlugin::TrackListBlock | 66 | assert_includes CommunityTrackPlugin.extra_blocks, CommunityTrackPlugin::TrackListBlock |
67 | end | 67 | end |
plugins/community_track/views/box_organizer/community_track_plugin/_track_list_block.rhtml
@@ -2,4 +2,5 @@ | @@ -2,4 +2,5 @@ | ||
2 | <%= labelled_form_field _('Limit of items'), text_field(:block, :limit, :size => 3) %> | 2 | <%= labelled_form_field _('Limit of items'), text_field(:block, :limit, :size => 3) %> |
3 | <%= labelled_form_field check_box(:block, :more_another_page) + _('Show more at another page'), '' %> | 3 | <%= labelled_form_field check_box(:block, :more_another_page) + _('Show more at another page'), '' %> |
4 | <%= select_categories(:block, _('Select Categories')) %> | 4 | <%= select_categories(:block, _('Select Categories')) %> |
5 | +<br/> | ||
5 | </div> | 6 | </div> |
plugins/community_track/views/cms/community_track_plugin/_track.rhtml
1 | -<%= required_fields_message %> | 1 | +<div class='community-track'> |
2 | + <%= required_fields_message %> | ||
2 | 3 | ||
3 | -<%= render :file => 'shared/tiny_mce' %> | 4 | + <%= render :file => 'shared/tiny_mce' %> |
4 | 5 | ||
5 | -<div> | ||
6 | - <%= required labelled_form_field(_('Title'), text_field(:article, 'name', :size => '64', :maxlength => 150)) %> | ||
7 | -</div> | 6 | + <div> |
7 | + <%= required labelled_form_field(_('Title'), text_field(:article, 'name', :size => '64', :maxlength => 150)) %> | ||
8 | + </div> | ||
8 | 9 | ||
9 | -<%= render :partial => 'shared/lead_and_body', :locals => {:tiny_mce => true, :body_label => 'Description:'} %> | 10 | + <%= render :partial => 'shared/lead_and_body', :locals => {:tiny_mce => true, :body_label => 'Description:'} %> |
10 | 11 | ||
11 | -<div> | ||
12 | - <% f.fields_for :image_builder, @article.image do |i| %> | ||
13 | - <%= file_field_or_thumbnail(_('Image:'), @article.image, i) %> | ||
14 | - <% end %> | 12 | + <div> |
13 | + <% f.fields_for :image_builder, @article.image do |i| %> | ||
14 | + <%= file_field_or_thumbnail(_('Image:'), @article.image, i) %> | ||
15 | + <% end %> | ||
15 | 16 | ||
16 | - <%= labelled_form_field(_('Goals:'), text_area(:article, :goals, :rows => 3, :cols => 64)) %> | ||
17 | - <%= labelled_form_field(_('Expected Results:'), text_area(:article, :expected_results, :rows => 3, :cols => 64)) %> | 17 | + <%= labelled_form_field(_('Goals:'), text_area(:article, :goals, :rows => 3, :cols => 64)) %> |
18 | + <%= labelled_form_field(_('Expected Results:'), text_area(:article, :expected_results, :rows => 3, :cols => 64)) %> | ||
19 | + </div> | ||
18 | </div> | 20 | </div> |