Class: Refinery::Admin::GroupPresenter
- Inherits:
-
Object
- Object
- Refinery::Admin::GroupPresenter
- Includes:
- ActionView::Helpers::TagHelper, ImagesHelper
- Defined in:
- app/presenters/refinery/admin/group_presenter.rb
Overview
Refinery::Admin::GroupPresenter
This class represents a presenter for organizing and displaying groups with associated metadata in a structured format.
The presenter utilizes several helper modules for enhanced functionality and template rendering support.
Includes:
-
‘Refinery::Admin::ImagesHelper` - Provides image-related functionality.
-
‘ActionView::Helpers::TagHelper` - Used to create HTML-like tags dynamically.
Attributes:
-
‘context` [Object] - Represents the context within which the presenter operates.
-
‘groups` [Object] - Holds a collection of groups to be managed.
-
‘group_classes` [Array] - Provides a list of CSS class names applied to the group tag.
-
‘group_header` [Proc] - Callable object (e.g., lambda) to determine the header for each group.
-
‘group_headers` [Boolean] - Controls whether group headers are displayed.
-
‘group_tag` [Symbol] - Defines the tag used to wrap groups, e.g., `:ul`.
-
‘group_wrapper` [Proc] - Customizable wrapper for rendering group collections.
-
‘header` [Proc] - Callable object to format the header for individual groups.
-
‘header_tag` [Symbol] - Specifies the tag for rendering headers, e.g., `:h3`.
-
‘identity_keys` [Object] - Additional attribute for handling unique identity keys.
Public Instance Methods:
-
‘initialize(context)` Initializes a new instance of the presenter within a given context, setting default values for various attributes like headers and tags.
-
‘group_wrapper(&block)` Wraps the rendering of groups using a specified tag. This is customizable via the `group_tag` and `group_classes` attributes. A block must be passed to render the inner contents.
-
‘group_header(date)` Constructs a header for individual groups based on a provided date. The format of the header is defined by the `header` callable and displayed using the specified `header_tag`.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#context ⇒ Object
Returns the value of attribute context.
-
#group_classes ⇒ Object
Returns the value of attribute group_classes.
-
#group_header(date) ⇒ Object
Returns the value of attribute group_header.
-
#group_headers ⇒ Object
Returns the value of attribute group_headers.
-
#group_tag ⇒ Object
Returns the value of attribute group_tag.
-
#group_wrapper(&block) ⇒ Object
Returns the value of attribute group_wrapper.
-
#groups ⇒ Object
Returns the value of attribute groups.
-
#header ⇒ Object
Returns the value of attribute header.
-
#header_tag ⇒ Object
Returns the value of attribute header_tag.
-
#identity_keys ⇒ Object
Returns the value of attribute identity_keys.
Instance Method Summary collapse
-
#initialize(context) ⇒ GroupPresenter
constructor
A new instance of GroupPresenter.
Methods included from ImagesHelper
#locale_text_icon, #other_image_views, #thumbnail_urls
Constructor Details
#initialize(context) ⇒ GroupPresenter
Returns a new instance of GroupPresenter.
49 50 51 52 53 54 55 |
# File 'app/presenters/refinery/admin/group_presenter.rb', line 49 def initialize(context) @context = context @group_headers = true @group_tag = :ul @group_classes = [:image_group] @header_tag = :h3 end |
Instance Attribute Details
#context ⇒ Object
Returns the value of attribute context.
46 47 48 |
# File 'app/presenters/refinery/admin/group_presenter.rb', line 46 def context @context end |
#group_classes ⇒ Object
Returns the value of attribute group_classes.
46 47 48 |
# File 'app/presenters/refinery/admin/group_presenter.rb', line 46 def group_classes @group_classes end |
#group_header(date) ⇒ Object
Returns the value of attribute group_header.
46 47 48 |
# File 'app/presenters/refinery/admin/group_presenter.rb', line 46 def group_header @group_header end |
#group_headers ⇒ Object
Returns the value of attribute group_headers.
46 47 48 |
# File 'app/presenters/refinery/admin/group_presenter.rb', line 46 def group_headers @group_headers end |
#group_tag ⇒ Object
Returns the value of attribute group_tag.
46 47 48 |
# File 'app/presenters/refinery/admin/group_presenter.rb', line 46 def group_tag @group_tag end |
#group_wrapper(&block) ⇒ Object
Returns the value of attribute group_wrapper.
46 47 48 |
# File 'app/presenters/refinery/admin/group_presenter.rb', line 46 def group_wrapper @group_wrapper end |
#groups ⇒ Object
Returns the value of attribute groups.
46 47 48 |
# File 'app/presenters/refinery/admin/group_presenter.rb', line 46 def groups @groups end |
#header ⇒ Object
Returns the value of attribute header.
46 47 48 |
# File 'app/presenters/refinery/admin/group_presenter.rb', line 46 def header @header end |
#header_tag ⇒ Object
Returns the value of attribute header_tag.
46 47 48 |
# File 'app/presenters/refinery/admin/group_presenter.rb', line 46 def header_tag @header_tag end |
#identity_keys ⇒ Object
Returns the value of attribute identity_keys.
46 47 48 |
# File 'app/presenters/refinery/admin/group_presenter.rb', line 46 def identity_keys @identity_keys end |