Commit 34ed51d11ecc754136c9cc425f01e30dd7ab4ebf

Authored by Victor Costa
1 parent 66ec5b45

rails3: fix plugin tests

Showing 22 changed files with 129 additions and 152 deletions   Show diff stats
app/models/block.rb
1 1 class Block < ActiveRecord::Base
2 2  
3   - attr_accessible :title, :display, :limit, :box_id, :posts_per_page, :visualization_format, :language, :display_user
  3 + attr_accessible :title, :display, :limit, :box_id, :posts_per_page, :visualization_format, :language, :display_user, :box
4 4  
5 5 # to be able to generate HTML
6 6 include ActionView::Helpers::UrlHelper
... ...
plugins/context_content/test/functional/context_content_plugin_profile_controller_test.rb
... ... @@ -6,7 +6,9 @@ class ContextContentPluginProfileControllerTest &lt; ActionController::TestCase
6 6  
7 7 def setup
8 8 @profile = fast_create(Community)
  9 + box = create(Box, :owner_type => 'Profile', :owner_id => @profile.id)
9 10 @block = ContextContentPlugin::ContextContentBlock.new
  11 + @block.box = box
10 12 @block.types = ['TinyMceArticle']
11 13 @block.limit = 1
12 14 @block.save!
... ...
plugins/display_content/test/unit/display_content_block_test.rb
... ... @@ -548,6 +548,7 @@ class DisplayContentBlockTest &lt; ActiveSupport::TestCase
548 548 Article.delete_all
549 549 a1 = fast_create(PluginArticle, :name => 'test article 1', :profile_id => profile.id)
550 550  
  551 + Noosfero::Plugin.stubs(:all).returns([Plugin1.name])
551 552 env = fast_create(Environment)
552 553 env.enable_plugin(Plugin1)
553 554  
... ...
plugins/mark_comment_as_read/lib/mark_comment_as_read_plugin.rb
... ... @@ -19,14 +19,14 @@ class MarkCommentAsReadPlugin &lt; Noosfero::Plugin
19 19 end
20 20  
21 21 def comment_actions(comment)
22   - lambda do
23   - [{:link => link_to_function(_('Mark as not read'), 'toggle_comment_read(this, %s, false);' % url_for(:controller => 'mark_comment_as_read_plugin_profile', :profile => profile.identifier, :action => 'mark_as_not_read', :id => comment.id).to_json, :class => 'comment-footer comment-footer-link comment-footer-hide comment-action-extra', :style => 'display: none', :id => "comment-action-mark-as-not-read-#{comment.id}")},
24   - {:link => link_to_function(_('Mark as read'), 'toggle_comment_read(this, %s, true);' % url_for(:controller => 'mark_comment_as_read_plugin_profile', :profile => profile.identifier, :action => 'mark_as_read', :id => comment.id).to_json, :class => 'comment-footer comment-footer-link comment-footer-hide comment-action-extra', :style => 'display: none', :id => "comment-action-mark-as-read-#{comment.id}")}] if user
  22 + proc do
  23 + [{:link => link_to_function(_('Mark as not read'), 'toggle_comment_read(this, \'%s\', false);' % url_for(:controller => 'mark_comment_as_read_plugin_profile', :profile => profile.identifier, :action => 'mark_as_not_read', :id => comment.id), :class => 'comment-footer comment-footer-link comment-footer-hide comment-action-extra', :style => 'display: none', :id => "comment-action-mark-as-not-read-#{comment.id}")},
  24 + {:link => link_to_function(_('Mark as read'), 'toggle_comment_read(this, \'%s\', true);' % url_for(:controller => 'mark_comment_as_read_plugin_profile', :profile => profile.identifier, :action => 'mark_as_read', :id => comment.id), :class => 'comment-footer comment-footer-link comment-footer-hide comment-action-extra', :style => 'display: none', :id => "comment-action-mark-as-read-#{comment.id}")}] if user
25 25 end
26 26 end
27 27  
28 28 def check_comment_actions(comment)
29   - lambda do
  29 + proc do
30 30 if user
31 31 comment.marked_as_read?(user) ? "#comment-action-mark-as-not-read-#{comment.id}" : "#comment-action-mark-as-read-#{comment.id}"
32 32 end
... ... @@ -34,7 +34,7 @@ class MarkCommentAsReadPlugin &lt; Noosfero::Plugin
34 34 end
35 35  
36 36 def article_extra_contents(article)
37   - lambda do
  37 + proc do
