Class: Component::Cell::Dynamic

Inherits:
Trailblazer::Cell
  • Object
show all
Includes:
ActionView::Helpers::ActiveModelHelper, ActionView::Helpers::ActiveModelInstanceTag, ActionView::Helpers::AssetTagHelper, ActionView::Helpers::AssetUrlHelper, ActionView::Helpers::AtomFeedHelper, ActionView::Helpers::CacheHelper, ActionView::Helpers::CaptureHelper, ActionView::Helpers::CspHelper, ActionView::Helpers::CsrfHelper, ActionView::Helpers::DateHelper, ActionView::Helpers::DebugHelper, ActionView::Helpers::FormHelper, ActionView::Helpers::FormOptionsHelper, ActionView::Helpers::FormTagHelper, ActionView::Helpers::JavaScriptHelper, ActionView::Helpers::NumberHelper, ActionView::Helpers::OutputSafetyHelper, ActionView::Helpers::RecordTagHelper, ActionView::Helpers::SanitizeHelper, ActionView::Helpers::TagHelper, ActionView::Helpers::TextHelper, ActionView::Helpers::TranslationHelper, ActionView::Helpers::UrlHelper, Basemate::Ui::Core::ApplicationHelper, Cell::Haml, Shared::Utils::ToCell
Defined in:
app/concepts/component/cell/dynamic.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Basemate::Ui::Core::ApplicationHelper

#render_component, #render_page, #responder_for

Constructor Details

#initialize(model = nil, options = {}) ⇒ Dynamic

Returns a new instance of Dynamic.



36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'app/concepts/component/cell/dynamic.rb', line 36

def initialize(model=nil, options={})
  super
  @component_config = options.except(:context, :children, :url_params)
  @url_params = options[:url_params].except(:action, :controller, :component_key)
  @component_key = options[:component_key]
  @children_cells = {}
  @controller_context = context[:controller_context]
  @argument = model
  @static = false
  generate_component_name
  generate_children_cells
  setup
end

Class Method Details

.staticObject



50
51
52
# File 'app/concepts/component/cell/dynamic.rb', line 50

def self.static
  @static = true
end

Instance Method Details

#component_idObject



72
73
74
# File 'app/concepts/component/cell/dynamic.rb', line 72

def component_id
  options[:id] ||= @component_key
end

#js_action(name, arguments) ⇒ Object



76
77
78
79
80
# File 'app/concepts/component/cell/dynamic.rb', line 76

def js_action name, arguments
  argumentString = arguments.join('", "')
  argumentString = '"' + argumentString + '"'
  [name, '(', argumentString, ')'].join("")
end


82
83
84
# File 'app/concepts/component/cell/dynamic.rb', line 82

def navigate_to path
  js_action("navigateTo", [path])
end

#render_childrenObject



62
63
64
# File 'app/concepts/component/cell/dynamic.rb', line 62

def render_children
  render(view: :children)
end

#render_content(&block) ⇒ Object



66
67
68
69
70
# File 'app/concepts/component/cell/dynamic.rb', line 66

def render_content(&block)
  render do
    render_children
  end
end

#setupObject



54
55
56
# File 'app/concepts/component/cell/dynamic.rb', line 54

def setup
  true
end

#show(&block) ⇒ Object



58
59
60
# File 'app/concepts/component/cell/dynamic.rb', line 58

def show(&block)
  render(view: :dynamic, &block)
end