class Admin::StudentsController

Public Instance Methods

mark_all_searchable() click to toggle source

It update all student as searchable.

# File app/controllers/admin/students_controller.rb, line 14
def mark_all_searchable
  respond_to do |format|
    if Student.active.not_searchable.update_all(searchable: true)
      Student.searchable.each do |student|
        Indexer.perform_async(:update,  student.class.to_s, student.id)
      end
      format.html {redirect_via_turbolinks_to admin_students_path, alert: 'All Active student are searchable. Please allow two to five minutes to complete the process in the background before they are visible in the Search Page.'}
    else
      format.js {redirect_to collection_path, alert: 'Unable to mark all students searchable.'}
    end
  end
end
mark_searchable() click to toggle source

Update student as searchable.

# File app/controllers/admin/students_controller.rb, line 28
def mark_searchable
  respond_to do |format|
    if resource.update_attribute(:searchable, true)
      format.js {render 'referesh_datatable'}
    else
      format.js {redirect_to collection_path, alert: 'Unable to add in search.'}
    end
  end
end
resend_activation() click to toggle source

Resend the activation mail to activate the account.

# File app/controllers/admin/students_controller.rb, line 6
def resend_activation
  UserMailer.delay(queue: :mailer).activation_needed_email(resource, true)
  respond_to do |format|
    format.js {}
  end
end
unmark_searchable() click to toggle source

Update student as non searchable.

# File app/controllers/admin/students_controller.rb, line 39
def unmark_searchable
  respond_to do |format|
    if resource.update_attribute(:searchable, false)
      format.js {render 'referesh_datatable'}
    else
      format.js {redirect_to collection_path, alert: 'Unable to remove from search.'}
    end
  end
end