Module: Sufia::MyControllerBehavior

Extended by:
ActiveSupport::Concern
Includes:
Blacklight::Catalog, Hydra::BatchEditBehavior, Hydra::Collections::SelectsCollections
Included in:
MyController
Defined in:
app/controllers/concerns/sufia/my_controller_behavior.rb

Instance Method Summary collapse

Instance Method Details

#controller_nameObject

specify the controller_name here to specify where we should look for the batch_edit menu options (_batch_edits_actions.html.erb)



31
32
33
# File 'app/controllers/concerns/sufia/my_controller_behavior.rb', line 31

def controller_name
  :my
end

#indexObject



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'app/controllers/concerns/sufia/my_controller_behavior.rb', line 35

def index
  (@response, @document_list) = get_search_results
  @user = current_user
  @events = @user.events(100)
  @last_event_timestamp = @user.events.first[:timestamp].to_i || 0 rescue 0
  @filters = params[:f] || []

  # set up some parameters for allowing the batch controls to show appropiately
  @max_batch_size = 80
  count_on_page = @document_list.count {|doc| batch.index(doc.id)}
  @disable_select_all = @document_list.count > @max_batch_size
  batch_size = batch.uniq.size
  @result_set_size = @response.response["numFound"]
  @empty_batch = batch.empty?
  @all_checked = (count_on_page == @document_list.count)
  @entire_result_set_selected = @response.response["numFound"] == batch_size
  @batch_size_on_other_page = batch_size - count_on_page
  @batch_part_on_other_page = (@batch_size_on_other_page) > 0

  respond_to do |format|
    format.html { }
    format.rss  { render layout: false }
    format.atom { render layout: false }
  end
end