app/helpers/scrivito_helper.rb in scrivito_sdk-1.4.3 vs app/helpers/scrivito_helper.rb in scrivito_sdk-1.5.0.rc1
- old
+ new
@@ -441,6 +441,25 @@
# for details.
def scrivito_cache(key, options=nil, &block)
workspace = Scrivito::Workspace.current
cache_if(workspace.published? && !scrivito_user, [workspace.cache_key, key], options, &block)
end
+
+ #
+ # @api public
+ #
+ # This helper can be used in the +show.html.*+ template of widgets. It allows you to specify
+ # attributes (including CSS classes) for the tag enclosing the widget.
+ #
+ # @param [Hash] html_options attributes for this tag.
+ #
+ # @example It should be wrapped around the entire template like this:
+ # <%= scrivito_widget_tag class: 'my_class', data-very-funky: true do %>
+ # <%= scrivito_image_tag widget, :image %>
+ # <% end %>
+ #
+ def scrivito_widget_tag(html_options, &block)
+ capture(&block).tap do
+ @scrivito_widget_tag_html_options = html_options
+ end
+ end
end