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.
- #index ⇒ Object
- #set_sled_image ⇒ Object private
- #show ⇒ Object
- #sled_image_params ⇒ Object private
-
#update ⇒ Object
PATCH/PUT /sled_images/1.json.
Methods included from DataControllerConfiguration::ProjectDataControllerConfiguration
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)
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'app/controllers/sled_images_controller.rb', line 69 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
16 17 18 19 20 21 22 23 |
# File 'app/controllers/sled_images_controller.rb', line 16 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)
65 66 67 |
# File 'app/controllers/sled_images_controller.rb', line 65 def depiction_params params[:depiction]&.permit(:is_metadata_depiction) || {} end |
#destroy ⇒ Object
DELETE /sled_images/1.json
35 36 37 38 39 40 41 42 |
# File 'app/controllers/sled_images_controller.rb', line 35 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 |
#index ⇒ Object
7 8 9 10 |
# File 'app/controllers/sled_images_controller.rb', line 7 def index @sled_images = SledImage.recent_from_project_id(sessions_current_project_id).order(updated_at: :desc).limit(10) render '/sled_images/index' end |
#set_sled_image ⇒ Object (private)
46 47 48 |
# File 'app/controllers/sled_images_controller.rb', line 46 def set_sled_image @sled_image = SledImage.where(project_id: sessions_current_project_id).find(params[:id]) end |
#show ⇒ Object
12 13 |
# File 'app/controllers/sled_images_controller.rb', line 12 def show end |
#sled_image_params ⇒ Object (private)
50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'app/controllers/sled_images_controller.rb', line 50 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
26 27 28 29 30 31 32 |
# File 'app/controllers/sled_images_controller.rb', line 26 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 |