3.1.1
-
Injecting blocks method into controller to be able to define blocks from the controller that the view will use.
3.1.0
-
Added content_tag utility block, wrapping around Rails’ content_tag method, which may be used directly or indirectly (such as via a wrapper or hook)
-
Removed dead / outdated experimental code
-
Removed dynamic configurator (which was really just an almost copy of Rails’ class_attribute) of Blocks in favor of mattr_accessor
-
Removed Ruby 1.9.3 support, now requires >= 2.0
-
Added Extensive Test coverage
-
Deprecated Blocks::Builder#render_with_overrides and made it an alias for Blocks::Builder#render
-
Added GTM to documentation
-
Added a Rails Engine for autoconfiguration of eager_loading options
-
Moved and deprecated content_tag_wrapper utility block into Blocks::LegacyBuilders
-
Hooks and Wrappers now may render with their own sets of Hooks and Wrappers
-
Cleaned and fixed logic around generation / merging of options for hooks and and wrappers of a block
-
Moved Haml Extensions into a separate module that only executes if Haml is defined
-
Deprecated with_template method injected into ActionView::Base
-
Moved Blocks::HashWithCaller into a module and now conditionally inject based on global configuration
-
Switched Blocks::HashWithRenderStrategy to use symbols for hash keys instead of string, allowing it to be extracted as hash keyword arguments to methods
-
Removed blocks.define :collection functionality
3.0.0 (September 27, 2017)
-
Complete rewrite of the blocks gem
-
Extensive test coverage added
-
Jenkins CI integration
-
Extensive documentation added: hunterae.github.io/blocks/
-
Blocks branding and documentation styling applied: Thanks [Alexis Gormley](github.com/n2diving)
2.8.0 (January 21, 2016)
-
When rendering a collection of blocks through blocks.render BLOCK_NAME, collection: COLLECTION,
current_index will now be passed as a param for the options hash passed to the block. Example:
<% blocks.define :my_block do |object, options| %> Item <%= options[:current_index] + 1 %>: <%= object %> <% end %> <%= blocks.render :my_block, collection: ["a", "b", "c"] %>
2.7.0 (December 9, 2015)
-
Added configuration option skip_applies_to_surrounding_blocks. When set to true, if blocks.skip :SOME_BLOCK is called, any before, after, and around hooks applied to that block will also be skipped when the block attempts to render. This may be configured in an initializer as follows:
Blocks.setup { |config| config.skip_applies_to_surrounding_blocks = true }
-
Cleanup to Blocks::Base to reduce code duplication
2.6.4 (July 21, 2014)
-
Removed dependence on jeweler for managing gem
-
Small cleanups of the code
2.6.1 (November 4, 2013)
-
Made content_tag_with_block a public method in Blocks::Base so that it can be used in table-for gem.
2.6.0 (November 4, 2013)
-
Internally changed how configuration works (externally, it should feel the same, with the exception of the fact that templates_folder was changed to partials_folder… this will likely change again in the coming days)
-
Started cleaning up and rewriting some of the tests
2.5.1 (October 17, 2013)
-
Changed Blocks.wrap_with_surrounds_before_and_after_blocks to Blocks.wrap_before_and_after_blocks
2.5.0 (October 14, 2013)
-
Added skip method as a shorthand for defining or replacing a block’s definition so that nothing is output when the block is rendered
-
Added ability to wrap each block in a collection with an element or render a block with an element, using syntax like: <%= blocks.render :brand,
:collection => @brands, :wrap_each => {:tag => "div", :style => "border: 1px solid black", :class => Proc.new {cycle("even", "odd")}}, :wrap_with => {:tag => "div", :style => "color: red"} %>
<%= blocks.render :brand, :wrap_with => {:tag => “div”, :class => Proc.new {cycle(“even”, “odd”)}} %>
-
Changed blocks.surrounding_tag_surrounds_before_and_after_blocks to Blocks.wrap_with_surrounds_before_and_after_blocks
2.4.0 (September 4, 2013)
-
Moved queue and render_templates methods into the new with_template gem.
2.3.1 (September 3, 2013)
-
Removed call to autoload class that was moved into a separate gem, broke .rvmrc into .ruby-gemset and .ruby-version
2.3.0 (August 27, 2013)
-
Moved all of the call call_if_proc and call_each_hash_value_if_proc and ProcWithArgs class into a separate gem (github.com/hunterae/call_with_params), now a dependency.
2.2.0 (August 16, 2013)
-
Moved evaluated_procs and evaulated_proc into their own class and renamed to call_each_hash_value and call and created view helpers called call_each_hash_value_if_proc and call_if_proc
2.1.0 (July 3, 2013)
-
Biggest change is that this gem was moved back to the blocks repo and renamed from building-blocks to blocks, it’s original name.
-
changed rendering so that partials are no longer rendered by default
-
surrounding_tag_surrounds_before_and_after_blocks is now false, by default, meaning that if a block has a surrounding_tag, it will only render the block’s contents inside that tag, and any before and after blocks will render outside that tag.
-
allows render options to be skipped or provider new helper methods, building blocks from the controller, got rid of aliases for “blocks”, specify render order?
-
allows blocks to be defined from a controller action using the same syntax
2.0.0 (October 18, 2012)
-
Added ability to render a collection of objects and specify the surrounding elements and the html to apply to those surrounding elements For example: blocks.render :test, :collection => @cuisine_types, :as => :cuisine_type, :surrounding_tag => “div”, :surrounding_tag_html => {:class => Proc.new {cycle(“even”, “odd”)}}
-
Added ability to specify “around” blocks, i.e. blocks of view code that render around another block of code, such as: <% blocks.around :test_block do |content_block| %>
<h1> <%= content_block.call %> </h1>
<% end %> %>
-
Added a util method BuildingBlocks.render_template(self, partial, options={}, &block) that makes the templating feature easier to use (as opposed to calling the long way: BuildingBlocks::Base.new(self, options={}).render_template(partial, &block))
-
Aliased “#blocks” method that is available to views as “#buildingblocks”, “#bb”, and “#building_blocks”
-
Aliased “#after” method to “#for”, so that you can now call <%= blocks.for :block_name %> (should be slightly more familiar to users of content_for with yield)
-
Added a “#setup” method to initialize BuildingBlocks globally (for example: BuildingBlocks.setup do |config| config.template_folder = “shared” end)
-
Cleaned up the organization of the code base and now using autoload instead of require
-
Removed :use_partials_for_before_and_after_hooks option from 1.2.2
1.2.3 (February 9, 2012)
-
Created two new utility methods: evaluated_procs and evaluated_proc that allow parameters for blocks to be Proc objects so long as these methods are called to evaluate them. (These methods have been carried over and renamed from the table-for gem where they were used to be able to dynamically specify table css classes, styles, and ids at runtime).
1.2.2 (February 9, 2012)
-
Allow :use_partials and :use_partials_for_before_and_after_hooks to be passed in as initialization options to BuildingBlocks::Base to control whether BuildingBlocks attempts to render partials when “blocks.render” is called.
1.2.1 (February 7, 2012)
-
Only try to render “before” and “after” blocks as partials if that BuildingBlocks::USE_PARTIALS_FOR_BEFORE_AND_AFTER_HOOKS is globally set to true (set to false now by default)
1.2.0 (February 5, 2012)
-
Changed prototype for “use” method, such that the name of the block being rendered is now a required parameter.
-
Documented BuildingBlocks::Base more thoroughly
-
Changed the blocks.use method to blocks.render (blocks.use is still available for legacy purposes)
-
Removed the original render method and replaced with render_template that takes the partial and block to render as arguments.
1.1.0 (February 4, 2012)
-
Ability to disable use of partials when rendering a block
-
Ability to disable use of partials for before and after hooks
-
Complete test coverage
-
:template_folder and :variable options are no longer being passed in as part of the options hash to defined blocks and partials