Class: Hyrax::SelectTypePresenter

Inherits:
Object
  • Object
show all
Defined in:
app/presenters/hyrax/select_type_presenter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(concern) ⇒ SelectTypePresenter

Returns a new instance of SelectTypePresenter.



3
4
5
# File 'app/presenters/hyrax/select_type_presenter.rb', line 3

def initialize(concern)
  @concern = concern
end

Instance Attribute Details

#concernObject (readonly)

Returns the value of attribute concern.



7
8
9
# File 'app/presenters/hyrax/select_type_presenter.rb', line 7

def concern
  @concern
end

Instance Method Details

#descriptionObject



13
14
15
# File 'app/presenters/hyrax/select_type_presenter.rb', line 13

def description
  translate('description')
end

#icon_classObject



9
10
11
# File 'app/presenters/hyrax/select_type_presenter.rb', line 9

def icon_class
  ModelIcon.css_class_for(concern)
end

#nameObject



17
18
19
# File 'app/presenters/hyrax/select_type_presenter.rb', line 17

def name
  translate('name')
end

#switch_to_batch_upload_path(route_set:, params:) ⇒ Object



30
31
32
33
34
35
36
37
# File 'app/presenters/hyrax/select_type_presenter.rb', line 30

def switch_to_batch_upload_path(route_set:, params:)
  col_id = collection_id(params)
  if col_id
    route_set.new_batch_upload_path(payload_concern: concern, add_works_to_collection: col_id)
  else
    route_set.new_batch_upload_path(payload_concern: concern)
  end
end

#switch_to_new_work_path(route_set:, params:) ⇒ Object



21
22
23
24
25
26
27
28
# File 'app/presenters/hyrax/select_type_presenter.rb', line 21

def switch_to_new_work_path(route_set:, params:)
  col_id = collection_id(params)
  if col_id
    route_set.new_polymorphic_path(concern, add_works_to_collection: col_id)
  else
    route_set.new_polymorphic_path(concern)
  end
end