Class: Hyrax::AdminSetSelectionPresenter::OptionsEntry

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

Overview

Since:

  • 3.1.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(admin_set:, permission_template: nil, permit_sharing: false) ⇒ OptionsEntry

Returns a new instance of OptionsEntry.

Parameters:

Since:

  • 3.1.0



58
59
60
61
62
# File 'app/presenters/hyrax/admin_set_selection_presenter.rb', line 58

def initialize(admin_set:, permission_template: nil, permit_sharing: false)
  @admin_set = admin_set
  @permission_template = permission_template
  @permit_sharing = permit_sharing
end

Instance Attribute Details

#admin_setAdministrativeSet, SolrDocument



52
53
54
# File 'app/presenters/hyrax/admin_set_selection_presenter.rb', line 52

def admin_set
  @admin_set
end

#permission_templatePermissionTemplate

Returns:



52
# File 'app/presenters/hyrax/admin_set_selection_presenter.rb', line 52

attr_accessor :admin_set, :permission_template, :permit_sharing

#permit_sharingBoolean

Returns:

  • (Boolean)


52
# File 'app/presenters/hyrax/admin_set_selection_presenter.rb', line 52

attr_accessor :admin_set, :permission_template, :permit_sharing

Instance Method Details

#dataHash{String => Object}

Returns:

  • (Hash{String => Object})

Since:

  • 3.1.0



84
85
86
87
88
89
90
91
92
93
94
# File 'app/presenters/hyrax/admin_set_selection_presenter.rb', line 84

def data
  {}.tap do |data|
    data['data-sharing'] = permit_sharing

    if permission_template
      data.merge!(data_for(permission_template))
    else
      data['data-release-no-delay'] = true
    end
  end
end

#idString

Returns:

  • (String)

Since:

  • 3.1.0



78
79
80
# File 'app/presenters/hyrax/admin_set_selection_presenter.rb', line 78

def id
  admin_set.id.to_s
end

#labelString

Returns:

  • (String)

Since:

  • 3.1.0



72
73
74
# File 'app/presenters/hyrax/admin_set_selection_presenter.rb', line 72

def label
  Array(admin_set.title).first || admin_set.to_s
end

#resultArray<String, String, Hash>

Returns:

  • (Array<String, String, Hash>)

Since:

  • 3.1.0



66
67
68
# File 'app/presenters/hyrax/admin_set_selection_presenter.rb', line 66

def result
  [label, id, data]
end