38 38 if user
39 39 ids = article.comments.marked_as_read(user).collect { |comment| comment.id}
40 40 "<script type=\"text/javascript\">mark_comments_as_read(#{ids.to_json});</script>" if !ids.empty?
... ...
plugins/mark_comment_as_read/lib/mark_comment_as_read_plugin/read_comments.rb
1   -class MarkCommentAsReadPlugin::ReadComments < Noosfero::Plugin::ActiveRecord
  1 +class MarkCommentAsReadPlugin::ReadComments < ActiveRecord::Base
2 2 set_table_name 'mark_comment_as_read_plugin'
3 3 belongs_to :comment
4 4 belongs_to :person
... ...
plugins/mark_comment_as_read/test/unit/mark_comment_as_read_plugin/comment_test.rb
... ... @@ -5,7 +5,7 @@ class MarkCommentAsReadPlugin::CommentTest &lt; ActiveSupport::TestCase
5 5 def setup
6 6 @person = create_user('user').person
7 7 @article = TinyMceArticle.create!(:profile => @person, :name => 'An article')
8   - @comment = Comment.create!(:title => 'title', :body => 'body', :author_id => @person.id, :source => @article)
  8 + @comment = Comment.create!(:title => 'title', :body => 'body', :author => @person, :source => @article)
9 9 end
10 10  
11 11 should 'mark comment as read' do
... ... @@ -16,7 +16,7 @@ class MarkCommentAsReadPlugin::CommentTest &lt; ActiveSupport::TestCase
16 16  
17 17 should 'do not mark a comment as read again' do
18 18 @comment.mark_as_read(@person)
19   - assert_raise ActiveRecord::StatementInvalid do
  19 + assert_raise ActiveRecord::RecordNotUnique do
20 20 @comment.mark_as_read(@person)
21 21 end
22 22 end
... ...
plugins/relevant_content/lib/ext/article.rb
... ... @@ -2,7 +2,7 @@ require_dependency &#39;article&#39;
2 2  
3 3 class Article
4 4  
5   - named_scope :relevant_content, :conditions => ["articles.published = true and (articles.type != 'UploadedFile' and articles.type != 'Blog' and articles.type != 'RssFeed') OR articles.type is NULL"]
  5 + scope :relevant_content, :conditions => ["articles.published = true and (articles.type != 'UploadedFile' and articles.type != 'Blog' and articles.type != 'RssFeed') OR articles.type is NULL"]
6 6  
7 7 def self.articles_columns
8 8 Article.column_names.map {|c| "articles.#{c}"} .join(",")
... ...
plugins/relevant_content/lib/relevant_content_plugin/relevant_content_block.rb
... ... @@ -18,7 +18,9 @@ class RelevantContentPlugin::RelevantContentBlock &lt; Block
18 18 settings_items :show_most_disliked, :type => :boolean, :default => 0
19 19 settings_items :show_most_voted, :type => :boolean, :default => 1
20 20  
21   - include ActionController::UrlWriter
  21 + include ActionView::Helpers
  22 + include Rails.application.routes.url_helpers
  23 +
22 24 def content(args={})
23 25  
24 26 content = block_title(title)
... ... @@ -90,4 +92,4 @@ class RelevantContentPlugin::RelevantContentBlock &lt; Block
90 92 { :profile => [:article], :environment => [:article] }
91 93 end
92 94  
93   -end
94 95 \ No newline at end of file
  96 +end
... ...
plugins/relevant_content/views/box_organizer/relevant_content_plugin/_relevant_content_block.html.erb 0 → 100644
... ... @@ -0,0 +1,8 @@
  1 +<div id='edit-relevant-content-block'>
  2 + <%= labelled_form_field _('Limit of items per category'), text_field(:block, :limit, :size => 3) %>
  3 + <%= labelled_check_box _('Display most accessed content'), "block[show_most_read]", 1 ,@block.show_most_read %><BR>
  4 + <%= labelled_check_box _('Display most commented content'), "block[show_most_commented]", 1 ,@block.show_most_commented %><BR>
  5 + <%= labelled_check_box _('Display most liked content'), "block[show_most_liked]", 1 ,@block.show_most_liked %><BR>
  6 + <%= labelled_check_box _('Display most voted content'), "block[show_most_voted]", 1 ,@block.show_most_voted %><BR>
  7 + <%= labelled_check_box _('Display most disliked content'), "block[show_most_disliked]", 1 , @block.show_most_disliked %><BR>
  8 +</div>
