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.



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

def initialize(concern)
  @concern = concern
end

Instance Attribute Details

#concernObject (readonly)

Returns the value of attribute concern.



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

def concern
  @concern
end

Instance Method Details

#descriptionObject



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

def description
  translate('description')
end

#icon_classObject



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

def icon_class
  ModelIcon.css_class_for(concern)
end

#nameObject



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

def name
  translate('name', object_name.to_s.titleize)
end

#switch_to_batch_upload_path(route_set:, params:) ⇒ Object



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

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



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

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