Skip to content

Commit

Permalink
document some concerning issues about AdminSetOptionsPresenter's use
Browse files Browse the repository at this point in the history
  • Loading branch information
tom johnson committed May 8, 2020
1 parent 94df518 commit 7883c6b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions app/presenters/hyrax/admin_set_options_presenter.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
module Hyrax
# Presents the options for the AdminSet widget on the create/edit form
class AdminSetOptionsPresenter
##
# @param [Hyrax::AdminSetService] service
def initialize(service)
@service = service
end

# Return AdminSet selectbox options based on access type
#
# @todo this hits the Solr from the view. it would be better to avoid this.
#
# @param [Symbol] access :deposit, :read, or :edit
def select_options(access = :deposit)
@service.search_results(access).map do |admin_set|
Expand Down
2 changes: 1 addition & 1 deletion app/views/hyrax/base/_form_relationships.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<% if Flipflop.assign_admin_set? %>
<%# TODO: consider `Hyrax::AdminSetOptionsPresenter.select_options_for(controller: controller)` instead %>
<%# TODO: avoid direct dependency on AdminSetService and AdminSetOptionsPresenter in the view!! make the controller provide the options! %>
<%= f.input :admin_set_id, as: :select,
include_blank: false,
collection: Hyrax::AdminSetOptionsPresenter.new(Hyrax::AdminSetService.new(controller)).select_options,
Expand Down

0 comments on commit 7883c6b

Please sign in to comment.