Sha256: 941050c6ce88605bc10d05f14db2c04a285ec33ce37416693dd7f6000bfec18e

Contents?: true

Size: 1.9 KB

Versions: 5

Compression:

Stored size: 1.9 KB

Contents

# View Helpers for Hydra Batch Edit functionality
module BatchEditHelper 
  
  # determines if the given document id is in the batch
  def item_in_batch?(doc_id)
    session[:batch_document_ids] && session[:batch_document_ids].include?(doc_id) ? true : false
  end

  # Returns true if user has activated batch edit mode in session
  def batch_edit_state
    session[:batch_edit_state] ||= 'off'
  end

  # Displays the batch edit tools.  Put this in your search result page template.  We recommend putting it in catalog/_sort_and_per_page.html.erb
  def batch_edit_tools
    render :partial=>'/batch_edits/tools'
  end
  
  # Displays the button that users click when they are done selecting items for a batch.  Put this in your search result page template.  We put it in catalog/index.html
  def batch_edit_continue(label = 'Update Selected') 
    render :partial => '/batch_edits/next_page', :locals=>{:label=>label} 
  end

  # Displays the button to select/deselect items for your batch.  Call this in the index partial that's rendered for each search result.
  # @param [Hash] document the Hash (aka Solr hit) for one Solr document
  def batch_edit_select(document)
    render :partial=>'/batch_edits/add_button', :locals=>{:document=>document}
  end

  # Displays the check all button to select/deselect items for your batch.  Put this in your search result page template.  We put it in catalog/index.html
  def batch_check_all(label = 'Use all results')
    render :partial=>'/batch_edits/check_all', :locals=>{:label=>label}
  end

  # Displays the button that users click when they are done selecting items for a batch to Remove those items from the repository.  Put this in your search result page template.  We put it in catalog/index.html
  def batch_edit_delete_batch(label = 'Delete Selected', confirm = 'Are you sure?') 
    render :partial => '/batch_edits/delete_batch', :locals=>{:label=>label, :confirm=>confirm} 
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
hydra-batch-edit-0.3.1 app/helpers/batch_edit_helper.rb
hydra-batch-edit-0.3.0 app/helpers/batch_edit_helper.rb
hydra-batch-edit-0.2.0 app/helpers/batch_edit_helper.rb
hydra-batch-edit-0.1.0 app/helpers/batch_edit_helper.rb
hydra-batch-edit-0.0.7 app/helpers/batch_edit_helper.rb