0 9 \ No newline at end of file
... ...
plugins/relevant_content/views/box_organizer/relevant_content_plugin/_relevant_content_block.rhtml
... ... @@ -1,8 +0,0 @@
1   -<div id='edit-relevant-content-block'>
2   - <%= labelled_form_field _('Limit of items per category'), text_field(:block, :limit, :size => 3) %>
3   - <%= labelled_check_box _('Display most accessed content'), "block[show_most_read]", 1 ,@block.show_most_read %><BR>
4   - <%= labelled_check_box _('Display most commented content'), "block[show_most_commented]", 1 ,@block.show_most_commented %><BR>
5   - <%= labelled_check_box _('Display most liked content'), "block[show_most_liked]", 1 ,@block.show_most_liked %><BR>
6   - <%= labelled_check_box _('Display most voted content'), "block[show_most_voted]", 1 ,@block.show_most_voted %><BR>
7   - <%= labelled_check_box _('Display most disliked content'), "block[show_most_disliked]", 1 , @block.show_most_disliked %><BR>
8   -</div>
9 0 \ No newline at end of file
plugins/require_auth_to_comment/lib/require_auth_to_comment_plugin.rb
... ... @@ -17,7 +17,7 @@ class RequireAuthToCommentPlugin &lt; Noosfero::Plugin
17 17 end
18 18  
19 19 def profile_editor_extras
20   - expanded_template('profile-editor-extras.rhtml')
  20 + expanded_template('profile-editor-extras.html.erb')
21 21 end
22 22  
23 23 def stylesheet?
... ...
plugins/require_auth_to_comment/views/profile-editor-extras.html.erb 0 → 100644
... ... @@ -0,0 +1,4 @@
  1 +<h2><%= _('Comments') %></h2>
  2 +<div>
  3 +<%= labelled_check_box(_('Accept comments from unauthenticated users'), 'profile_data[allow_unauthenticated_comments]', true, context.profile.allow_unauthenticated_comments) %>
  4 +</div>
... ...
plugins/require_auth_to_comment/views/profile-editor-extras.rhtml
... ... @@ -1,4 +0,0 @@
1   -<h2><%= _('Comments') %></h2>
2   -<div>
3   -<%= labelled_check_box(_('Accept comments from unauthenticated users'), 'profile_data[allow_unauthenticated_comments]', true, context.profile.allow_unauthenticated_comments) %>
4   -</div>
plugins/statistics/lib/statistics_block.rb
... ... @@ -9,6 +9,8 @@ class StatisticsBlock &lt; Block
9 9 settings_items :hit_counter, :default => false
10 10 settings_items :templates_ids_counter, Hash, :default => {}
11 11  
  12 + attr_accessible :comment_counter, :community_counter, :user_counter, :enterprise_counter, :category_counter, :tag_counter, :hit_counter, :templates_ids_counter
  13 +
12 14 USER_COUNTERS = [:community_counter, :user_counter, :enterprise_counter, :tag_counter, :comment_counter, :hit_counter]
13 15 COMMUNITY_COUNTERS = [:user_counter, :tag_counter, :comment_counter, :hit_counter]
14 16 ENTERPRISE_COUNTERS = [:user_counter, :tag_counter, :comment_counter, :hit_counter]
... ... @@ -138,7 +140,7 @@ class StatisticsBlock &lt; Block
138 140 def content(args={})
139 141 block = self
140 142  
141   - lambda do
  143 + proc do
142 144 render :file => 'statistics_block', :locals => { :block => block }
143 145 end
144 146 end
... ...
plugins/statistics/test/functional/statistics_plugin_environment_design_controller_test.rb
... ... @@ -6,13 +6,7 @@ class EnvironmentDesignController; def rescue_action(e) raise e end; end
6 6 class EnvironmentDesignControllerTest < ActionController::TestCase
7 7  
8 8 def setup
9   - @controller = EnvironmentDesignController.new
10   - @request = ActionController::TestRequest.new
11   - @response = ActionController::TestResponse.new
12   -
13   - Environment.delete_all
14   -
15   - @environment = Environment.create(:name => 'testenv', :is_default => true)
  9 + @environment = Environment.default
