[Git][noosfero/noosfero][master] 2 commits: Undo block rendering workaround
Bráulio Bhavamitra
gitlab at mg.gitlab.com
Wed May 18 19:26:05 BRT 2016
Bráulio Bhavamitra pushed to branch master at Noosfero / noosfero
Commits:
b0d542fe by Rafael Reggiani Manzo at 2016-05-18T18:35:04-03:00
Undo block rendering workaround
Plugins still relied on HTML generation from within the model. This has
been refactored in terms of helpers and views requiring workaround for
thoses plugins in order to work properly.
- - - - -
69041ef5 by Bráulio Bhavamitra at 2016-05-18T22:25:52+00:00
Merge branch 'undo_blocks_workarounds' into 'master'
Undo block rendering workaround
Plugins still relied on HTML generation from within the model. This has
been refactored in terms of helpers and views requiring workaround for
thoses plugins in order to work properly.
Here is Travis' build: https://travis-ci.org/rafamanzo/noosfero/builds/131261438
See merge request !928
- - - - -
3 changed files:
- app/helpers/boxes_helper.rb
- app/models/block.rb
- test/unit/block_test.rb
Changes:
=====================================
app/helpers/boxes_helper.rb
=====================================
--- a/app/helpers/boxes_helper.rb
+++ b/app/helpers/boxes_helper.rb
@@ -99,15 +99,10 @@ module BoxesHelper
end
def render_block_content block
- # FIXME: this conditional should be removed after all
- # block footer from plugins methods get refactored into helpers and views.
- # They are a failsafe until all of them are done.
- return block.content if block.method(:content).owner != Block
render_block block
end
def render_block_footer block
- return block.footer if block.method(:footer).owner != Block
render_block block, 'footers/'
end
=====================================
app/models/block.rb
=====================================
--- a/app/models/block.rb
+++ b/app/models/block.rb
@@ -181,30 +181,6 @@ class Block < ApplicationRecord
"/images/block_preview.png"
end
- # Returns the content to be used for this block.
- #
- # This method can return several types of objects:
- #
- # * <tt>String</tt>: if the string starts with <tt>http://</tt> or <tt>https://</tt>, then it is assumed to be address of an IFRAME. Otherwise it's is used as regular HTML.
- # * <tt>Hash</tt>: the hash is used to build an URL that is used as the address for a IFRAME.
- # * <tt>Proc</tt>: the Proc is evaluated in the scope of BoxesHelper. The
- # block can then use <tt>render</tt>, <tt>link_to</tt>, etc.
- #
- # The method can also return <tt>nil</tt>, which means "no content".
- #
- # See BoxesHelper#extract_block_content for implementation details.
- def content(args={})
- "This is block number %d" % self.id
- end
-
- # A footer to be appended to the end of the block. Returns <tt>nil</tt>.
- #
- # Override in your subclasses. You can return the same types supported by
- # #content.
- def footer
- nil
- end
-
# Is this block editable? (Default to <tt>true</tt>)
def editable?(user=nil)
self.edit_modes == "all"
=====================================
test/unit/block_test.rb
=====================================
--- a/test/unit/block_test.rb
+++ b/test/unit/block_test.rb
@@ -23,10 +23,6 @@ class BlockTest < ActiveSupport::TestCase
assert_nil Block.new.owner
end
- should 'provide no footer by default' do
- assert_nil Block.new.footer
- end
-
should 'provide an empty default title' do
assert_equal '', Block.new.default_title
end
View it on GitLab: https://gitlab.com/noosfero/noosfero/compare/a994ce63a5e4e7cd61025fab3dc162a62c1b00ce...69041ef55b6df9bba11c4b025e08e4bb70dc5af3
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20160518/8a5258dc/attachment-0001.html>
More information about the Noosfero-dev
mailing list