Method to export all Fixxpert in csv file containing its username and email.
# File app/controllers/admin/fixxperts_controller.rb, line 76 def export_fixxperts @fixxperts = User.where('type = "Fixxpert"').order('created_at desc') report = CSV.generate() do |csv| csv << ['Username', 'Email'] @fixxperts.each do |t| username = t.name.nil? ? '-' : t.name email = t.email csv << [username, email] end end send_data( report, :type => 'text/csv; charset=utf-8; header=present', :disposition => "attachment; filename=fixxperts_list.csv" ) end
Used to send mail to intimate Fixxpert to complete profile.
# File app/controllers/admin/fixxperts_controller.rb, line 6 def intimate_profile_completion UserMailer.delay(queue: :mailer).intimation_profile_completion_email(resource, true) respond_to do |format| format.js {} end end
Method to set all Fixxpert as searchable.
# File app/controllers/admin/fixxperts_controller.rb, line 14 def mark_all_searchable respond_to do |format| if Fixxpert.active.not_searchable.update_all(searchable: true) Fixxpert.searchable.each do |fixxpert| Indexer.perform_async(:update, fixxpert.class.to_s, fixxpert.id) end format.html {redirect_via_turbolinks_to admin_fixxperts_path, alert: 'All Active fixxperts 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 fixxperts searchable.'} end end end
Method to update(mark) a Fixxpert as featured.
# File app/controllers/admin/fixxperts_controller.rb, line 28 def mark_featured respond_to do |format| if resource.update_attribute(:is_featured, '1') format.js {render 'referesh_datatable'} else format.js {redirect_to collection_path, alert: 'Unable to add in featured.'} end end end
Method to update Fixxpert as searchable.
# File app/controllers/admin/fixxperts_controller.rb, line 50 def mark_searchable respond_to do |format| if !resource.is_registration_completed? format.js {redirect_to collection_path, alert: 'Unable to make searchable, User has not completed his profile.'} else 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 end
Method to update(unmark) a Fixxpert as not featured.
# File app/controllers/admin/fixxperts_controller.rb, line 39 def unmark_featured respond_to do |format| if resource.update_attribute(:is_featured, '0') format.js {render 'referesh_datatable'} else format.js {redirect_to collection_path, alert: 'Unable to remove from featured.'} end end end
Method to update Fixxpert as non-searchable.
# File app/controllers/admin/fixxperts_controller.rb, line 65 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