16 10 @environment.enabled_plugins = ['StatisticsPlugin']
17 11 @environment.save!
18 12  
... ...
plugins/statistics/test/functional/statistics_plugin_home_controller_test.rb
... ... @@ -6,13 +6,7 @@ class HomeController; def rescue_action(e) raise e end; end
6 6 class HomeControllerTest < ActionController::TestCase
7 7  
8 8 def setup
9   - @controller = HomeController.new
10   - @request = ActionController::TestRequest.new
11   - @response = ActionController::TestResponse.new
12   -
13   - Environment.delete_all
14   -
15   - @environment = Environment.create(:name => 'testenv', :is_default => true)
  9 + @environment = Environment.default
16 10 @environment.enabled_plugins = ['StatisticsPlugin']
17 11 @environment.save!
18 12  
... ...
plugins/statistics/test/functional/statistics_plugin_profile_design_controller_test.rb
... ... @@ -6,13 +6,7 @@ class ProfileDesignController; def rescue_action(e) raise e end; end
6 6 class ProfileDesignControllerTest < ActionController::TestCase
7 7  
8 8 def setup
9   - @controller = ProfileDesignController.new
10   - @request = ActionController::TestRequest.new
11   - @response = ActionController::TestResponse.new
12   -
13   - Environment.delete_all
14   -
15   - @environment = Environment.create(:name => 'testenv', :is_default => true)
  9 + @environment = Environment.default
16 10 @environment.enabled_plugins = ['StatisticsPlugin']
17 11 @environment.save!
18 12  
... ... @@ -22,7 +16,6 @@ class ProfileDesignControllerTest &lt; ActionController::TestCase
22 16  
23 17 StatisticsBlock.delete_all
24 18 @box1 = Box.create!(:owner => @person)
25   - @environment.boxes = [@box1]
26 19  
27 20 @block = StatisticsBlock.new
28 21 @block.box = @box1
... ...
plugins/statistics/test/unit/statistics_block_test.rb
... ... @@ -144,15 +144,11 @@ class StatisticsBlockTest &lt; ActiveSupport::TestCase
144 144  
145 145 p1 = fast_create(Person, :environment_id => e.id)
146 146 a1 = fast_create(Article, :profile_id => p1.id)
147   - t1 = fast_create(Tag, :name => 'T1')
148   - t2 = fast_create(Tag, :name => 'T2')
149   - a1.tags << t1
150   - a1.tags << t2
  147 + a1.tag_list.add('T1', 'T2')
  148 + a1.save!
151 149 a2 = fast_create(Article, :profile_id => p1.id)
152   - t3 = fast_create(Tag, :name => 'T3')
153   - t4 = fast_create(Tag, :name => 'T4')
154   - a2.tags << t3
155   - a2.tags << t4
  150 + a2.tag_list.add('T3', 'T4')
  151 + a2.save!
156 152  
157 153 b.expects(:owner).at_least_once.returns(e)
158 154  
... ... @@ -165,15 +161,11 @@ class StatisticsBlockTest &lt; ActiveSupport::TestCase
165 161  
166 162 c1 = fast_create(Community, :environment_id => e.id)
167 163 a1 = fast_create(Article, :profile_id => c1.id)
168   - t1 = fast_create(Tag, :name => 'T1')
169   - t2 = fast_create(Tag, :name => 'T2')
170   - a1.tags << t1
171   - a1.tags << t2
  164 + a1.tag_list.add('T1', 'T2')
  165 + a1.save!
172 166 a2 = fast_create(Article, :profile_id => c1.id)
173   - t3 = fast_create(Tag, :name => 'T3')
174   - t4 = fast_create(Tag, :name => 'T4')
175   - a2.tags << t3
176   - a2.tags << t4
  167 + a2.tag_list.add('T3', 'T4')
  168 + a2.save!
