Commit 0e4d4a791116f51ca211b8a881618e86a46a4597
1 parent
f1963acc
Exists in
master
and in
29 other branches
rails3: fix community_track plugin
Showing
35 changed files
with
311 additions
and
307 deletions
Show diff stats
plugins/community_track/lib/community_track_plugin/activation_job.rb
1 | class CommunityTrackPlugin::ActivationJob < Struct.new(:step_id) | 1 | class CommunityTrackPlugin::ActivationJob < Struct.new(:step_id) |
2 | 2 | ||
3 | def self.find(step_id) | 3 | def self.find(step_id) |
4 | - Delayed::Job.where(:handler => "--- !ruby/struct:CommunityTrackPlugin::ActivationJob \nstep_id: #{step_id}\n") | 4 | + Delayed::Job.where(:handler => "--- !ruby/struct:CommunityTrackPlugin::ActivationJob\nstep_id: #{step_id}\n") |
5 | end | 5 | end |
6 | 6 | ||
7 | def perform | 7 | def perform |
plugins/community_track/lib/community_track_plugin/step.rb
@@ -3,6 +3,8 @@ class CommunityTrackPlugin::Step < Folder | @@ -3,6 +3,8 @@ class CommunityTrackPlugin::Step < Folder | ||
3 | settings_items :hidden, :type => :boolean, :default => false | 3 | settings_items :hidden, :type => :boolean, :default => false |
4 | settings_items :tool_type, :type => String | 4 | settings_items :tool_type, :type => String |
5 | 5 | ||
6 | + attr_accessible :start_date, :end_date, :tool_type, :hidden | ||
7 | + | ||
6 | alias :tools :children | 8 | alias :tools :children |
7 | 9 | ||
8 | acts_as_list :scope => :parent | 10 | acts_as_list :scope => :parent |
@@ -64,8 +66,8 @@ class CommunityTrackPlugin::Step < Folder | @@ -64,8 +66,8 @@ class CommunityTrackPlugin::Step < Folder | ||
64 | 66 | ||
65 | def to_html(options = {}) | 67 | def to_html(options = {}) |
66 | step = self | 68 | step = self |
67 | - lambda do | ||
68 | - render :file => 'content_viewer/step.rhtml', :locals => {:step => step} | 69 | + proc do |
70 | + render :file => 'content_viewer/step', :locals => {:step => step} | ||
69 | end | 71 | end |
70 | end | 72 | end |
71 | 73 | ||
@@ -86,7 +88,7 @@ class CommunityTrackPlugin::Step < Folder | @@ -86,7 +88,7 @@ class CommunityTrackPlugin::Step < Folder | ||
86 | if Date.today <= end_date || accept_comments | 88 | if Date.today <= end_date || accept_comments |
87 | schedule_date = !accept_comments ? start_date : end_date + 1.day | 89 | schedule_date = !accept_comments ? start_date : end_date + 1.day |
88 | CommunityTrackPlugin::ActivationJob.find(id).destroy_all | 90 | CommunityTrackPlugin::ActivationJob.find(id).destroy_all |
89 | - Delayed::Job.enqueue(CommunityTrackPlugin::ActivationJob.new(self.id), 0, schedule_date) | 91 | + Delayed::Job.enqueue(CommunityTrackPlugin::ActivationJob.new(self.id), :run_at => schedule_date) |
90 | end | 92 | end |
91 | end | 93 | end |
92 | 94 |
plugins/community_track/lib/community_track_plugin/track.rb
@@ -5,6 +5,8 @@ class CommunityTrackPlugin::Track < Folder | @@ -5,6 +5,8 @@ class CommunityTrackPlugin::Track < Folder | ||
5 | 5 | ||
6 | validate :validate_categories | 6 | validate :validate_categories |
7 | 7 | ||
8 | + attr_accessible :goals, :expected_results | ||
9 | + | ||
8 | def validate_categories | 10 | def validate_categories |
9 | errors.add(:categories, _('should not be blank.')) if categories.empty? && pending_categorizations.blank? | 11 | errors.add(:categories, _('should not be blank.')) if categories.empty? && pending_categorizations.blank? |
10 | end | 12 | end |
@@ -48,7 +50,7 @@ class CommunityTrackPlugin::Track < Folder | @@ -48,7 +50,7 @@ class CommunityTrackPlugin::Track < Folder | ||
48 | end | 50 | end |
49 | 51 | ||
50 | def comments_count | 52 | def comments_count |
51 | - steps_unsorted.joins(:children).sum('childrens_articles.comments_count') | 53 | + steps_unsorted.joins(:children).sum('children_articles.comments_count') |
52 | end | 54 | end |
53 | 55 | ||
54 | def css_class_name | 56 | def css_class_name |
@@ -68,8 +70,8 @@ class CommunityTrackPlugin::Track < Folder | @@ -68,8 +70,8 @@ class CommunityTrackPlugin::Track < Folder | ||
68 | 70 | ||
69 | def to_html(options = {}) | 71 | def to_html(options = {}) |
70 | track = self | 72 | track = self |
71 | - lambda do | ||
72 | - render :file => 'content_viewer/track.rhtml', :locals => {:track => track} | 73 | + proc do |
74 | + render :file => 'content_viewer/track', :locals => {:track => track} | ||
73 | end | 75 | end |
74 | end | 76 | end |
75 | 77 |
plugins/community_track/lib/community_track_plugin/track_list_block.rb
@@ -48,8 +48,8 @@ class CommunityTrackPlugin::TrackListBlock < Block | @@ -48,8 +48,8 @@ class CommunityTrackPlugin::TrackListBlock < Block | ||
48 | 48 | ||
49 | def content(args={}) | 49 | def content(args={}) |
50 | block = self | 50 | block = self |
51 | - lambda do | ||
52 | - render :file => 'blocks/track_list.rhtml', :locals => {:block => block} | 51 | + proc do |
52 | + render :file => 'blocks/track_list', :locals => {:block => block} | ||
53 | end | 53 | end |
54 | end | 54 | end |
55 | 55 | ||
@@ -60,7 +60,7 @@ class CommunityTrackPlugin::TrackListBlock < Block | @@ -60,7 +60,7 @@ class CommunityTrackPlugin::TrackListBlock < Block | ||
60 | def footer | 60 | def footer |
61 | block = self | 61 | block = self |
62 | return nil if !has_page?(2) | 62 | return nil if !has_page?(2) |
63 | - lambda do | 63 | + proc do |
64 | render :partial => 'blocks/track_list_more', :locals => {:block => block, :page => 2, :per_page => block.limit} | 64 | render :partial => 'blocks/track_list_more', :locals => {:block => block, :page => 2, :per_page => block.limit} |
65 | end | 65 | end |
66 | end | 66 | end |
plugins/community_track/test/functional/community_track_plugin_content_viewer_controller_test.rb
@@ -88,7 +88,7 @@ class ContentViewerControllerTest < ActionController::TestCase | @@ -88,7 +88,7 @@ class ContentViewerControllerTest < ActionController::TestCase | ||
88 | 88 | ||
89 | should 'render a div with block id for track list block' do | 89 | should 'render a div with block id for track list block' do |
90 | box = fast_create(Box, :owner_id => @profile.id, :owner_type => @profile.class.name) | 90 | box = fast_create(Box, :owner_id => @profile.id, :owner_type => @profile.class.name) |
91 | - @block = CommunityTrackPlugin::TrackListBlock.create!(:box => box) | 91 | + @block = create(CommunityTrackPlugin::TrackListBlock, :box => box) |
92 | @profile.boxes << box | 92 | @profile.boxes << box |
93 | get :view_page, @step.url | 93 | get :view_page, @step.url |
94 | assert_tag :tag => 'div', :attributes => { :class => 'track_list', :id => "track_list_#{@block.id}" } | 94 | assert_tag :tag => 'div', :attributes => { :class => 'track_list', :id => "track_list_#{@block.id}" } |
@@ -96,7 +96,7 @@ class ContentViewerControllerTest < ActionController::TestCase | @@ -96,7 +96,7 @@ class ContentViewerControllerTest < ActionController::TestCase | ||
96 | 96 | ||
97 | should 'render a div with block id for track card list block' do | 97 | should 'render a div with block id for track card list block' do |
98 | box = fast_create(Box, :owner_id => @profile.id, :owner_type => @profile.class.name) | 98 | box = fast_create(Box, :owner_id => @profile.id, :owner_type => @profile.class.name) |
99 | - @block = CommunityTrackPlugin::TrackCardListBlock.create!(:box => box) | 99 | + @block = create(CommunityTrackPlugin::TrackCardListBlock, :box => box) |
100 | @profile.boxes << box | 100 | @profile.boxes << box |
101 | get :view_page, @step.url | 101 | get :view_page, @step.url |
102 | assert_tag :tag => 'div', :attributes => { :class => 'track_list', :id => "track_list_#{@block.id}" } | 102 | assert_tag :tag => 'div', :attributes => { :class => 'track_list', :id => "track_list_#{@block.id}" } |
@@ -104,7 +104,7 @@ class ContentViewerControllerTest < ActionController::TestCase | @@ -104,7 +104,7 @@ class ContentViewerControllerTest < ActionController::TestCase | ||
104 | 104 | ||
105 | should 'render tracks in track list block' do | 105 | should 'render tracks in track list block' do |
106 | box = fast_create(Box, :owner_id => @profile.id, :owner_type => @profile.class.name) | 106 | box = fast_create(Box, :owner_id => @profile.id, :owner_type => @profile.class.name) |
107 | - @block = CommunityTrackPlugin::TrackListBlock.create!(:box => box) | 107 | + @block = create(CommunityTrackPlugin::TrackListBlock, :box => box) |
108 | @profile.boxes << box | 108 | @profile.boxes << box |
109 | get :view_page, @step.url | 109 | get :view_page, @step.url |
110 | 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)}" } } } | 110 | 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 | @@ -112,7 +112,7 @@ class ContentViewerControllerTest < ActionController::TestCase | ||
112 | 112 | ||
113 | should 'render tracks in track card list block' do | 113 | should 'render tracks in track card list block' do |
114 | box = fast_create(Box, :owner_id => @profile.id, :owner_type => @profile.class.name) | 114 | box = fast_create(Box, :owner_id => @profile.id, :owner_type => @profile.class.name) |
115 | - @block = CommunityTrackPlugin::TrackCardListBlock.create!(:box => box) | 115 | + @block = create(CommunityTrackPlugin::TrackCardListBlock, :box => box) |
116 | @profile.boxes << box | 116 | @profile.boxes << box |
117 | get :view_page, @step.url | 117 | get :view_page, @step.url |
118 | assert_tag :tag => 'div', :attributes => { :class => "item_card category_#{@track.category_name}" }, :descendant => { :tag => 'div', :attributes => { :class => 'track_content' } } | 118 | 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 | @@ -121,7 +121,7 @@ class ContentViewerControllerTest < ActionController::TestCase | ||
121 | 121 | ||
122 | should 'render link to display more tracks in track list block' do | 122 | should 'render link to display more tracks in track list block' do |
123 | box = fast_create(Box, :owner_id => @profile.id, :owner_type => @profile.class.name) | 123 | box = fast_create(Box, :owner_id => @profile.id, :owner_type => @profile.class.name) |
124 | - @block = CommunityTrackPlugin::TrackCardListBlock.create!(:box => box) | 124 | + @block = create(CommunityTrackPlugin::TrackCardListBlock, :box => box) |
125 | @profile.boxes << box | 125 | @profile.boxes << box |
126 | 126 | ||
127 | (@block.limit+1).times { |i| create_track("track#{i}", @profile) } | 127 | (@block.limit+1).times { |i| create_track("track#{i}", @profile) } |
@@ -132,7 +132,7 @@ class ContentViewerControllerTest < ActionController::TestCase | @@ -132,7 +132,7 @@ class ContentViewerControllerTest < ActionController::TestCase | ||
132 | 132 | ||
133 | should 'render link to show all tracks in track list block' do | 133 | should 'render link to show all tracks in track list block' do |
134 | box = fast_create(Box, :owner_id => @profile.id, :owner_type => @profile.class.name) | 134 | box = fast_create(Box, :owner_id => @profile.id, :owner_type => @profile.class.name) |
135 | - @block = CommunityTrackPlugin::TrackCardListBlock.create!(:box => box) | 135 | + @block = create(CommunityTrackPlugin::TrackCardListBlock, :box => box) |
136 | @profile.boxes << box | 136 | @profile.boxes << box |
137 | @block.more_another_page = true | 137 | @block.more_another_page = true |
138 | @block.save! | 138 | @block.save! |
plugins/community_track/test/functional/community_track_plugin_environment_design_controller_test.rb
@@ -15,9 +15,9 @@ class EnvironmentDesignControllerTest < ActionController::TestCase | @@ -15,9 +15,9 @@ class EnvironmentDesignControllerTest < ActionController::TestCase | ||
15 | @environment.add_admin(user.person) | 15 | @environment.add_admin(user.person) |
16 | login_as(user.login) | 16 | login_as(user.login) |
17 | 17 | ||
18 | - box = Box.create!(:owner => @environment) | ||
19 | - @block = CommunityTrackPlugin::TrackListBlock.create!(:box => box) | ||
20 | - @block_card = CommunityTrackPlugin::TrackCardListBlock.create!(:box => box) | 18 | + box = create(Box, :owner => @environment) |
19 | + @block = create(CommunityTrackPlugin::TrackListBlock, :box => box) | ||
20 | + @block_card = create(CommunityTrackPlugin::TrackCardListBlock, :box => box) | ||
21 | end | 21 | end |
22 | 22 | ||
23 | should 'be able to edit TrackListBlock' do | 23 | should 'be able to edit TrackListBlock' do |
plugins/community_track/test/functional/community_track_plugin_public_controller_test.rb
@@ -11,8 +11,8 @@ class CommunityTrackPluginPublicControllerTest < ActionController::TestCase | @@ -11,8 +11,8 @@ class CommunityTrackPluginPublicControllerTest < ActionController::TestCase | ||
11 | @track = create_track('track', @community) | 11 | @track = create_track('track', @community) |
12 | 12 | ||
13 | box = fast_create(Box, :owner_id => @community.id, :owner_type => 'Community') | 13 | box = fast_create(Box, :owner_id => @community.id, :owner_type => 'Community') |
14 | - @card_block = CommunityTrackPlugin::TrackCardListBlock.create!(:box => box) | ||
15 | - @block = CommunityTrackPlugin::TrackListBlock.create!(:box => box) | 14 | + @card_block = create(CommunityTrackPlugin::TrackCardListBlock, :box => box) |
15 | + @block = create(CommunityTrackPlugin::TrackListBlock, :box => box) | ||
16 | end | 16 | end |
17 | 17 | ||
18 | should 'display tracks for card block' do | 18 | should 'display tracks for card block' do |
plugins/community_track/test/unit/community_track_plugin/step_test.rb
@@ -4,7 +4,7 @@ class StepTest < ActiveSupport::TestCase | @@ -4,7 +4,7 @@ class StepTest < ActiveSupport::TestCase | ||
4 | 4 | ||
5 | def setup | 5 | def setup |
6 | @profile = fast_create(Community) | 6 | @profile = fast_create(Community) |
7 | - @track = CommunityTrackPlugin::Track.new(:profile_id => @profile.id, :name => 'track') | 7 | + @track = CommunityTrackPlugin::Track.new(:profile => @profile, :name => 'track') |
8 | @category = fast_create(Category) | 8 | @category = fast_create(Category) |
9 | @track.add_category(@category) | 9 | @track.add_category(@category) |
10 | @track.save! | 10 | @track.save! |
@@ -61,13 +61,13 @@ class StepTest < ActiveSupport::TestCase | @@ -61,13 +61,13 @@ class StepTest < ActiveSupport::TestCase | ||
61 | should 'do not validate date period if start date is nil' do | 61 | should 'do not validate date period if start date is nil' do |
62 | @step.start_date = nil | 62 | @step.start_date = nil |
63 | @step.end_date_equal_or_after_start_date.inspect | 63 | @step.end_date_equal_or_after_start_date.inspect |
64 | - assert [], @step.errors | 64 | + assert @step.errors.empty? |
65 | end | 65 | end |
66 | 66 | ||
67 | should 'do not validate date period if end date is nil' do | 67 | should 'do not validate date period if end date is nil' do |
68 | @step.end_date = nil | 68 | @step.end_date = nil |
69 | @step.end_date_equal_or_after_start_date.inspect | 69 | @step.end_date_equal_or_after_start_date.inspect |
70 | - assert [], @step.errors | 70 | + assert @step.errors.empty? |
71 | end | 71 | end |
72 | 72 | ||
73 | should 'be active if today is between start and end dates' do | 73 | should 'be active if today is between start and end dates' do |
plugins/community_track/test/unit/community_track_plugin/track_card_list_block_test.rb
@@ -5,7 +5,7 @@ class TrackCardListBlockTest < ActiveSupport::TestCase | @@ -5,7 +5,7 @@ class TrackCardListBlockTest < ActiveSupport::TestCase | ||
5 | def setup | 5 | def setup |
6 | @community = fast_create(Community) | 6 | @community = fast_create(Community) |
7 | box = fast_create(Box, :owner_id => @community.id, :owner_type => @community.class.name) | 7 | box = fast_create(Box, :owner_id => @community.id, :owner_type => @community.class.name) |
8 | - @block = CommunityTrackPlugin::TrackCardListBlock.create!(:box => box) | 8 | + @block = create(CommunityTrackPlugin::TrackCardListBlock, :box => box) |
9 | end | 9 | end |
10 | 10 | ||
11 | should 'describe yourself' do | 11 | should 'describe yourself' do |
plugins/community_track/test/unit/community_track_plugin/track_list_block_test.rb
@@ -6,7 +6,7 @@ class TrackListBlockTest < ActiveSupport::TestCase | @@ -6,7 +6,7 @@ class TrackListBlockTest < ActiveSupport::TestCase | ||
6 | @profile = fast_create(Community) | 6 | @profile = fast_create(Community) |
7 | @track = create_track('track', profile) | 7 | @track = create_track('track', profile) |
8 | box = fast_create(Box, :owner_id => @profile.id, :owner_type => @profile.class.name) | 8 | box = fast_create(Box, :owner_id => @profile.id, :owner_type => @profile.class.name) |
9 | - @block = CommunityTrackPlugin::TrackListBlock.create!(:box => box) | 9 | + @block = create(CommunityTrackPlugin::TrackListBlock, :box => box) |
10 | end | 10 | end |
11 | 11 | ||
12 | attr_reader :profile | 12 | attr_reader :profile |
@@ -31,7 +31,7 @@ class TrackListBlockTest < ActiveSupport::TestCase | @@ -31,7 +31,7 @@ class TrackListBlockTest < ActiveSupport::TestCase | ||
31 | 31 | ||
32 | should 'list of articles be limited by block configuration' do | 32 | should 'list of articles be limited by block configuration' do |
33 | (@block.limit + 1).times { |i| create_track("track#{i}", profile) } | 33 | (@block.limit + 1).times { |i| create_track("track#{i}", profile) } |
34 | - assert_equal @block.limit, @block.tracks.count | 34 | + assert_equal @block.limit, @block.tracks.size |
35 | end | 35 | end |
36 | 36 | ||
37 | should 'return more link if has more tracks to show' do | 37 | should 'return more link if has more tracks to show' do |
plugins/community_track/test/unit/community_track_plugin/track_test.rb
@@ -130,13 +130,13 @@ class TrackTest < ActiveSupport::TestCase | @@ -130,13 +130,13 @@ class TrackTest < ActiveSupport::TestCase | ||
130 | 130 | ||
131 | should 'not be able to create a track without category' do | 131 | should 'not be able to create a track without category' do |
132 | track = CommunityTrackPlugin::Track.create(:profile => @profile, :name => 'track') | 132 | track = CommunityTrackPlugin::Track.create(:profile => @profile, :name => 'track') |
133 | - assert track.errors.invalid?(:categories) | 133 | + assert track.errors.include?(:categories) |
134 | end | 134 | end |
135 | 135 | ||
136 | should 'not be able to save a track without category' do | 136 | should 'not be able to save a track without category' do |
137 | @track.categories.delete_all | 137 | @track.categories.delete_all |
138 | @track.save | 138 | @track.save |
139 | - assert @track.errors.invalid?(:categories) | 139 | + assert @track.errors.include?(:categories) |
140 | end | 140 | end |
141 | 141 | ||
142 | end | 142 | end |
@@ -0,0 +1,26 @@ | @@ -0,0 +1,26 @@ | ||
1 | +<% extend CommunityTrackPlugin::TrackHelper %> | ||
2 | +<% extend CommunityTrackPlugin::StepHelper %> | ||
3 | +<div class="item <%= category_class(track) %>"> | ||
4 | + <div class="track_content"> | ||
5 | + <div class="lead"> | ||
6 | + <h3><%= link_to track.name, track.url %></h3> | ||
7 | + <div class="content"> | ||
8 | + <%= track.lead %> | ||
9 | + </div> | ||
10 | + </div> | ||
11 | + <div class="steps"> | ||
12 | + <h3><%= _("Steps") %></h3> | ||
13 | + <% track.steps.each do |step| %> | ||
14 | + <%= link_to_step(step) do %> | ||
15 | + <span class="step <%= block.status_class(step) %>"> | ||
16 | + <span class="position"><%= step.position %></span> | ||
17 | + <span class="legend"><%= status_description(step) %></span> | ||
18 | + <span class="tool_icon button with-text icon-new icon-new<%= step.tool_class.icon_name if step.tool_class %>"></span> | ||
19 | + <span class="name"><%= step.name %></span> | ||
20 | + </span> | ||
21 | + <% end %> | ||
22 | + <% end %> | ||
23 | + </div> | ||
24 | + </div> | ||
25 | +</div> | ||
26 | +<br style="clear: both;"/> |
plugins/community_track/views/blocks/_track.rhtml
@@ -1,26 +0,0 @@ | @@ -1,26 +0,0 @@ | ||
1 | -<% extend CommunityTrackPlugin::TrackHelper %> | ||
2 | -<% extend CommunityTrackPlugin::StepHelper %> | ||
3 | -<div class="item <%= category_class(track) %>"> | ||
4 | - <div class="track_content"> | ||
5 | - <div class="lead"> | ||
6 | - <h3><%= link_to track.name, track.url %></h3> | ||
7 | - <div class="content"> | ||
8 | - <%= track.lead %> | ||
9 | - </div> | ||
10 | - </div> | ||
11 | - <div class="steps"> | ||
12 | - <h3><%= _("Steps") %></h3> | ||
13 | - <% track.steps.each do |step| %> | ||
14 | - <% link_to_step(step) do %> | ||
15 | - <span class="step <%= block.status_class(step) %>"> | ||
16 | - <span class="position"><%= step.position %></span> | ||
17 | - <span class="legend"><%= status_description(step) %></span> | ||
18 | - <span class="tool_icon button with-text icon-new icon-new<%= step.tool_class.icon_name if step.tool_class %>"></span> | ||
19 | - <span class="name"><%= step.name %></span> | ||
20 | - </span> | ||
21 | - <% end %> | ||
22 | - <% end %> | ||
23 | - </div> | ||
24 | - </div> | ||
25 | -</div> | ||
26 | -<br style="clear: both;"/> |
plugins/community_track/views/blocks/_track_card.html.erb
0 → 100644
@@ -0,0 +1,29 @@ | @@ -0,0 +1,29 @@ | ||
1 | +<% extend CommunityTrackPlugin::TrackHelper %> | ||
2 | +<div class="item_card <%= category_class(track_card) %>"> | ||
3 | + <a href="<%= url_for track_card.url %>"> | ||
4 | + <div class="track_content"> | ||
5 | + <div class="title"> | ||
6 | + <%= track_card.category_name %> | ||
7 | + </div> | ||
8 | + <div class="image"> | ||
9 | + <%= image_tag track_card.image.public_filename if track_card.image %> | ||
10 | + </div> | ||
11 | + <div class="name"> | ||
12 | + <%= track_card.name %> | ||
13 | + </div> | ||
14 | + <div class="lead"> | ||
15 | + <%= track_card_lead(track_card) %> | ||
16 | + </div> | ||
17 | + </div> | ||
18 | + <div class="track_stats"> | ||
19 | + <div class="comments"> | ||
20 | + <span class="counter"><%= "#{track_card.comments_count}" %></span> | ||
21 | + <span class="label"><%= _('comments') %></span> | ||
22 | + </div> | ||
23 | + <div class="hits"> | ||
24 | + <span class="counter"><%= "#{track_card.hits}" %></span> | ||
25 | + <span class="label"><%= _('hits') %></span> | ||
26 | + </div> | ||
27 | + </div> | ||
28 | + </a> | ||
29 | +</div> |
plugins/community_track/views/blocks/_track_card.rhtml
@@ -1,29 +0,0 @@ | @@ -1,29 +0,0 @@ | ||
1 | -<% extend CommunityTrackPlugin::TrackHelper %> | ||
2 | -<div class="item_card <%= category_class(track_card) %>"> | ||
3 | - <a href="<%= url_for track_card.url %>"> | ||
4 | - <div class="track_content"> | ||
5 | - <div class="title"> | ||
6 | - <%= track_card.category_name %> | ||
7 | - </div> | ||
8 | - <div class="image"> | ||
9 | - <%= image_tag track_card.image.public_filename if track_card.image %> | ||
10 | - </div> | ||
11 | - <div class="name"> | ||
12 | - <%= track_card.name %> | ||
13 | - </div> | ||
14 | - <div class="lead"> | ||
15 | - <%= track_card_lead(track_card) %> | ||
16 | - </div> | ||
17 | - </div> | ||
18 | - <div class="track_stats"> | ||
19 | - <div class="comments"> | ||
20 | - <span class="counter"><%= "#{track_card.comments_count}" %></span> | ||
21 | - <span class="label"><%= _('comments') %></span> | ||
22 | - </div> | ||
23 | - <div class="hits"> | ||
24 | - <span class="counter"><%= "#{track_card.hits}" %></span> | ||
25 | - <span class="label"><%= _('hits') %></span> | ||
26 | - </div> | ||
27 | - </div> | ||
28 | - </a> | ||
29 | -</div> |
plugins/community_track/views/blocks/_track_list_more.html.erb
0 → 100644
@@ -0,0 +1,12 @@ | @@ -0,0 +1,12 @@ | ||
1 | +<% force_same_page ||= false %> | ||
2 | +<div id="track_list_more_<%= block.id %>" class="more_button"> | ||
3 | + <% if block.more_another_page && !force_same_page %> | ||
4 | + <div class="view_all"> | ||
5 | + <%= link_to _('View All'), :id => block.id, :controller => 'community_track_plugin_public', :action => 'all_tracks' %> | ||
6 | + </div> | ||
7 | + <% else %> | ||
8 | + <div class="more"> | ||
9 | + <%= 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}")) %> | ||
10 | + </div> | ||
11 | + <% end %> | ||
12 | +</div> |
plugins/community_track/views/blocks/_track_list_more.rhtml
@@ -1,12 +0,0 @@ | @@ -1,12 +0,0 @@ | ||
1 | -<% force_same_page ||= false %> | ||
2 | -<div id="track_list_more_<%= block.id %>" class="more_button"> | ||
3 | - <% if block.more_another_page && !force_same_page %> | ||
4 | - <div class="view_all"> | ||
5 | - <%= link_to _('View All'), :id => block.id, :controller => 'community_track_plugin_public', :action => 'all_tracks' %> | ||
6 | - </div> | ||
7 | - <% else %> | ||
8 | - <div class="more"> | ||
9 | - <%= 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}")) %> | ||
10 | - </div> | ||
11 | - <% end %> | ||
12 | -</div> |
plugins/community_track/views/blocks/track_list.html.erb
0 → 100644
plugins/community_track/views/blocks/track_list.rhtml
plugins/community_track/views/box_organizer/community_track_plugin/_track_list_block.html.erb
0 → 100644
@@ -0,0 +1,6 @@ | @@ -0,0 +1,6 @@ | ||
1 | +<div id='edit-track-list-block'> | ||
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'), '' %> | ||
4 | + <%= select_categories(:block, _('Select Categories')) %> | ||
5 | +<br/> | ||
6 | +</div> |
plugins/community_track/views/box_organizer/community_track_plugin/_track_list_block.rhtml
@@ -1,6 +0,0 @@ | @@ -1,6 +0,0 @@ | ||
1 | -<div id='edit-track-list-block'> | ||
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'), '' %> | ||
4 | - <%= select_categories(:block, _('Select Categories')) %> | ||
5 | -<br/> | ||
6 | -</div> |
plugins/community_track/views/cms/community_track_plugin/_step.html.erb
0 → 100644
@@ -0,0 +1,21 @@ | @@ -0,0 +1,21 @@ | ||
1 | +<%= required_fields_message %> | ||
2 | + | ||
3 | +<%= render :file => 'shared/tiny_mce' %> | ||
4 | + | ||
5 | +<div> | ||
6 | + <%= required f.text_field('name', :size => '64', :maxlength => 150) %> | ||
7 | + <%= labelled_form_field(_('Period'), ( | ||
8 | + date_range_field('article[start_date]', 'article[end_date]', @article.start_date, @article.end_date, | ||
9 | + '%Y-%m-%d', | ||
10 | + { :change_month => true, :change_year => true, | ||
11 | + :date_format => 'yy-mm-dd' }, | ||
12 | + { :size => 14 }) | ||
13 | + )) %> | ||
14 | + | ||
15 | + <%= labelled_form_field(_('Tool type'), select(:article, :tool_type, CommunityTrackPlugin::Step.enabled_tools.map {|t| [t.short_description, t.name]} )) %> | ||
16 | + <%= hidden_field_tag('success_back_to', url_for(@article.parent.view_url)) %> | ||
17 | +</div> | ||
18 | + | ||
19 | +<%= labelled_form_field check_box(:article, :hidden) + _('Hidden Step'), '' %> | ||
20 | + | ||
21 | +<%= render :partial => 'shared/lead_and_body', :locals => {:tiny_mce => true, :body_label => 'Description:'} %> |
plugins/community_track/views/cms/community_track_plugin/_step.rhtml
@@ -1,21 +0,0 @@ | @@ -1,21 +0,0 @@ | ||
1 | -<%= required_fields_message %> | ||
2 | - | ||
3 | -<%= render :file => 'shared/tiny_mce' %> | ||
4 | - | ||
5 | -<div> | ||
6 | - <%= required f.text_field('name', :size => '64', :maxlength => 150) %> | ||
7 | - <%= labelled_form_field(_('Period'), ( | ||
8 | - date_range_field('article[start_date]', 'article[end_date]', @article.start_date, @article.end_date, | ||
9 | - '%Y-%m-%d', | ||
10 | - { :change_month => true, :change_year => true, | ||
11 | - :date_format => 'yy-mm-dd' }, | ||
12 | - { :size => 14 }) | ||
13 | - )) %> | ||
14 | - | ||
15 | - <%= labelled_form_field(_('Tool type'), select(:article, :tool_type, CommunityTrackPlugin::Step.enabled_tools.map {|t| [t.short_description, t.name]} )) %> | ||
16 | - <%= hidden_field_tag('success_back_to', url_for(@article.parent.view_url)) %> | ||
17 | -</div> | ||
18 | - | ||
19 | -<%= labelled_form_field check_box(:article, :hidden) + _('Hidden Step'), '' %> | ||
20 | - | ||
21 | -<%= render :partial => 'shared/lead_and_body', :locals => {:tiny_mce => true, :body_label => 'Description:'} %> |
plugins/community_track/views/cms/community_track_plugin/_track.html.erb
0 → 100644
@@ -0,0 +1,16 @@ | @@ -0,0 +1,16 @@ | ||
1 | +<div class='community-track'> | ||
2 | + <%= required_fields_message %> | ||
3 | + | ||
4 | + <%= render :file => 'shared/tiny_mce' %> | ||
5 | + | ||
6 | + <div> | ||
7 | + <%= required labelled_form_field(_('Title'), text_field(:article, 'name', :size => '64', :maxlength => 150)) %> | ||
8 | + </div> | ||
9 | + | ||
10 | + <%= render :partial => 'shared/lead_and_body', :locals => {:tiny_mce => true, :body_label => 'Description:'} %> | ||
11 | + | ||
12 | + <div> | ||
13 | + <%= labelled_form_field(_('Goals:'), text_area(:article, :goals, :rows => 3, :cols => 64)) %> | ||
14 | + <%= labelled_form_field(_('Expected Results:'), text_area(:article, :expected_results, :rows => 3, :cols => 64)) %> | ||
15 | + </div> | ||
16 | +</div> |
plugins/community_track/views/cms/community_track_plugin/_track.rhtml
@@ -1,16 +0,0 @@ | @@ -1,16 +0,0 @@ | ||
1 | -<div class='community-track'> | ||
2 | - <%= required_fields_message %> | ||
3 | - | ||
4 | - <%= render :file => 'shared/tiny_mce' %> | ||
5 | - | ||
6 | - <div> | ||
7 | - <%= required labelled_form_field(_('Title'), text_field(:article, 'name', :size => '64', :maxlength => 150)) %> | ||
8 | - </div> | ||
9 | - | ||
10 | - <%= render :partial => 'shared/lead_and_body', :locals => {:tiny_mce => true, :body_label => 'Description:'} %> | ||
11 | - | ||
12 | - <div> | ||
13 | - <%= labelled_form_field(_('Goals:'), text_area(:article, :goals, :rows => 3, :cols => 64)) %> | ||
14 | - <%= labelled_form_field(_('Expected Results:'), text_area(:article, :expected_results, :rows => 3, :cols => 64)) %> | ||
15 | - </div> | ||
16 | -</div> |
plugins/community_track/views/community_track_plugin_public/all_tracks.html.erb
0 → 100644
@@ -0,0 +1,10 @@ | @@ -0,0 +1,10 @@ | ||
1 | +<h1><%= _('Tracks') %></h1> | ||
2 | +<div class="all_tracks"> | ||
3 | + <div class="track_list track_card_list" id="track_list_<%= @block.id %>"> | ||
4 | + <%= render :partial => "blocks/#{@block.track_partial}", :collection => @tracks, :locals => {:block => @block} %> | ||
5 | + </div> | ||
6 | + <br style="clear: both;"/> | ||
7 | + <% if @show_more %> | ||
8 | + <%= render :partial => "blocks/track_list_more", :locals => {:block => @block, :force_same_page => true, :page => 2, :per_page => @per_page} %> | ||
9 | + <% end %> | ||
10 | +</div> |
plugins/community_track/views/community_track_plugin_public/all_tracks.rhtml
@@ -1,10 +0,0 @@ | @@ -1,10 +0,0 @@ | ||
1 | -<h1><%= _('Tracks') %></h1> | ||
2 | -<div class="all_tracks"> | ||
3 | - <div class="track_list track_card_list" id="track_list_<%= @block.id %>"> | ||
4 | - <%= render :partial => "blocks/#{@block.track_partial}", :collection => @tracks, :locals => {:block => @block} %> | ||
5 | - </div> | ||
6 | - <br style="clear: both;"/> | ||
7 | - <% if @show_more %> | ||
8 | - <%= render :partial => "blocks/track_list_more", :locals => {:block => @block, :force_same_page => true, :page => 2, :per_page => @per_page} %> | ||
9 | - <% end %> | ||
10 | -</div> |
plugins/community_track/views/community_track_plugin_public/select_community.html.erb
0 → 100644
@@ -0,0 +1,41 @@ | @@ -0,0 +1,41 @@ | ||
1 | +<div> | ||
2 | + | ||
3 | +<h1><%= _('Select Community') %></h1> | ||
4 | + | ||
5 | +<% if !@failed.blank? %> | ||
6 | + <div class="errorExplanation" id="errorExplanation"> | ||
7 | + <div style="color: #c00;"> | ||
8 | + <% @failed.each do |error|%> | ||
9 | + <strong> <%= error %></strong> | ||
10 | + <% end %> | ||
11 | + </div> | ||
12 | + </div> | ||
13 | +<% end %> | ||
14 | + | ||
15 | +<% button_bar do %> | ||
16 | + <%= button(:add, _('Create a new community'), :controller => 'memberships', :action => 'new_community', :profile => user.identifier, :back_to => @back_to) %> | ||
17 | +<% end %> | ||
18 | + | ||
19 | +<%= form_tag({:controller => 'community_track_plugin_public', :action => 'select_community', :profile => user.identifier}) do %> | ||
20 | +<div class="common-profile-list-block"> | ||
21 | + <ul> | ||
22 | + <% @communities.each do |community| %> | ||
23 | + <li class="search-profile-item"> | ||
24 | + <div class="common-profile-list-block"> | ||
25 | + <div class="vcard"> | ||
26 | + <a href="#" onclick="jQuery('<%= "#community_identifier_#{community.identifier}" %>').attr('checked', true);"> | ||
27 | + <span class="profile-image"><%= profile_image(community) %></span> | ||
28 | + <span class="org"><%= community.name %></span> | ||
29 | + <span class="select_community"><%= radio_button_tag(:community_identifier, community.identifier) %></span> | ||
30 | + </a> | ||
31 | + </div> | ||
32 | + </div> | ||
33 | + </li> | ||
34 | + <% end %> | ||
35 | + </ul> | ||
36 | + </div> | ||
37 | + <div class="clear"></div> | ||
38 | + <br/> | ||
39 | + <%= submit_button :save, _('New Track') %> | ||
40 | +<% end %> | ||
41 | +</div> |
plugins/community_track/views/community_track_plugin_public/select_community.rhtml
@@ -1,41 +0,0 @@ | @@ -1,41 +0,0 @@ | ||
1 | -<div> | ||
2 | - | ||
3 | -<h1><%= _('Select Community') %></h1> | ||
4 | - | ||
5 | -<% if !@failed.blank? %> | ||
6 | - <div class="errorExplanation" id="errorExplanation"> | ||
7 | - <div style="color: #c00;"> | ||
8 | - <% @failed.each do |error|%> | ||
9 | - <strong> <%= error %></strong> | ||
10 | - <% end %> | ||
11 | - </div> | ||
12 | - </div> | ||
13 | -<% end %> | ||
14 | - | ||
15 | -<% button_bar do %> | ||
16 | - <%= button(:add, __('Create a new community'), :controller => 'memberships', :action => 'new_community', :profile => user.identifier, :back_to => @back_to) %> | ||
17 | -<% end %> | ||
18 | - | ||
19 | -<% form_tag({:controller => 'community_track_plugin_public', :action => 'select_community', :profile => user.identifier}) do %> | ||
20 | -<div class="common-profile-list-block"> | ||
21 | - <ul> | ||
22 | - <% @communities.each do |community| %> | ||
23 | - <li class="search-profile-item"> | ||
24 | - <div class="common-profile-list-block"> | ||
25 | - <div class="vcard"> | ||
26 | - <a href="#" onclick="jQuery('<%= "#community_identifier_#{community.identifier}" %>').attr('checked', true);"> | ||
27 | - <span class="profile-image"><%= profile_image(community) %></span> | ||
28 | - <span class="org"><%= community.name %></span> | ||
29 | - <span class="select_community"><%= radio_button_tag(:community_identifier, community.identifier) %></span> | ||
30 | - </a> | ||
31 | - </div> | ||
32 | - </div> | ||
33 | - </li> | ||
34 | - <% end %> | ||
35 | - </ul> | ||
36 | - </div> | ||
37 | - <div class="clear"></div> | ||
38 | - <br/> | ||
39 | - <%= submit_button :save, _('New Track') %> | ||
40 | -<% end %> | ||
41 | -</div> |
plugins/community_track/views/content_viewer/_step_item.html.erb
0 → 100644
@@ -0,0 +1,41 @@ | @@ -0,0 +1,41 @@ | ||
1 | +<li class="step <%= status_class(step_item) %>"> | ||
2 | + <%= hidden_field_tag "step_ids[]", step_item.id %> | ||
3 | + <div class="tool_link" onclick="l=jQuery('#step_link_<%= step_item.id%>'); if(l.length) window.location = l.first().attr('href');"> | ||
4 | + <div class="position"><%= step_item.hidden ? '' : step_item.position %></div> | ||
5 | + <div class="content"> | ||
6 | + <div class="date"> | ||
7 | + <%= show_period(step_item.start_date, step_item.end_date) %> | ||
8 | + </div> | ||
9 | + <div class="legend"> | ||
10 | + <%= status_description(step_item) %> | ||
11 | + </div> | ||
12 | + <div class="name"><span class="tool_icon button with-text icon-new icon-new<%= step_item.tool_class.icon_name if step_item.tool_class %>"></span> <%= step_item.name %></div> | ||
13 | + <div class="lead"><%= step_item.body %></div> | ||
14 | + <div class="tools"> | ||
15 | + <% if step_item.tool %> | ||
16 | + <%= _('Tool: ') %> | ||
17 | + | ||
18 | + <%= link_to_step(step_item, {:id => "step_link_#{step_item.id}"}) do %> | ||
19 | + <%= step_item.tool.name %> | ||
20 | + <% end %> | ||
21 | + | ||
22 | + <% elsif step_item.allow_create?(user) && step_item.tool_class %> | ||
23 | + <a id="step_link_<%= step_item.id %>" href="<%= url_for({:controller => 'cms', :action => 'new', :type => step_item.tool_class, :parent_id => step_item, :success_back_to => url_for(step_item.parent.view_url)}) %>" class="button icon-new with-text icon-new<%= step_item.tool_class.icon_name %>"><%= _('Create %s' % step_item.tool_class.short_description) %></a> | ||
24 | + <% else %> | ||
25 | + <%= link_to_step(step_item, {:id => "step_link_#{step_item.id}"}, '') %> | ||
26 | + <% end %> | ||
27 | + </div> | ||
28 | + </div> | ||
29 | + </div> | ||
30 | + <div class="step_actions"> | ||
31 | + <% if step_item.allow_edit?(user) && !remove_content_button(:edit) %> | ||
32 | + <%= button('eyes', _('View'), step_item.url) %> | ||
33 | + <% content = content_tag('span', label_for_edit_article(step_item)) %> | ||
34 | + <% url = profile.admin_url.merge({ :controller => 'cms', :action => 'edit', :id => step_item.id, :success_back_to => url_for(step_item.parent.view_url) }) %> | ||
35 | + <%= expirable_button step_item, :edit, content, url %> | ||
36 | + <% end %> | ||
37 | + <% if step_item.accept_uploads? && step_item.allow_create?(user) %> | ||
38 | + <%= button('upload-file', _('Upload files'), profile.admin_url.merge(:controller => 'cms', :action => 'upload_files', :parent_id => step_item)) unless remove_content_button(:upload)%> | ||
39 | + <% end %> | ||
40 | + </div> | ||
41 | +</li> |
plugins/community_track/views/content_viewer/_step_item.rhtml
@@ -1,41 +0,0 @@ | @@ -1,41 +0,0 @@ | ||
1 | -<li class="step <%= status_class(step_item) %>"> | ||
2 | - <%= hidden_field_tag "step_ids[]", step_item.id %> | ||
3 | - <div class="tool_link" onclick="l=jQuery('#step_link_<%= step_item.id%>'); if(l.length) window.location = l.first().attr('href');"> | ||
4 | - <div class="position"><%= step_item.hidden ? '' : step_item.position %></div> | ||
5 | - <div class="content"> | ||
6 | - <div class="date"> | ||
7 | - <%= show_period(step_item.start_date, step_item.end_date) %> | ||
8 | - </div> | ||
9 | - <div class="legend"> | ||
10 | - <%= status_description(step_item) %> | ||
11 | - </div> | ||
12 | - <div class="name"><span class="tool_icon button with-text icon-new icon-new<%= step_item.tool_class.icon_name if step_item.tool_class %>"></span> <%= step_item.name %></div> | ||
13 | - <div class="lead"><%= step_item.body %></div> | ||
14 | - <div class="tools"> | ||
15 | - <% if step_item.tool %> | ||
16 | - <%= _('Tool: ') %> | ||
17 | - | ||
18 | - <% link_to_step(step_item, {:id => "step_link_#{step_item.id}"}) do %> | ||
19 | - <%= step_item.tool.name %> | ||
20 | - <% end %> | ||
21 | - | ||
22 | - <% elsif step_item.allow_create?(user) && step_item.tool_class %> | ||
23 | - <a id="step_link_<%= step_item.id %>" href="<%= url_for({:controller => 'cms', :action => 'new', :type => step_item.tool_class, :parent_id => step_item, :success_back_to => url_for(step_item.parent.view_url)}) %>" class="button icon-new with-text icon-new<%= step_item.tool_class.icon_name %>"><%= _('Create %s' % step_item.tool_class.short_description) %></a> | ||
24 | - <% else %> | ||
25 | - <% link_to_step(step_item, {:id => "step_link_#{step_item.id}"}, '') %> | ||
26 | - <% end %> | ||
27 | - </div> | ||
28 | - </div> | ||
29 | - </div> | ||
30 | - <div class="step_actions"> | ||
31 | - <% if step_item.allow_edit?(user) && !remove_content_button(:edit) %> | ||
32 | - <%= button('eyes', _('View'), step_item.url) %> | ||
33 | - <% content = content_tag('span', label_for_edit_article(step_item)) %> | ||
34 | - <% url = profile.admin_url.merge({ :controller => 'cms', :action => 'edit', :id => step_item.id, :success_back_to => url_for(step_item.parent.view_url) }) %> | ||
35 | - <%= expirable_button step_item, :edit, content, url %> | ||
36 | - <% end %> | ||
37 | - <% if step_item.accept_uploads? && step_item.allow_create?(user) %> | ||
38 | - <%= button('upload-file', _('Upload files'), profile.admin_url.merge(:controller => 'cms', :action => 'upload_files', :parent_id => step_item)) unless remove_content_button(:upload)%> | ||
39 | - <% end %> | ||
40 | - </div> | ||
41 | -</li> |
plugins/community_track/views/content_viewer/step.html.erb
0 → 100644
@@ -0,0 +1,28 @@ | @@ -0,0 +1,28 @@ | ||
1 | +<div id="step"> | ||
2 | + <div class="event-info"> | ||
3 | + <ul class="event-data"> | ||
4 | + <li class="event-dates"> | ||
5 | + <span><%= _('When:') %></span><%= show_period(step.start_date, step.end_date) %> | ||
6 | + </li> | ||
7 | + </ul> | ||
8 | + </div> | ||
9 | + <div> | ||
10 | + <%= step.body %> | ||
11 | + </div> | ||
12 | + <% if step.allow_create?(user) && !step.tool && step.tool_class %> | ||
13 | + <h3><%= _("Tool") %></h3> | ||
14 | + <div class="actions"> | ||
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 | + </div> | ||
17 | + <% end %> | ||
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> | ||
25 | + </div> | ||
26 | + </div> | ||
27 | + <% end %> | ||
28 | +</div> |
plugins/community_track/views/content_viewer/step.rhtml
@@ -1,28 +0,0 @@ | @@ -1,28 +0,0 @@ | ||
1 | -<div id="step"> | ||
2 | - <div class="event-info"> | ||
3 | - <ul class="event-data"> | ||
4 | - <li class="event-dates"> | ||
5 | - <span><%= _('When:') %></span><%= show_period(step.start_date, step.end_date) %> | ||
6 | - </li> | ||
7 | - </ul> | ||
8 | - </div> | ||
9 | - <div> | ||
10 | - <%= step.body %> | ||
11 | - </div> | ||
12 | - <% if step.allow_create?(user) && !step.tool && step.tool_class %> | ||
13 | - <h3><%= _("Tool") %></h3> | ||
14 | - <div class="actions"> | ||
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 | - </div> | ||
17 | - <% end %> | ||
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> | ||
25 | - </div> | ||
26 | - </div> | ||
27 | - <% end %> | ||
28 | -</div> |
plugins/community_track/views/content_viewer/track.html.erb
0 → 100644
@@ -0,0 +1,42 @@ | @@ -0,0 +1,42 @@ | ||
1 | +<% extend CommunityTrackPlugin::StepHelper %> | ||
2 | + | ||
3 | +<%= form_tag({:controller => 'community_track_plugin_myprofile', :action => 'save_order', :track => track}) do %> | ||
4 | +<div id="track"> | ||
5 | + <div> | ||
6 | + <%= track.body %> | ||
7 | + </div> | ||
8 | + | ||
9 | + <h3><%= _("Steps") %></h3> | ||
10 | + | ||
11 | + <% if track.allow_create?(user) %> | ||
12 | + <div class="track actions"> | ||
13 | + <%= content_tag('a', :href => url_for({:controller => 'cms', :action => 'new', :type => "CommunityTrackPlugin::Step", :parent_id => track.id}), :class => 'button with-text icon-add') do %> | ||
14 | + <strong><%= _("New %s") % CommunityTrackPlugin::Step.short_description %></strong> | ||
15 | + <% end %> | ||
16 | + <a href="#" class="reorder_button button with-text icon-up" onclick="enableReorder();"><%= _('Reorder Steps') %></a> | ||
17 | + <%= submit_button :save, _('Save Order'), :class => "save_button" %> | ||
18 | + </div> | ||
19 | + <script> | ||
20 | + function enableReorder() { | ||
21 | + jQuery(".reorder_button").hide(); | ||
22 | + jQuery(".save_button").show(); | ||
23 | + jQuery("#sortable li").addClass("ui-state-default"); | ||
24 | + jQuery("#sortable").sortable(); | ||
25 | + jQuery("#sortable").disableSelection(); | ||
26 | + } | ||
27 | + </script> | ||
28 | + <% end %> | ||
29 | + | ||
30 | + <ul id="sortable" class="step_list"> | ||
31 | + <%= render :partial => 'step_item', :collection => track.steps %> | ||
32 | + </ul> | ||
33 | + <% if track.allow_create?(user) && !track.hidden_steps.empty? %> | ||
34 | + <div id="hidden_steps"> | ||
35 | + <h3><%= _('Hidden Steps') %></h3> | ||
36 | + <ul class="step_list"> | ||
37 | + <%= render :partial => 'step_item', :collection => track.hidden_steps %> | ||
38 | + </ul> | ||
39 | + </div> | ||
40 | + <% end %> | ||
41 | +</div> | ||
42 | +<% end %> |
plugins/community_track/views/content_viewer/track.rhtml
@@ -1,42 +0,0 @@ | @@ -1,42 +0,0 @@ | ||
1 | -<% extend CommunityTrackPlugin::StepHelper %> | ||
2 | - | ||
3 | -<% form_tag({:controller => 'community_track_plugin_myprofile', :action => 'save_order', :track => track}) do %> | ||
4 | -<div id="track"> | ||
5 | - <div> | ||
6 | - <%= track.body %> | ||
7 | - </div> | ||
8 | - | ||
9 | - <h3><%= _("Steps") %></h3> | ||
10 | - | ||
11 | - <% if track.allow_create?(user) %> | ||
12 | - <div class="track actions"> | ||
13 | - <% content_tag('a', :href => url_for({:controller => 'cms', :action => 'new', :type => "CommunityTrackPlugin::Step", :parent_id => track.id}), :class => 'button with-text icon-add') do %> | ||
14 | - <strong><%= _("New %s") % CommunityTrackPlugin::Step.short_description %></strong> | ||
15 | - <% end %> | ||
16 | - <a href="#" class="reorder_button button with-text icon-up" onclick="enableReorder();"><%= _('Reorder Steps') %></a> | ||
17 | - <%= submit_button :save, _('Save Order'), :class => "save_button" %> | ||
18 | - </div> | ||
19 | - <script> | ||
20 | - function enableReorder() { | ||
21 | - jQuery(".reorder_button").hide(); | ||
22 | - jQuery(".save_button").show(); | ||
23 | - jQuery("#sortable li").addClass("ui-state-default"); | ||
24 | - jQuery("#sortable").sortable(); | ||
25 | - jQuery("#sortable").disableSelection(); | ||
26 | - } | ||
27 | - </script> | ||
28 | - <% end %> | ||
29 | - | ||
30 | - <ul id="sortable" class="step_list"> | ||
31 | - <%= render :partial => 'step_item', :collection => track.steps %> | ||
32 | - </ul> | ||
33 | - <% if track.allow_create?(user) && !track.hidden_steps.empty? %> | ||
34 | - <div id="hidden_steps"> | ||
35 | - <h3><%= _('Hidden Steps') %></h3> | ||
36 | - <ul class="step_list"> | ||
37 | - <%= render :partial => 'step_item', :collection => track.hidden_steps %> | ||
38 | - </ul> | ||
39 | - </div> | ||
40 | - <% end %> | ||
41 | -</div> | ||
42 | -<% end %> |