Module: Card::Format::Nest::View

Included in:
Card::Format::Nest
Defined in:
lib/card/format/nest/view.rb

Overview

Renders views for a nests

Constant Summary collapse

NEST_MODES =
{ new: :edit,
closed_content: :closed,
setup: :edit,
edit: :edit, closed: :closed, layout: :layout,
normal: :normal, template: :template }.freeze

Instance Method Summary collapse

Instance Method Details

#nest_render(view, opts) ⇒ Object



12
13
14
# File 'lib/card/format/nest/view.rb', line 12

def nest_render view, opts
  optional_render nest_view(view), opts
end

#with_nest_mode(mode) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/card/format/nest/view.rb', line 16

def with_nest_mode mode
  if (switch_mode = NEST_MODES[mode]) && @mode != switch_mode
    old_mode = @mode
    @mode = switch_mode
    @nest_defaults = nil
  end
  result = yield
  if old_mode
    @nest_defaults = nil
    @mode = old_mode
  end
  result
end