From 34ed51d11ecc754136c9cc425f01e30dd7ab4ebf Mon Sep 17 00:00:00 2001 From: Victor Costa Date: Mon, 12 May 2014 10:11:46 -0300 Subject: [PATCH] rails3: fix plugin tests --- app/models/block.rb | 2 +- plugins/context_content/test/functional/context_content_plugin_profile_controller_test.rb | 2 ++ plugins/display_content/test/unit/display_content_block_test.rb | 1 + plugins/mark_comment_as_read/lib/mark_comment_as_read_plugin.rb | 10 +++++----- plugins/mark_comment_as_read/lib/mark_comment_as_read_plugin/read_comments.rb | 2 +- plugins/mark_comment_as_read/test/unit/mark_comment_as_read_plugin/comment_test.rb | 4 ++-- plugins/relevant_content/lib/ext/article.rb | 2 +- plugins/relevant_content/lib/relevant_content_plugin/relevant_content_block.rb | 6 ++++-- plugins/relevant_content/views/box_organizer/relevant_content_plugin/_relevant_content_block.html.erb | 8 ++++++++ plugins/relevant_content/views/box_organizer/relevant_content_plugin/_relevant_content_block.rhtml | 8 -------- plugins/require_auth_to_comment/lib/require_auth_to_comment_plugin.rb | 2 +- plugins/require_auth_to_comment/views/profile-editor-extras.html.erb | 4 ++++ plugins/require_auth_to_comment/views/profile-editor-extras.rhtml | 4 ---- plugins/statistics/lib/statistics_block.rb | 4 +++- plugins/statistics/test/functional/statistics_plugin_environment_design_controller_test.rb | 8 +------- plugins/statistics/test/functional/statistics_plugin_home_controller_test.rb | 8 +------- plugins/statistics/test/functional/statistics_plugin_profile_design_controller_test.rb | 9 +-------- plugins/statistics/test/unit/statistics_block_test.rb | 61 +++++++++++++++++++++++++------------------------------------ plugins/statistics/views/box_organizer/_statistics_block.html.erb | 32 ++++++++++++++++++++++++++++++++ plugins/statistics/views/box_organizer/_statistics_block.rhtml | 32 -------------------------------- plugins/statistics/views/statistics_block.html.erb | 36 ++++++++++++++++++++++++++++++++++++ plugins/statistics/views/statistics_block.rhtml | 36 ------------------------------------ 22 files changed, 129 insertions(+), 152 deletions(-) create mode 100644 plugins/relevant_content/views/box_organizer/relevant_content_plugin/_relevant_content_block.html.erb delete mode 100644 plugins/relevant_content/views/box_organizer/relevant_content_plugin/_relevant_content_block.rhtml create mode 100644 plugins/require_auth_to_comment/views/profile-editor-extras.html.erb delete mode 100644 plugins/require_auth_to_comment/views/profile-editor-extras.rhtml create mode 100644 plugins/statistics/views/box_organizer/_statistics_block.html.erb delete mode 100644 plugins/statistics/views/box_organizer/_statistics_block.rhtml create mode 100644 plugins/statistics/views/statistics_block.html.erb delete mode 100644 plugins/statistics/views/statistics_block.rhtml diff --git a/app/models/block.rb b/app/models/block.rb index 2ccc555..1567781 100644 --- a/app/models/block.rb +++ b/app/models/block.rb @@ -1,6 +1,6 @@ class Block < ActiveRecord::Base - attr_accessible :title, :display, :limit, :box_id, :posts_per_page, :visualization_format, :language, :display_user + attr_accessible :title, :display, :limit, :box_id, :posts_per_page, :visualization_format, :language, :display_user, :box # to be able to generate HTML include ActionView::Helpers::UrlHelper diff --git a/plugins/context_content/test/functional/context_content_plugin_profile_controller_test.rb b/plugins/context_content/test/functional/context_content_plugin_profile_controller_test.rb index 28c98fc..b6a9a24 100644 --- a/plugins/context_content/test/functional/context_content_plugin_profile_controller_test.rb +++ b/plugins/context_content/test/functional/context_content_plugin_profile_controller_test.rb @@ -6,7 +6,9 @@ class ContextContentPluginProfileControllerTest < ActionController::TestCase def setup @profile = fast_create(Community) + box = create(Box, :owner_type => 'Profile', :owner_id => @profile.id) @block = ContextContentPlugin::ContextContentBlock.new + @block.box = box @block.types = ['TinyMceArticle'] @block.limit = 1 @block.save! diff --git a/plugins/display_content/test/unit/display_content_block_test.rb b/plugins/display_content/test/unit/display_content_block_test.rb index 041cfaa..7efad58 100644 --- a/plugins/display_content/test/unit/display_content_block_test.rb +++ b/plugins/display_content/test/unit/display_content_block_test.rb @@ -548,6 +548,7 @@ class DisplayContentBlockTest < ActiveSupport::TestCase Article.delete_all a1 = fast_create(PluginArticle, :name => 'test article 1', :profile_id => profile.id) + Noosfero::Plugin.stubs(:all).returns([Plugin1.name]) env = fast_create(Environment) env.enable_plugin(Plugin1) diff --git a/plugins/mark_comment_as_read/lib/mark_comment_as_read_plugin.rb b/plugins/mark_comment_as_read/lib/mark_comment_as_read_plugin.rb index a816e21..3cb43bc 100644 --- a/plugins/mark_comment_as_read/lib/mark_comment_as_read_plugin.rb +++ b/plugins/mark_comment_as_read/lib/mark_comment_as_read_plugin.rb @@ -19,14 +19,14 @@ class MarkCommentAsReadPlugin < Noosfero::Plugin end def comment_actions(comment) - lambda do - [{: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}")}, - {: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 + proc do + [{: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}")}, + {: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 end end def check_comment_actions(comment) - lambda do + proc do if user comment.marked_as_read?(user) ? "#comment-action-mark-as-not-read-#{comment.id}" : "#comment-action-mark-as-read-#{comment.id}" end @@ -34,7 +34,7 @@ class MarkCommentAsReadPlugin < Noosfero::Plugin end def article_extra_contents(article) - lambda do + proc do if user ids = article.comments.marked_as_read(user).collect { |comment| comment.id} "" if !ids.empty? diff --git a/plugins/mark_comment_as_read/lib/mark_comment_as_read_plugin/read_comments.rb b/plugins/mark_comment_as_read/lib/mark_comment_as_read_plugin/read_comments.rb index 9ce10b7..73dcc29 100644 --- a/plugins/mark_comment_as_read/lib/mark_comment_as_read_plugin/read_comments.rb +++ b/plugins/mark_comment_as_read/lib/mark_comment_as_read_plugin/read_comments.rb @@ -1,4 +1,4 @@ -class MarkCommentAsReadPlugin::ReadComments < Noosfero::Plugin::ActiveRecord +class MarkCommentAsReadPlugin::ReadComments < ActiveRecord::Base set_table_name 'mark_comment_as_read_plugin' belongs_to :comment belongs_to :person diff --git a/plugins/mark_comment_as_read/test/unit/mark_comment_as_read_plugin/comment_test.rb b/plugins/mark_comment_as_read/test/unit/mark_comment_as_read_plugin/comment_test.rb index 8c41450..a17902b 100644 --- a/plugins/mark_comment_as_read/test/unit/mark_comment_as_read_plugin/comment_test.rb +++ b/plugins/mark_comment_as_read/test/unit/mark_comment_as_read_plugin/comment_test.rb @@ -5,7 +5,7 @@ class MarkCommentAsReadPlugin::CommentTest < ActiveSupport::TestCase def setup @person = create_user('user').person @article = TinyMceArticle.create!(:profile => @person, :name => 'An article') - @comment = Comment.create!(:title => 'title', :body => 'body', :author_id => @person.id, :source => @article) + @comment = Comment.create!(:title => 'title', :body => 'body', :author => @person, :source => @article) end should 'mark comment as read' do @@ -16,7 +16,7 @@ class MarkCommentAsReadPlugin::CommentTest < ActiveSupport::TestCase should 'do not mark a comment as read again' do @comment.mark_as_read(@person) - assert_raise ActiveRecord::StatementInvalid do + assert_raise ActiveRecord::RecordNotUnique do @comment.mark_as_read(@person) end end diff --git a/plugins/relevant_content/lib/ext/article.rb b/plugins/relevant_content/lib/ext/article.rb index 580e78d..3de1f50 100644 --- a/plugins/relevant_content/lib/ext/article.rb +++ b/plugins/relevant_content/lib/ext/article.rb @@ -2,7 +2,7 @@ require_dependency 'article' class Article - 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"] + scope :relevant_content, :conditions => ["articles.published = true and (articles.type != 'UploadedFile' and articles.type != 'Blog' and articles.type != 'RssFeed') OR articles.type is NULL"] def self.articles_columns Article.column_names.map {|c| "articles.#{c}"} .join(",") diff --git a/plugins/relevant_content/lib/relevant_content_plugin/relevant_content_block.rb b/plugins/relevant_content/lib/relevant_content_plugin/relevant_content_block.rb index 1c31c9a..c24ddfe 100644 --- a/plugins/relevant_content/lib/relevant_content_plugin/relevant_content_block.rb +++ b/plugins/relevant_content/lib/relevant_content_plugin/relevant_content_block.rb @@ -18,7 +18,9 @@ class RelevantContentPlugin::RelevantContentBlock < Block settings_items :show_most_disliked, :type => :boolean, :default => 0 settings_items :show_most_voted, :type => :boolean, :default => 1 - include ActionController::UrlWriter + include ActionView::Helpers + include Rails.application.routes.url_helpers + def content(args={}) content = block_title(title) @@ -90,4 +92,4 @@ class RelevantContentPlugin::RelevantContentBlock < Block { :profile => [:article], :environment => [:article] } end -end \ No newline at end of file +end diff --git a/plugins/relevant_content/views/box_organizer/relevant_content_plugin/_relevant_content_block.html.erb b/plugins/relevant_content/views/box_organizer/relevant_content_plugin/_relevant_content_block.html.erb new file mode 100644 index 0000000..04b03eb --- /dev/null +++ b/plugins/relevant_content/views/box_organizer/relevant_content_plugin/_relevant_content_block.html.erb @@ -0,0 +1,8 @@ +
+ <%= labelled_form_field _('Limit of items per category'), text_field(:block, :limit, :size => 3) %> + <%= labelled_check_box _('Display most accessed content'), "block[show_most_read]", 1 ,@block.show_most_read %>
+ <%= labelled_check_box _('Display most commented content'), "block[show_most_commented]", 1 ,@block.show_most_commented %>
+ <%= labelled_check_box _('Display most liked content'), "block[show_most_liked]", 1 ,@block.show_most_liked %>
+ <%= labelled_check_box _('Display most voted content'), "block[show_most_voted]", 1 ,@block.show_most_voted %>
+ <%= labelled_check_box _('Display most disliked content'), "block[show_most_disliked]", 1 , @block.show_most_disliked %>
+
\ No newline at end of file diff --git a/plugins/relevant_content/views/box_organizer/relevant_content_plugin/_relevant_content_block.rhtml b/plugins/relevant_content/views/box_organizer/relevant_content_plugin/_relevant_content_block.rhtml deleted file mode 100644 index 04b03eb..0000000 --- a/plugins/relevant_content/views/box_organizer/relevant_content_plugin/_relevant_content_block.rhtml +++ /dev/null @@ -1,8 +0,0 @@ -
- <%= labelled_form_field _('Limit of items per category'), text_field(:block, :limit, :size => 3) %> - <%= labelled_check_box _('Display most accessed content'), "block[show_most_read]", 1 ,@block.show_most_read %>
- <%= labelled_check_box _('Display most commented content'), "block[show_most_commented]", 1 ,@block.show_most_commented %>
- <%= labelled_check_box _('Display most liked content'), "block[show_most_liked]", 1 ,@block.show_most_liked %>
- <%= labelled_check_box _('Display most voted content'), "block[show_most_voted]", 1 ,@block.show_most_voted %>
- <%= labelled_check_box _('Display most disliked content'), "block[show_most_disliked]", 1 , @block.show_most_disliked %>
-
\ No newline at end of file diff --git a/plugins/require_auth_to_comment/lib/require_auth_to_comment_plugin.rb b/plugins/require_auth_to_comment/lib/require_auth_to_comment_plugin.rb index 086a078..da41a1a 100644 --- a/plugins/require_auth_to_comment/lib/require_auth_to_comment_plugin.rb +++ b/plugins/require_auth_to_comment/lib/require_auth_to_comment_plugin.rb @@ -17,7 +17,7 @@ class RequireAuthToCommentPlugin < Noosfero::Plugin end def profile_editor_extras - expanded_template('profile-editor-extras.rhtml') + expanded_template('profile-editor-extras.html.erb') end def stylesheet? diff --git a/plugins/require_auth_to_comment/views/profile-editor-extras.html.erb b/plugins/require_auth_to_comment/views/profile-editor-extras.html.erb new file mode 100644 index 0000000..4dcfb95 --- /dev/null +++ b/plugins/require_auth_to_comment/views/profile-editor-extras.html.erb @@ -0,0 +1,4 @@ +

