Class: Satis::Attachments::Component

Inherits:
Satis::ApplicationComponent show all
Defined in:
app/components/satis/attachments/component.rb

Instance Attribute Summary collapse

Attributes inherited from Satis::ApplicationComponent

#original_view_context

Instance Method Summary collapse

Methods inherited from Satis::ApplicationComponent

add_helper, #component_name

Constructor Details

#initialize(model, attribute, **options) ⇒ Component

Returns a new instance of Component.



6
7
8
9
10
11
12
# File 'app/components/satis/attachments/component.rb', line 6

def initialize(model, attribute, **options)
  super()
  @form = options[:form]
  @model = model || form.object
  @attribute = attribute
  @attachments_options = options
end

Instance Attribute Details

#attachments_optionsObject (readonly)

Returns the value of attribute attachments_options.



4
5
6
# File 'app/components/satis/attachments/component.rb', line 4

def attachments_options
  @attachments_options
end

#attributeObject (readonly)

Returns the value of attribute attribute.



4
5
6
# File 'app/components/satis/attachments/component.rb', line 4

def attribute
  @attribute
end

#formObject (readonly)

Returns the value of attribute form.



4
5
6
# File 'app/components/satis/attachments/component.rb', line 4

def form
  @form
end

#modelObject (readonly)

Returns the value of attribute model.



4
5
6
# File 'app/components/satis/attachments/component.rb', line 4

def model
  @model
end

Instance Method Details

#model_sgidObject



14
15
16
# File 'app/components/satis/attachments/component.rb', line 14

def model_sgid
  @model.to_sgid(expires_in: nil, for: "satis_attachments")
end