177 169  
178 170 b.expects(:owner).at_least_once.returns(c1)
179 171  
... ... @@ -186,15 +178,11 @@ class StatisticsBlockTest &lt; ActiveSupport::TestCase
186 178  
187 179 p1 = fast_create(Person, :environment_id => e.id)
188 180 a1 = fast_create(Article, :profile_id => p1.id)
189   - t1 = fast_create(Tag, :name => 'T1')
190   - t2 = fast_create(Tag, :name => 'T2')
191   - a1.tags << t1
192   - a1.tags << t2
  181 + a1.tag_list.add('T1', 'T2')
  182 + a1.save!
193 183 a2 = fast_create(Article, :profile_id => p1.id)
194   - t3 = fast_create(Tag, :name => 'T3')
195   - t4 = fast_create(Tag, :name => 'T4')
196   - a2.tags << t3
197   - a2.tags << t4
  184 + a2.tag_list.add('T3', 'T4')
  185 + a2.save!
198 186  
199 187 b.expects(:owner).at_least_once.returns(p1)
200 188  
... ... @@ -208,12 +196,12 @@ class StatisticsBlockTest &lt; ActiveSupport::TestCase
208 196 p1 = fast_create(Person, :environment_id => e.id)
209 197 a1 = fast_create(Article, :profile_id => p1.id)
210 198  
211   - Comment.create!(:source => a1, :body => 'C1', :author_id => 1)
212   - Comment.create!(:source => a1, :body => 'C2', :author_id => 1)
  199 + Comment.create!(:source => a1, :body => 'C1', :author => p1)
  200 + Comment.create!(:source => a1, :body => 'C2', :author => p1)
213 201  
214 202 a2 = fast_create(Article, :profile_id => p1.id)
215   - Comment.create!(:source => a2, :body => 'C3', :author_id => 1)
216   - Comment.create!(:source => a2, :body => 'C4', :author_id => 1)
  203 + Comment.create!(:source => a2, :body => 'C3', :author => p1)
  204 + Comment.create!(:source => a2, :body => 'C4', :author => p1)
217 205  
218 206 b.expects(:owner).at_least_once.returns(e)
219 207  
... ... @@ -224,14 +212,15 @@ class StatisticsBlockTest &lt; ActiveSupport::TestCase
224 212 b = StatisticsBlock.new
225 213 e = Environment.default
226 214  
  215 + p1 = fast_create(Person, :environment_id => e.id)
227 216 c1 = fast_create(Community, :environment_id => e.id)
228 217 a1 = fast_create(Article, :profile_id => c1.id)
229   - Comment.create!(:source => a1, :body => 'C1', :author_id => 1)
230   - Comment.create!(:source => a1, :body => 'C2', :author_id => 1)
  218 + Comment.create!(:source => a1, :body => 'C1', :author => p1)
  219 + Comment.create!(:source => a1, :body => 'C2', :author => p1)
231 220  
232 221 a2 = fast_create(Article, :profile_id => c1.id)
233   - Comment.create!(:source => a2, :body => 'C3', :author_id => 1)
234   - Comment.create!(:source => a2, :body => 'C4', :author_id => 1)
  222 + Comment.create!(:source => a2, :body => 'C3', :author => p1)
  223 + Comment.create!(:source => a2, :body => 'C4', :author => p1)
235 224  
236 225 b.expects(:owner).at_least_once.returns(c1)
237 226  
... ... @@ -244,12 +233,12 @@ class StatisticsBlockTest &lt; ActiveSupport::TestCase
244 233  
245 234 p1 = fast_create(Person, :environment_id => e.id)
246 235 a1 = fast_create(Article, :profile_id => p1.id)
247   - Comment.create!(:source => a1, :body => 'C1', :author_id => 1)
248   - Comment.create!(:source => a1, :body => 'C2', :author_id => 1)
  236 + Comment.create!(:source => a1, :body => 'C1', :author => p1)
  237 + Comment.create!(:source => a1, :body => 'C2', :author => p1)
249 238  
250 239 a2 = fast_create(Article, :profile_id => p1.id)
251   - Comment.create!(:source => a1, :body => 'C3', :author_id => 1)
252   - Comment.create!(:source => a1, :body => 'C4', :author_id => 1)
  240 + Comment.create!(:source => a1, :body => 'C3', :author => p1)
  241 + Comment.create!(:source => a1, :body => 'C4', :author => p1)