<%= _('Comments') %>

+
+<%= labelled_check_box(_('Accept comments from unauthenticated users'), 'profile_data[allow_unauthenticated_comments]', true, context.profile.allow_unauthenticated_comments) %> +
diff --git a/plugins/require_auth_to_comment/views/profile-editor-extras.rhtml b/plugins/require_auth_to_comment/views/profile-editor-extras.rhtml deleted file mode 100644 index 4dcfb95..0000000 --- a/plugins/require_auth_to_comment/views/profile-editor-extras.rhtml +++ /dev/null @@ -1,4 +0,0 @@ -

<%= _('Comments') %>

-
-<%= labelled_check_box(_('Accept comments from unauthenticated users'), 'profile_data[allow_unauthenticated_comments]', true, context.profile.allow_unauthenticated_comments) %> -
diff --git a/plugins/statistics/lib/statistics_block.rb b/plugins/statistics/lib/statistics_block.rb index 8f5a96f..6b2306d 100644 --- a/plugins/statistics/lib/statistics_block.rb +++ b/plugins/statistics/lib/statistics_block.rb @@ -9,6 +9,8 @@ class StatisticsBlock < Block settings_items :hit_counter, :default => false settings_items :templates_ids_counter, Hash, :default => {} + attr_accessible :comment_counter, :community_counter, :user_counter, :enterprise_counter, :category_counter, :tag_counter, :hit_counter, :templates_ids_counter + USER_COUNTERS = [:community_counter, :user_counter, :enterprise_counter, :tag_counter, :comment_counter, :hit_counter] COMMUNITY_COUNTERS = [:user_counter, :tag_counter, :comment_counter, :hit_counter] ENTERPRISE_COUNTERS = [:user_counter, :tag_counter, :comment_counter, :hit_counter] @@ -138,7 +140,7 @@ class StatisticsBlock < Block def content(args={}) block = self - lambda do + proc do render :file => 'statistics_block', :locals => { :block => block } end end diff --git a/plugins/statistics/test/functional/statistics_plugin_environment_design_controller_test.rb b/plugins/statistics/test/functional/statistics_plugin_environment_design_controller_test.rb index 153f1e9..89c63ae 100644 --- a/plugins/statistics/test/functional/statistics_plugin_environment_design_controller_test.rb +++ b/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 class EnvironmentDesignControllerTest < ActionController::TestCase def setup - @controller = EnvironmentDesignController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new - - Environment.delete_all - - @environment = Environment.create(:name => 'testenv', :is_default => true) + @environment = Environment.default @environment.enabled_plugins = ['StatisticsPlugin'] @environment.save! diff --git a/plugins/statistics/test/functional/statistics_plugin_home_controller_test.rb b/plugins/statistics/test/functional/statistics_plugin_home_controller_test.rb index 2a2e546..fe327ad 100644 --- a/plugins/statistics/test/functional/statistics_plugin_home_controller_test.rb +++ b/plugins/statistics/test/functional/statistics_plugin_home_controller_test.rb @@ -6,13 +6,7 @@ class HomeController; def rescue_action(e) raise e end; end class HomeControllerTest < ActionController::TestCase def setup - @controller = HomeController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new - - Environment.delete_all - - @environment = Environment.create(:name => 'testenv', :is_default => true) + @environment = Environment.default @environment.enabled_plugins = ['StatisticsPlugin'] @environment.save! diff --git a/plugins/statistics/test/functional/statistics_plugin_profile_design_controller_test.rb b/plugins/statistics/test/functional/statistics_plugin_profile_design_controller_test.rb index ca42e64..7e59ed0 100644 --- a/plugins/statistics/test/functional/statistics_plugin_profile_design_controller_test.rb +++ b/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 class ProfileDesignControllerTest < ActionController::TestCase def setup - @controller = ProfileDesignController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new - - Environment.delete_all - - @environment = Environment.create(:name => 'testenv', :is_default => true) + @environment = Environment.default @environment.enabled_plugins = ['StatisticsPlugin'] @environment.save! @@ -22,7 +16,6 @@ class ProfileDesignControllerTest < ActionController::TestCase StatisticsBlock.delete_all @box1 = Box.create!(:owner => @person) - @environment.boxes = [@box1] @block = StatisticsBlock.new @block.box = @box1 diff --git a/plugins/statistics/test/unit/statistics_block_test.rb b/plugins/statistics/test/unit/statistics_block_test.rb index df4b188..ad7c28e 100644 --- a/plugins/statistics/test/unit/statistics_block_test.rb +++ b/plugins/statistics/test/unit/statistics_block_test.rb @@ -144,15 +144,11 @@ class StatisticsBlockTest < ActiveSupport::TestCase p1 = fast_create(Person, :environment_id => e.id) a1 = fast_create(Article, :profile_id => p1.id) - t1 = fast_create(Tag, :name => 'T1') - t2 = fast_create(Tag, :name => 'T2') - a1.tags << t1 - a1.tags << t2 + a1.tag_list.add('T1', 'T2') + a1.save! a2 = fast_create(Article, :profile_id => p1.id) - t3 = fast_create(Tag, :name => 'T3') - t4 = fast_create(Tag, :name => 'T4') - a2.tags << t3 - a2.tags << t4 + a2.tag_list.add('T3', 'T4') + a2.save! b.expects(:owner).at_least_once.returns(e) @@ -165,15 +161,11 @@ class StatisticsBlockTest < ActiveSupport::TestCase c1 = fast_create(Community, :environment_id => e.id) a1 = fast_create(Article, :profile_id => c1.id) - t1 = fast_create(Tag, :name => 'T1') - t2 = fast_create(Tag, :name => 'T2') - a1.tags << t1 - a1.tags << t2 + a1.tag_list.add('T1', 'T2') + a1.save! a2 = fast_create(Article, :profile_id => c1.id) - t3 = fast_create(Tag, :name => 'T3') - t4 = fast_create(Tag, :name => 'T4') - a2.tags << t3 - a2.tags << t4 + a2.tag_list.add('T3', 'T4') + a2.save! b.expects(:owner).at_least_once.returns(c1) @@ -186,15 +178,11 @@ class StatisticsBlockTest < ActiveSupport::TestCase p1 = fast_create(Person, :environment_id => e.id) a1 = fast_create(Article, :profile_id => p1.id) - t1 = fast_create(Tag, :name => 'T1') - t2 = fast_create(Tag, :name => 'T2') - a1.tags << t1 - a1.tags << t2 + a1.tag_list.add('T1', 'T2') + a1.save! a2 = fast_create(Article, :profile_id => p1.id) - t3 = fast_create(Tag, :name => 'T3') - t4 = fast_create(Tag, :name => 'T4') - a2.tags << t3 - a2.tags << t4 + a2.tag_list.add('T3', 'T4') + a2.save! b.expects(:owner).at_least_once.returns(p1) @@ -208,12 +196,12 @@ class StatisticsBlockTest < ActiveSupport::TestCase p1 = fast_create(Person, :environment_id => e.id) a1 = fast_create(Article, :profile_id => p1.id) - Comment.create!(:source => a1, :body => 'C1', :author_id => 1) - Comment.create!(:source => a1, :body => 'C2', :author_id => 1) + Comment.create!(:source => a1, :body => 'C1', :author => p1) + Comment.create!(:source => a1, :body => 'C2', :author => p1) a2 = fast_create(Article, :profile_id => p1.id) - Comment.create!(:source => a2, :body => 'C3', :author_id => 1) - Comment.create!(:source => a2, :body => 'C4', :author_id => 1) + Comment.create!(:source => a2, :body => 'C3', :author => p1) + Comment.create!(:source => a2, :body => 'C4', :author => p1) b.expects(:owner).at_least_once.returns(e) @@ -224,14 +212,15 @@ class StatisticsBlockTest < ActiveSupport::TestCase b = StatisticsBlock.new e = Environment.default + p1 = fast_create(Person, :environment_id => e.id) c1 = fast_create(Community, :environment_id => e.id) a1 = fast_create(Article, :profile_id => c1.id) - Comment.create!(:source => a1, :body => 'C1', :author_id => 1) - Comment.create!(:source => a1, :body => 'C2', :author_id => 1) + Comment.create!(:source => a1, :body => 'C1', :author => p1) + Comment.create!(:source => a1, :body => 'C2', :author => p1) a2 = fast_create(Article, :profile_id => c1.id) - Comment.create!(:source => a2, :body => 'C3', :author_id => 1) - Comment.create!(:source => a2, :body => 'C4', :author_id => 1) + Comment.create!(:source => a2, :body => 'C3', :author => p1) + Comment.create!(:source => a2, :body => 'C4', :author => p1) b.expects(:owner).at_least_once.returns(c1) @@ -244,12 +233,12 @@ class StatisticsBlockTest < ActiveSupport::TestCase p1 = fast_create(Person, :environment_id => e.id) a1 = fast_create(Article, :profile_id => p1.id) - Comment.create!(:source => a1, :body => 'C1', :author_id => 1) - Comment.create!(:source => a1, :body => 'C2', :author_id => 1) + Comment.create!(:source => a1, :body => 'C1', :author => p1) + Comment.create!(:source => a1, :body => 'C2', :author => p1) a2 = fast_create(Article, :profile_id => p1.id) - Comment.create!(:source => a1, :body => 'C3', :author_id => 1) - Comment.create!(:source => a1, :body => 'C4', :author_id => 1) + Comment.create!(:source => a1, :body => 'C3', :author => p1) + Comment.create!(:source => a1, :body => 'C4', :author => p1) b.expects(:owner).at_least_once.returns(p1) diff --git a/plugins/statistics/views/box_organizer/_statistics_block.html.erb b/plugins/statistics/views/box_organizer/_statistics_block.html.erb new file mode 100644 index 0000000..7bbe640 --- /dev/null +++ b/plugins/statistics/views/box_organizer/_statistics_block.html.erb @@ -0,0 +1,32 @@ +<%= labelled_form_field check_box(:block, :user_counter) + _('Show user counter'), '' %> + +<% if @block.is_counter_available?(:community_counter) %> +<%= labelled_form_field check_box(:block, :community_counter) + _('Show community counter'), '' %> +<% end %> + +<% if @block.is_counter_available?(:enterprise_counter) %> +<%= labelled_form_field check_box(:block, :enterprise_counter) + _('Show enterprise counter'), '' %> +<% end %> + +<% if @block.is_counter_available?(:category_counter) %> +<%= labelled_form_field check_box(:block, :category_counter) + _('Show category counter'), '' %> +<% end %> + +<% if @block.is_counter_available?(:tag_counter) %> +<%= labelled_form_field check_box(:block, :tag_counter) + _('Show tag counter'), '' %> +<% end %> + +<% if @block.is_counter_available?(:comment_counter) %> +<%= labelled_form_field check_box(:block, :comment_counter) + _('Show comment counter'), '' %> +<% end %> + +<% if @block.is_counter_available?(:hit_counter) %> +<%= labelled_form_field check_box(:block, :hit_counter) + _('Show hit counter'), '' %> +<% end %> + +<% if @block.is_counter_available?(:templates_ids_counter) %> +<% @block.templates.map do |item|%> + <%= hidden_field_tag("block[templates_ids_counter][#{item.id}]", false)%> + <%= 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), '' %> +<% end %> +<% end %> diff --git a/plugins/statistics/views/box_organizer/_statistics_block.rhtml b/plugins/statistics/views/box_organizer/_statistics_block.rhtml deleted file mode 100644 index 7bbe640..0000000 --- a/plugins/statistics/views/box_organizer/_statistics_block.rhtml +++ /dev/null @@ -1,32 +0,0 @@ -<%= labelled_form_field check_box(:block, :user_counter) + _('Show user counter'), '' %> - -<% if @block.is_counter_available?(:community_counter) %> -<%= labelled_form_field check_box(:block, :community_counter) + _('Show community counter'), '' %> -<% end %> - -<% if @block.is_counter_available?(:enterprise_counter) %> -<%= labelled_form_field check_box(:block, :enterprise_counter) + _('Show enterprise counter'), '' %> -<% end %> - -<% if @block.is_counter_available?(:category_counter) %> -<%= labelled_form_field check_box(:block, :category_counter) + _('Show category counter'), '' %> -<% end %> - -<% if @block.is_counter_available?(:tag_counter) %> -<%= labelled_form_field check_box(:block, :tag_counter) + _('Show tag counter'), '' %> -<% end %> - -<% if @block.is_counter_available?(:comment_counter) %> -<%= labelled_form_field check_box(:block, :comment_counter) + _('Show comment counter'), '' %> -<% end %> - -<% if @block.is_counter_available?(:hit_counter) %> -<%= labelled_form_field check_box(:block, :hit_counter) + _('Show hit counter'), '' %> -<% end %> - -<% if @block.is_counter_available?(:templates_ids_counter) %> -<% @block.templates.map do |item|%> - <%= hidden_field_tag("block[templates_ids_counter][#{item.id}]", false)%> - <%= 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), '' %> -<% end %> -<% end %> diff --git a/plugins/statistics/views/statistics_block.html.erb b/plugins/statistics/views/statistics_block.html.erb new file mode 100644 index 0000000..f9f1374 --- /dev/null +++ b/plugins/statistics/views/statistics_block.html.erb @@ -0,0 +1,36 @@ +

+ <%=block.title%> +

+
+ +
diff --git a/plugins/statistics/views/statistics_block.rhtml b/plugins/statistics/views/statistics_block.rhtml deleted file mode 100644 index f9f1374..0000000 --- a/plugins/statistics/views/statistics_block.rhtml +++ /dev/null @@ -1,36 +0,0 @@ -

- <%=block.title%> -

-
- -
-- libgit2 0.21.2