Module: GestartShowcase::Traits::Record

Extended by:
ActiveSupport::Concern
Defined in:
lib/gestart_showcase/traits/record.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#box(*args, &block) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/gestart_showcase/traits/record.rb', line 28

def box(*args, &block)
  options = args.extract_options!
  tag = args.pop || :div

  config_block = self.__decorator_class__.__box_config_block__
  config_options = if config_block
                     Helpers::ConfigObject.new(self, &config_block).to_struct.html_options
                   else
                     {}
                   end

  html_options = Helpers::HtmlOptions.new(config_options)
  html_options.merge_attrs!(options)
  html_options.add_class!(dom_class)
  html_options.merge_attrs!(id: dom_id)

  h.(tag, html_options.to_h) do
    h.capture(self, &block)
  end
end

#dom_classObject



24
25
26
# File 'lib/gestart_showcase/traits/record.rb', line 24

def dom_class
  record_identifier.dom_class(self)
end

#dom_idObject



20
21
22
# File 'lib/gestart_showcase/traits/record.rb', line 20

def dom_id
  record_identifier.dom_id(self)
end