Module: Showcase::Traits::Record

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

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#box(*args, &block) ⇒ Object


25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/showcase/traits/record.rb', line 25

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 = 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


21
22
23
# File 'lib/showcase/traits/record.rb', line 21

def dom_class
  record_identifier.dom_class(self)
end

#dom_idObject


17
18
19
# File 'lib/showcase/traits/record.rb', line 17

def dom_id
  record_identifier.dom_id(self)
end