app/helpers/scrivito_helper.rb in scrivito_sdk-0.60.0 vs app/helpers/scrivito_helper.rb in scrivito_sdk-0.65.0.rc1

- old
+ new

@@ -55,11 +55,11 @@ # <% end %> # <% end %> # def scrivito_tag(tag_name, obj_or_widget, field_name, html_options = {}, &block) Scrivito::CmsFieldTag.new( - self, tag_name, obj_or_widget, field_name.to_s + self, tag_name, obj_or_widget, field_name.to_s, @scrivito_default_widget_template || :show ).render(html_options, &block) end # # @api public @@ -251,9 +251,40 @@ content_tag(:div, class: 'scrivito_editing_widget_preview') do capture do concat content_tag(:div, icon, class: 'scrivito_editing_widget_visualization') concat content_tag(:div, title, class: 'scrivito_editing_widget_title') concat content_tag(:div, class: 'scrivito_editing_widget_description', &block) + end + end + end + + # + # Attribute group helper generates HTML for page details dialog and widget details dialog. + # The generated HTML has appropriate DOM structure and CSS classes, which are compatible with the CSS of the SDK. + # By using this helper you ensure, that the look of your attribute groups fits into the SDK's design. + # + # @api public + # + # @param title [String] title of the attribute group. + # @param block [Proc] content of the attribute group. + # + # @example + # <%= scrivito_details_for 'Title and Category' do %> + # <%= scrivito_tag :div, @obj, :title %> + # <%= scrivito_tag :div, @obj, :category %> + # <% end %> + # + # <%= scrivito_details_for do %> + # <%= scrivito_tag :div, @obj, :abstract %> + # <% end %> + # + def scrivito_details_for(title = nil, &block) + content_tag(:div, class: 'scrivito_content_group') do + capture do + if title + concat content_tag(:h3, title) + end + yield end end end #