253 242  
254 243 b.expects(:owner).at_least_once.returns(p1)
255 244  
... ...
plugins/statistics/views/box_organizer/_statistics_block.html.erb 0 → 100644
... ... @@ -0,0 +1,32 @@
  1 +<%= labelled_form_field check_box(:block, :user_counter) + _('Show user counter'), '' %>
  2 +
  3 +<% if @block.is_counter_available?(:community_counter) %>
  4 +<%= labelled_form_field check_box(:block, :community_counter) + _('Show community counter'), '' %>
  5 +<% end %>
  6 +
  7 +<% if @block.is_counter_available?(:enterprise_counter) %>
  8 +<%= labelled_form_field check_box(:block, :enterprise_counter) + _('Show enterprise counter'), '' %>
  9 +<% end %>
  10 +
  11 +<% if @block.is_counter_available?(:category_counter) %>
  12 +<%= labelled_form_field check_box(:block, :category_counter) + _('Show category counter'), '' %>
  13 +<% end %>
  14 +
  15 +<% if @block.is_counter_available?(:tag_counter) %>
  16 +<%= labelled_form_field check_box(:block, :tag_counter) + _('Show tag counter'), '' %>
  17 +<% end %>
  18 +
  19 +<% if @block.is_counter_available?(:comment_counter) %>
  20 +<%= labelled_form_field check_box(:block, :comment_counter) + _('Show comment counter'), '' %>
  21 +<% end %>
  22 +
  23 +<% if @block.is_counter_available?(:hit_counter) %>
  24 +<%= labelled_form_field check_box(:block, :hit_counter) + _('Show hit counter'), '' %>
  25 +<% end %>
  26 +
  27 +<% if @block.is_counter_available?(:templates_ids_counter) %>
  28 +<% @block.templates.map do |item|%>
  29 + <%= hidden_field_tag("block[templates_ids_counter][#{item.id}]", false)%>
  30 + <%= labelled_form_field check_box_tag("block[templates_ids_counter][#{item.id}]", true, @block.is_template_counter_active?(item.id)) + _("Show counter for communities with template %s" % item.name), '' %>
  31 +<% end %>
  32 +<% end %>
... ...
plugins/statistics/views/box_organizer/_statistics_block.rhtml
... ... @@ -1,32 +0,0 @@
1   -<%= labelled_form_field check_box(:block, :user_counter) + _('Show user counter'), '' %>
2   -
3   -<% if @block.is_counter_available?(:community_counter) %>
4   -<%= labelled_form_field check_box(:block, :community_counter) + _('Show community counter'), '' %>
5   -<% end %>
6   -
7   -<% if @block.is_counter_available?(:enterprise_counter) %>
8   -<%= labelled_form_field check_box(:block, :enterprise_counter) + _('Show enterprise counter'), '' %>
9   -<% end %>
10   -
11   -<% if @block.is_counter_available?(:category_counter) %>
12   -<%= labelled_form_field check_box(:block, :category_counter) + _('Show category counter'), '' %>
13   -<% end %>
14   -
15   -<% if @block.is_counter_available?(:tag_counter) %>
16   -<%= labelled_form_field check_box(:block, :tag_counter) + _('Show tag counter'), '' %>
17   -<% end %>
18   -
19   -<% if @block.is_counter_available?(:comment_counter) %>
20   -<%= labelled_form_field check_box(:block, :comment_counter) + _('Show comment counter'), '' %>
21   -<% end %>
22   -
23   -<% if @block.is_counter_available?(:hit_counter) %>
24   -<%= labelled_form_field check_box(:block, :hit_counter) + _('Show hit counter'), '' %>
25   -<% end %>
26   -
27   -<% if @block.is_counter_available?(:templates_ids_counter) %>
28   -<% @block.templates.map do |item|%>
29   - <%= hidden_field_tag("block[templates_ids_counter][#{item.id}]", false)%>
30   - <%= labelled_form_field check_box_tag("block[templates_ids_counter][#{item.id}]", true, @block.is_template_counter_active?(item.id)) + _("Show counter for communities with template %s" % item.name), '' %>
31   -<% end %>
32   -<% end %>
plugins/statistics/views/statistics_block.html.erb 0 → 100644
... ... @@ -0,0 +1,36 @@
  1 +<h3 class="block-title">
  2 + <span><%=block.title%></span>
  3 +</h3>
  4 +<div class="statistics-block-data">
  5 + <ul>
  6 + <% if block.is_visible?('user_counter') %>
  7 + <li class="users"><span class="amount"><%= block.users%> </span><span class="label"><%= _('users')%></span></li>
  8 + <% end %>
  9 + <% if block.is_visible?('enterprise_counter') && !block.environment.enabled?('disable_asset_enterprises') %>
  10 + <li class="enterprises"><span class="amount"><%= block.enterprises%> </span><span class="label"><%= _('enterprises')%></span></li>
  11 + <% end %>
  12 + <% if block.is_visible?('community_counter') %>
  13 + <li class="communities"><span class="amount"><%= block.communities%> </span><span class="label"><%= _('communities')%></span></li>
  14 + <% end %>
  15 + <% if block.is_visible?('category_counter') %>
  16 + <li class="categories"><span class="amount"><%= block.categories%> </span><span class="label"><%= _('categories')%></span></li>
  17 + <% end %>
  18 + <% if block.is_visible?('tag_counter') %>
  19 + <li class="tags"><span class="amount"><%= block.tags%> </span><span class="label"><%= _('tags')%></span></li>
  20 + <% end %>
  21 + <% if block.is_visible?('comment_counter') %>
  22 + <li class="comments"><span class="amount"><%= block.comments%> </span><span class="label"><%= _('comments')%></span></li>
  23 + <% end %>
  24 + <% if block.is_visible?('hit_counter') %>
  25 + <li class="hits"><span class="amount"><%= block.hits%> </span><span class="label"><%= _('hits')%></span></li>
  26 + <% end %>
  27 +
  28 + <% if block.owner.kind_of?(Environment) then %>
  29 + <% block.templates.each do |item| %>
  30 + <% if block.is_template_counter_active? item.id %>
  31 + <li class="<%= item.name.to_slug%>"><span class="amount"><%= block.template_counter_count(item.id)%> </span><span class="label"><%= item.name%></span></li>
  32 + <% end %>
  33 + <% end %>
  34 + <% end %>
  35 + </ul>
  36 +</div>
