diff --git a/plugins/vote/lib/vote_plugin.rb b/plugins/vote/lib/vote_plugin.rb
index 139ca70..ecca6a0 100644
--- a/plugins/vote/lib/vote_plugin.rb
+++ b/plugins/vote/lib/vote_plugin.rb
@@ -33,7 +33,7 @@ class VotePlugin < Noosfero::Plugin
def comment_actions(comment)
like = vote_partial(comment)
dislike = vote_partial(comment, false)
- lambda do
+ proc do
[{:link => instance_eval(&dislike), :action_bar => true}, {:link => instance_eval(&like), :action_bar => true}]
end
end
@@ -41,7 +41,7 @@ class VotePlugin < Noosfero::Plugin
def article_header_extra_contents(article)
like = vote_partial(article)
dislike = vote_partial(article, false)
- lambda do
+ proc do
content_tag('div', instance_eval(&dislike) + instance_eval(&like), :class => 'vote-actions')
end
end
diff --git a/plugins/vote/lib/vote_plugin_helper.rb b/plugins/vote/lib/vote_plugin_helper.rb
index dfa4ee4..78099bb 100644
--- a/plugins/vote/lib/vote_plugin_helper.rb
+++ b/plugins/vote/lib/vote_plugin_helper.rb
@@ -5,7 +5,7 @@ module VotePluginHelper
like_action = like ? 'like' : 'dislike'
type = target.kind_of?(Article) ? 'article' : target.kind_of?(Comment) ? 'comment' : nil
- lambda do
+ proc do
settings = Noosfero::Plugin::Settings.new(environment, VotePlugin)
if settings.get_setting("enable_vote_#{type}").include?(vote)
@@ -14,7 +14,7 @@ module VotePluginHelper
active = user ? (like ? user.voted_for?(target) : user.voted_against?(target)) : false
count = like ? target.votes_for : target.votes_against
- render(:partial => 'vote/vote.rhtml', :locals => {:target => target, :active => active, :action => like_action, :count => count, :voters => voters, :vote => vote, :model => type })
+ render(:partial => 'vote/vote', :locals => {:target => target, :active => active, :action => like_action, :count => count, :voters => voters, :vote => vote, :model => type })
else
""
end
diff --git a/plugins/vote/test/unit/article_test.rb b/plugins/vote/test/unit/article_test.rb
index 7a4a0c6..8962ac2 100644
--- a/plugins/vote/test/unit/article_test.rb
+++ b/plugins/vote/test/unit/article_test.rb
@@ -9,14 +9,14 @@ class ArticleTest < ActiveSupport::TestCase
attr_reader :profile
should 'vote in a article' do
- article = Article.create!(:name => 'Test', :profile => profile, :last_changed_by => nil)
+ article = create(Article, :name => 'Test', :profile => profile, :last_changed_by => nil)
profile.vote(article, 5)
assert_equal 1, article.voters_who_voted.length
assert_equal 5, article.votes_total
end
should 'be able to remove a voted article' do
- article = Article.create!(:name => 'Test', :profile => profile, :last_changed_by => nil)
+ article = create(Article, :name => 'Test', :profile => profile, :last_changed_by => nil)
profile.vote(article, 5)
article.destroy
end
diff --git a/plugins/vote/views/vote/_vote.html.erb b/plugins/vote/views/vote/_vote.html.erb
new file mode 100644
index 0000000..57fce2d
--- /dev/null
+++ b/plugins/vote/views/vote/_vote.html.erb
@@ -0,0 +1,22 @@
+<%
+url = url_for(:controller => 'vote_plugin_profile', :profile => profile.identifier, :action => :vote, :id => target.id, :model => model, :vote => vote)
+reload_url = url_for(:controller => 'vote_plugin_profile', :profile => profile.identifier, :action => :reload_vote, :id => target.id, :model => model, :vote => vote)
+%>
+
+ class="vote-action action <%= action %>-action">
+
+ <%= link_to_remote content_tag(:span, count, :class=>'like-action-counter') + content_tag(:span, '', :class=>"action-icon #{action}"), :url => url, :html => {:class => "#{active ? 'like-action-active':''} #{user ? '':'disabled'}"} %>
+
+ <% if !voters.blank? %>
+
+
+ <% voters.each do |voter| %>
+
+
+ <% end %>
+
diff --git a/plugins/vote/views/vote/_vote.rhtml b/plugins/vote/views/vote/_vote.rhtml
deleted file mode 100644
index 57fce2d..0000000
--- a/plugins/vote/views/vote/_vote.rhtml
+++ /dev/null
@@ -1,22 +0,0 @@
-<%
-url = url_for(:controller => 'vote_plugin_profile', :profile => profile.identifier, :action => :vote, :id => target.id, :model => model, :vote => vote)
-reload_url = url_for(:controller => 'vote_plugin_profile', :profile => profile.identifier, :action => :reload_vote, :id => target.id, :model => model, :vote => vote)
-%>
-
- class="vote-action action <%= action %>-action">
-
- <%= link_to_remote content_tag(:span, count, :class=>'like-action-counter') + content_tag(:span, '', :class=>"action-icon #{action}"), :url => url, :html => {:class => "#{active ? 'like-action-active':''} #{user ? '':'disabled'}"} %>
-
- <% if !voters.blank? %>
-
-
- <% voters.each do |voter| %>
-
-
- <% end %>
-
diff --git a/plugins/vote/views/vote_plugin_admin/index.html.erb b/plugins/vote/views/vote_plugin_admin/index.html.erb
new file mode 100644
index 0000000..b479d6c
--- /dev/null
+++ b/plugins/vote/views/vote_plugin_admin/index.html.erb
@@ -0,0 +1,21 @@
+