[Git][noosfero/noosfero][master] 2 commits: Remove ProfileMembersHeadlinesBlock#content
Bráulio Bhavamitra
gitlab at mg.gitlab.com
Fri May 13 19:06:23 BRT 2016
Bráulio Bhavamitra pushed to branch master at Noosfero / noosfero
Commits:
c44cbbc4 by Rafael Reggiani Manzo at 2016-05-10T09:52:57-03:00
Remove ProfileMembersHeadlinesBlock#content
This method was in violation of MVC principles and its logic is now
handled by the BoxesHelper.
Minor adaptations to the view and a rename were required in order to
meet BoxesHelper expectations.
- - - - -
e6c08631 by Bráulio Bhavamitra at 2016-05-13T22:06:06+00:00
Merge branch 'refactor_profile_members_headlines' into 'master'
Remove ProfileMembersHeadlinesBlock#content
This method was in violation of MVC principles and its logic is now
handled by the BoxesHelper.
Minor adaptations to the view and a rename were required in order to
meet BoxesHelper expectations.
See merge request !908
- - - - -
3 changed files:
- plugins/profile_members_headlines/lib/profile_members_headlines_block.rb
- plugins/profile_members_headlines/test/unit/profile_members_headlines_block_test.rb
- plugins/profile_members_headlines/views/blocks/headlines.html.erb → plugins/profile_members_headlines/views/blocks/profile_members_headlines.html.erb
Changes:
=====================================
plugins/profile_members_headlines/lib/profile_members_headlines_block.rb
=====================================
--- a/plugins/profile_members_headlines/lib/profile_members_headlines_block.rb
+++ b/plugins/profile_members_headlines/lib/profile_members_headlines_block.rb
@@ -35,12 +35,4 @@ class ProfileMembersHeadlinesBlock < Block
result.select{ |p| p.has_headline? }.slice(0..limit-1)
end
- def content(args={})
- block = self
- members = authors_list
- proc do
- render :file => 'blocks/headlines', :locals => { :block => block, :members => members }
- end
- end
-
end
=====================================
plugins/profile_members_headlines/test/unit/profile_members_headlines_block_test.rb
=====================================
--- a/plugins/profile_members_headlines/test/unit/profile_members_headlines_block_test.rb
+++ b/plugins/profile_members_headlines/test/unit/profile_members_headlines_block_test.rb
@@ -1,8 +1,10 @@
require 'test_helper'
+require 'boxes_helper'
class ProfileMembersHeadlinesBlockTest < ActiveSupport::TestCase
include Noosfero::Plugin::HotSpot
+ include BoxesHelper
def setup
@environment = fast_create(Environment)
@@ -32,8 +34,8 @@ class ProfileMembersHeadlinesBlockTest < ActiveSupport::TestCase
block = ProfileMembersHeadlinesBlock.create
block.stubs(:owner).returns(community)
- self.expects(:render).with(:file => 'blocks/headlines', :locals => { :block => block, :members => []}).returns('file-without-authors-and-headlines')
- assert_equal 'file-without-authors-and-headlines', instance_eval(&block.content)
+ self.expects(:render).with(:template => 'blocks/profile_members_headlines', :locals => { :block => block }).returns('file-without-authors-and-headlines')
+ assert_equal 'file-without-authors-and-headlines', render_block_content(block)
end
should 'display headlines file' do
@@ -41,8 +43,8 @@ class ProfileMembersHeadlinesBlockTest < ActiveSupport::TestCase
block.stubs(:owner).returns(community)
blog = fast_create(Blog, :profile_id => member1.id)
post = fast_create(TinyMceArticle, :name => 'headlines', :profile_id => member1.id, :parent_id => blog.id)
- self.expects(:render).with(:file => 'blocks/headlines', :locals => { :block => block, :members => []}).returns('file-with-authors-and-headlines')
- assert_equal 'file-with-authors-and-headlines', instance_eval(&block.content)
+ self.expects(:render).with(:template => 'blocks/profile_members_headlines', :locals => { :block => block }).returns('file-with-authors-and-headlines')
+ assert_equal 'file-with-authors-and-headlines', render_block_content(block)
end
should 'select only authors with articles and selected roles to display' do
=====================================
plugins/profile_members_headlines/views/blocks/headlines.html.erb → plugins/profile_members_headlines/views/blocks/profile_members_headlines.html.erb
=====================================
--- a/plugins/profile_members_headlines/views/blocks/headlines.html.erb
+++ b/plugins/profile_members_headlines/views/blocks/profile_members_headlines.html.erb
@@ -1,4 +1,5 @@
<%= block_title(block.title, block.subtitle) %>
+<% members = block.authors_list %>
<% unless members.empty? %>
<div class='headlines-container'>
View it on GitLab: https://gitlab.com/noosfero/noosfero/compare/e1163b1c7be7bc97a04f3529423c1e9b913b52aa...e6c086315c508ee7629fdaebd97a9107874d7f99
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20160513/f5b643f4/attachment-0001.html>
More information about the Noosfero-dev
mailing list