Class: Tasks::Accessions::Breakdown::SqedDepictionController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Tasks::Accessions::Breakdown::SqedDepictionController
- Includes:
- TaskControllerConfiguration
- Defined in:
- app/controllers/tasks/accessions/breakdown/sqed_depiction_controller.rb
Instance Method Summary collapse
- #collection_object_params ⇒ Object protected
-
#index ⇒ Object
GET /tasks/accession/breakdown/depiction/:id # id is a collection_object_id.
- #set_sqed_depiction ⇒ Object protected
- #todo_map ⇒ Object
- #update ⇒ Object
Methods included from TaskControllerConfiguration
Instance Method Details
#collection_object_params ⇒ Object (protected)
44 45 46 47 48 49 50 51 52 |
# File 'app/controllers/tasks/accessions/breakdown/sqed_depiction_controller.rb', line 44 def collection_object_params params.require(:collection_object).permit( :buffered_collecting_event, :buffered_other_labels, :buffered_determinations, :total, identifiers_attributes: [:id, :namespace_id, :identifier, :type, :_destroy], tags_attributes: [:id, :keyword_id, :_destroy], taxon_determinations_attributes: [:id, :otu_id, :_destroy], notes_attributes: [:id, :text, :_destroy] ) end |
#index ⇒ Object
GET /tasks/accession/breakdown/depiction/:id # id is a collection_object_id
7 8 9 10 11 12 13 14 |
# File 'app/controllers/tasks/accessions/breakdown/sqed_depiction_controller.rb', line 7 def index @result = SqedToTaxonworks::Result.new( depiction_id: @sqed_depiction.depiction.id, namespace_id: params[:namespace_id] ) @identifier_prototype = Identifier.prototype_identifier(sessions_current_project_id, sessions_current_user_id) end |
#set_sqed_depiction ⇒ Object (protected)
54 55 56 57 |
# File 'app/controllers/tasks/accessions/breakdown/sqed_depiction_controller.rb', line 54 def set_sqed_depiction @sqed_depiction = SqedDepiction.where(project_id: sessions_current_project_id).find(params[:id]) @sqed_depiction.preprocess end |
#todo_map ⇒ Object
38 39 40 |
# File 'app/controllers/tasks/accessions/breakdown/sqed_depiction_controller.rb', line 38 def todo_map @sqed_depictions = SqedDepiction.where(project_id: sessions_current_project_id).order(:id).page(params[:page]).per(100) end |
#update ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'app/controllers/tasks/accessions/breakdown/sqed_depiction_controller.rb', line 16 def update if @sqed_depiction.depiction.depiction_object.update(collection_object_params) flash[:notice] = 'Successfully updated' else flash[:alert] = 'Failed to update! ' + @sqed_depiction.depiction.depiction_object.errors..join('; ').html_safe end next_sqed_depiction = case params[:commit] when 'Save and next w/out data [n]' @sqed_depiction.next_without_data when 'Save and next' @sqed_depiction.nearby_sqed_depictions(0, 1)[:after].first else @sqed_depiction end namespace_id = (params[:lock_namespace] ? params[:collection_object][:identifiers_attributes]['0'][:namespace_id] : nil) redirect_to sqed_depiction_breakdown_task_path(next_sqed_depiction, namespace_id) end |