Class: BiocurationClassificationsController

Inherits:
ApplicationController show all
Includes:
DataControllerConfiguration::ProjectDataControllerConfiguration
Defined in:
app/controllers/biocuration_classifications_controller.rb

Constant Summary

Constants included from ProjectsHelper

ProjectsHelper::CLASSIFIER, ProjectsHelper::CLASSIFIER_ANNOTATION

Instance Method Summary collapse

Methods included from DataControllerConfiguration::ProjectDataControllerConfiguration

#annotator_params

Methods included from RedirectHelper

#destroy_redirect

Methods included from RequestType

#json_request?

Methods included from LogRecent

#log_user_recent_route

Methods included from Cookies

#digest_cookie, #digested_cookie_exists?

Methods included from Whitelist

#whitelist_constantize

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

#intercept_api

Methods included from TokenAuthentication

#intercept_project, #intercept_user, #intercept_user_or_project, #project_token_authenticate, #token_authenticate

Instance Method Details

#biocuration_classification_paramsObject (private)



58
59
60
# File 'app/controllers/biocuration_classifications_controller.rb', line 58

def biocuration_classification_params
  params.require(:biocuration_classification).permit(:biocuration_class_id, :biocuration_classification_object_id, :biocuration_classification_object_type)
end

#createObject

POST /biocuration_classifications POST /biocuration_classifications.json



16
17
18
19
20
21
22
23
24
25
26
27
# File 'app/controllers/biocuration_classifications_controller.rb', line 16

def create
  @biocuration_classification = BiocurationClassification.new(biocuration_classification_params)
  respond_to do |format|
    if @biocuration_classification.save
      format.html { redirect_back(fallback_location: (request.referer || root_path), notice: 'Biocuration classification was successfully created.')}
      format.json { render :show, status: :created, location: @biocuration_classification }
    else
      format.html { redirect_back(fallback_location: (request.referer || root_path), notice: 'Biocuration classification was NOT successfully created.')}
      format.json { render json: @biocuration_classification.errors, status: :unprocessable_entity }
    end
  end
end

#destroyObject

DELETE /biocuration_classifications/1 DELETE /biocuration_classifications/1.json



45
46
47
48
49
50
51
# File 'app/controllers/biocuration_classifications_controller.rb', line 45

def destroy
  @biocuration_classification.destroy
  respond_to do |format|
    format.html { destroy_redirect @biocuration_classification, notice: 'Biocuration classification was successfully destroyed.' }
    format.json { head :no_content }
  end
end

#filter_paramsObject (private)

No corresponding filter.rb



63
64
65
# File 'app/controllers/biocuration_classifications_controller.rb', line 63

def filter_params
  return params.permit(:biocuration_class_id, :biocuration_classification_object_id, :biocuration_classification_object_type).merge(project_id: sessions_current_project_id)
end

#indexObject

GET /biocuration_classifications.json



8
9
10
11
12
# File 'app/controllers/biocuration_classifications_controller.rb', line 8

def index
  @biocuration_classifications = BiocurationClassification.where(filter_params).page(params[:page])
        .per(params[:per])
 
end

#set_biocuration_classificationObject (private)



54
55
56
# File 'app/controllers/biocuration_classifications_controller.rb', line 54

def set_biocuration_classification
  @biocuration_classification = BiocurationClassification.with_project_id(sessions_current_project_id).find(params[:id])
end

#updateObject

PATCH/PUT /biocuration_classifications/1 PATCH/PUT /biocuration_classifications/1.json



31
32
33
34
35
36
37
38
39
40
41
# File 'app/controllers/biocuration_classifications_controller.rb', line 31

def update
  respond_to do |format|
    if @biocuration_classification.update(biocuration_classification_params)
      format.html {redirect_back(fallback_location: (request.referer || root_path), notice: 'Biocuration classification was NOT successfully updated.')}
      format.json { head :no_content }
    else
      format.html {redirect_back(fallback_location: (request.referer || root_path), notice: 'Biocuration classification was NOT successfully updated.')}
      format.json { render json: @biocuration_classification.errors, status: :unprocessable_entity }
    end
  end
end