... ...
plugins/statistics/views/statistics_block.rhtml
... ... @@ -1,36 +0,0 @@
1   -<h3 class="block-title">
2   - <span><%=block.title%></span>
3   -</h3>
4   -<div class="statistics-block-data">
5   - <ul>
6   - <% if block.is_visible?('user_counter') %>
7   - <li class="users"><span class="amount"><%= block.users%> </span><span class="label"><%= _('users')%></span></li>
8   - <% end %>
9   - <% if block.is_visible?('enterprise_counter') && !block.environment.enabled?('disable_asset_enterprises') %>
10   - <li class="enterprises"><span class="amount"><%= block.enterprises%> </span><span class="label"><%= _('enterprises')%></span></li>
11   - <% end %>
12   - <% if block.is_visible?('community_counter') %>
13   - <li class="communities"><span class="amount"><%= block.communities%> </span><span class="label"><%= _('communities')%></span></li>
14   - <% end %>
15   - <% if block.is_visible?('category_counter') %>
16   - <li class="categories"><span class="amount"><%= block.categories%> </span><span class="label"><%= _('categories')%></span></li>
17   - <% end %>
18   - <% if block.is_visible?('tag_counter') %>
19   - <li class="tags"><span class="amount"><%= block.tags%> </span><span class="label"><%= _('tags')%></span></li>
20   - <% end %>
21   - <% if block.is_visible?('comment_counter') %>
22   - <li class="comments"><span class="amount"><%= block.comments%> </span><span class="label"><%= _('comments')%></span></li>
23   - <% end %>
24   - <% if block.is_visible?('hit_counter') %>
25   - <li class="hits"><span class="amount"><%= block.hits%> </span><span class="label"><%= _('hits')%></span></li>
26   - <% end %>
27   -
28   - <% if block.owner.kind_of?(Environment) then %>
29   - <% block.templates.each do |item| %>
30   - <% if block.is_template_counter_active? item.id %>
31   - <li class="<%= item.name.to_slug%>"><span class="amount"><%= block.template_counter_count(item.id)%> </span><span class="label"><%= item.name%></span></li>
32   - <% end %>
33   - <% end %>
34   - <% end %>
35   - </ul>
36   -</div>