Class: SledImagesController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- SledImagesController
- Defined in:
- app/controllers/sled_images_controller.rb
Constant Summary
Constants included from ProjectsHelper
ProjectsHelper::CLASSIFIER, ProjectsHelper::CLASSIFIER_ANNOTATION
Instance Method Summary collapse
- #collection_object_params ⇒ Object private
-
#create ⇒ Object
POST /sled_images.json.
- #depiction_params ⇒ Object private
-
#destroy ⇒ Object
DELETE /sled_images/1.json.
- #set_sled_image ⇒ Object private
- #show ⇒ Object
- #sled_image_params ⇒ Object private
-
#update ⇒ Object
PATCH/PUT /sled_images/1.json.
Methods included from RedirectHelper
Methods included from RequestType
Methods included from LogRecent
Methods included from Cookies
#digest_cookie, #digested_cookie_exists?
Methods included from Whitelist
Methods included from ProjectsHelper
#cumulative_gb_per_year, #document_cumulative_gb_per_year, #document_gb_per_year, #gb_per_year, #image_cumulative_gb_per_year, #image_gb_per_year, #invalid_object, #project_classification, #project_link, #project_matches, #project_tag, #projects_list, #projects_search_form, #taxonworks_classification, #week_in_review_graphs
Methods included from Api::Intercept
Methods included from TokenAuthentication
#intercept_project, #intercept_user, #intercept_user_or_project, #project_token_authenticate, #token_authenticate
Instance Method Details
#collection_object_params ⇒ Object (private)
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'app/controllers/sled_images_controller.rb', line 61 def collection_object_params params[:collection_object]&.permit( :total, :collecting_event_id, :repository_id, :preparation_type_id, identifiers_attributes: [:namespace_id, :identifier, :type], notes_attributes: [:text], tags_attributes: [:id, :_destroy, :keyword_id], data_attributes_attributes: [ :id, :_destroy, :controlled_vocabulary_term_id, :type, :value ], # not yet implemented taxon_determinations_attributes: [ :id, :_destroy, :otu_id, :year_made, :month_made, :day_made, roles_attributes: [ :id, :_destroy, :type, :person_id, :position, person_attributes: [:last_name, :first_name, :suffix, :prefix] ] ] ) || {} end |
#create ⇒ Object
POST /sled_images.json
8 9 10 11 12 13 14 15 |
# File 'app/controllers/sled_images_controller.rb', line 8 def create @sled_image = SledImage.new(sled_image_params) if @sled_image.save render :show, status: :created, location: @sled_image else render json: @sled_image.errors, status: :unprocessable_entity end end |
#depiction_params ⇒ Object (private)
57 58 59 |
# File 'app/controllers/sled_images_controller.rb', line 57 def depiction_params params[:depiction]&.permit(:is_metadata_depiction) || {} end |
#destroy ⇒ Object
DELETE /sled_images/1.json
27 28 29 30 31 32 33 34 |
# File 'app/controllers/sled_images_controller.rb', line 27 def destroy @sled_image.nuke = params[:nuke] @sled_image.destroy respond_to do |format| format.html { redirect_to sled_images_url, notice: 'Sled image was successfully destroyed.' } format.json { head :no_content } end end |
#set_sled_image ⇒ Object (private)
38 39 40 |
# File 'app/controllers/sled_images_controller.rb', line 38 def set_sled_image @sled_image = SledImage.where(project_id: sessions_current_project_id).find(params[:id]) end |
#show ⇒ Object
4 5 |
# File 'app/controllers/sled_images_controller.rb', line 4 def show end |
#sled_image_params ⇒ Object (private)
42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'app/controllers/sled_images_controller.rb', line 42 def sled_image_params params.require(:sled_image).permit( :image_id, :step_identifier_on, metadata: [ :index, :row, :column, :metadata, lowerCorner: [:x, :y], upperCorner: [:x, :y] ], object_layout: {} # todo ).merge( collection_object_params: collection_object_params, depiction_params: depiction_params ) end |
#update ⇒ Object
PATCH/PUT /sled_images/1.json
18 19 20 21 22 23 24 |
# File 'app/controllers/sled_images_controller.rb', line 18 def update if @sled_image.update(sled_image_params) render :show, status: :ok, location: @sled_image else render json: @sled_image.errors, status: :unprocessable_entity end end |