Class: Pigeon::Renderer::ChannelRenderer
- Includes:
- ChannelHelper
- Defined in:
- app/helpers/pigeon/renderer/channel_renderer.rb
Instance Attribute Summary collapse
-
#channel ⇒ Object
Returns the value of attribute channel.
-
#output_buffer ⇒ Object
Returns the value of attribute output_buffer.
-
#scope ⇒ Object
Returns the value of attribute scope.
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(channel = nil, scope = nil) ⇒ ChannelRenderer
constructor
A new instance of ChannelRenderer.
- #render_attribute_command(v) ⇒ Object
- #render_template_command(v) ⇒ Object
Methods included from ChannelHelper
#pigeon_attribute, #pigeon_attribute_field, #pigeon_attribute_label, #pigeon_channel_attribute, #pigeon_channel_attribute_field, #pigeon_channel_attribute_label
Methods inherited from Base
#extract_options, find_handler, handle, #render, #render_at_command, #render_raw, #render_vector
Constructor Details
#initialize(channel = nil, scope = nil) ⇒ ChannelRenderer
Returns a new instance of ChannelRenderer.
14 15 16 17 |
# File 'app/helpers/pigeon/renderer/channel_renderer.rb', line 14 def initialize(channel = nil, scope = nil) self.channel = channel self.scope = scope end |
Instance Attribute Details
#channel ⇒ Object
Returns the value of attribute channel.
7 8 9 |
# File 'app/helpers/pigeon/renderer/channel_renderer.rb', line 7 def channel @channel end |
#output_buffer ⇒ Object
Returns the value of attribute output_buffer.
6 7 8 |
# File 'app/helpers/pigeon/renderer/channel_renderer.rb', line 6 def output_buffer @output_buffer end |
#scope ⇒ Object
Returns the value of attribute scope.
7 8 9 |
# File 'app/helpers/pigeon/renderer/channel_renderer.rb', line 7 def scope @scope end |
Instance Method Details
#render_attribute_command(v) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'app/helpers/pigeon/renderer/channel_renderer.rb', line 19 def render_attribute_command(v) command, , content = (v) name = content.first [:scope] = scope if scope.present? case command when '@field' pigeon_channel_attribute_field(channel, name, ) when '@label' pigeon_channel_attribute_label(channel, name, ) when '@attr' if .include?(:class) [:class] << ' pigeon_attribute' else [:class] = 'pigeon_attribute' end pigeon_channel_attribute(channel, name, ) when '@hidden' = .update({ :type => :hidden }) pigeon_channel_attribute_field(channel, name, ) else '' end end |
#render_template_command(v) ⇒ Object
44 45 46 47 48 49 50 51 52 53 |
# File 'app/helpers/pigeon/renderer/channel_renderer.rb', line 44 def render_template_command(v) command, , content = (v) if %w(@wizard @template).include?(command) ["data-scope"] ||= scope if scope.present? ["data-persisted"] = channel.persisted? ["data-kind"] = channel.kind ["data-name"] = channel.name end super([command, ] + content) end |