Class: GeneAttributesController

Inherits:
ApplicationController show all
Includes:
DataControllerConfiguration::ProjectDataControllerConfiguration
Defined in:
app/controllers/gene_attributes_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

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

#createObject

POST /gene_attributes POST /gene_attributes.json



33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'app/controllers/gene_attributes_controller.rb', line 33

def create
  @gene_attribute = GeneAttribute.new(gene_attribute_params)

  respond_to do |format|
    if @gene_attribute.save
      format.html { redirect_to @gene_attribute, notice: 'Gene attribute was successfully created.' }
      format.json { render :show, status: :created, location: @gene_attribute }
    else
      format.html { render :new }
      format.json { render json: @gene_attribute.errors, status: :unprocessable_entity }
    end
  end
end

#destroyObject

DELETE /gene_attributes/1 DELETE /gene_attributes/1.json



71
72
73
74
75
76
77
# File 'app/controllers/gene_attributes_controller.rb', line 71

def destroy
  @gene_attribute.destroy
  respond_to do |format|
    format.html { redirect_to gene_attributes_url, notice: 'Gene attribute was successfully destroyed.' }
    format.json { head :no_content }
  end
end

#editObject

GET /gene_attributes/1/edit



24
25
# File 'app/controllers/gene_attributes_controller.rb', line 24

def edit
end

#gene_attribute_paramsObject (private)

Never trust parameters from the scary internet, only allow the white list through.



86
87
88
# File 'app/controllers/gene_attributes_controller.rb', line 86

def gene_attribute_params
  params.require(:gene_attribute).permit(:descriptor_id, :sequence_id, :sequence_relationship_type, :controlled_vocabulary_term_id, :position, :created_by_id, :updated_by_id, :project_id)
end

#indexObject

GET /gene_attributes GET /gene_attributes.json



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

def index
  @recent_objects = GeneAttribute.recent_from_project_id(sessions_current_project_id).order(updated_at: :desc).limit(10)
  render 'shared/data/all/index'
end

#listObject



27
28
29
# File 'app/controllers/gene_attributes_controller.rb', line 27

def list
  @gene_attributes = GeneAttribute.with_project_id(sessions_current_project_id).page(params[:page])
end

#newObject

GET /gene_attributes/new



19
20
21
# File 'app/controllers/gene_attributes_controller.rb', line 19

def new
  @gene_attribute = GeneAttribute.new
end

#searchObject



61
62
63
64
65
66
67
# File 'app/controllers/gene_attributes_controller.rb', line 61

def search
  if params[:id].blank?
    redirect_to gene_attributes_path, notice: 'You must select an item from the list with a click or tab before clicking show.'
  else
    redirect_to gene_attribute_path(params[:id])
  end
end

#set_gene_attributeObject (private)

Use callbacks to share common setup or constraints between actions.



81
82
83
# File 'app/controllers/gene_attributes_controller.rb', line 81

def set_gene_attribute
  @gene_attribute = GeneAttribute.where(project_id: sessions_current_project_id).find(params[:id])
end

#showObject

GET /gene_attributes/1 GET /gene_attributes/1.json



15
16
# File 'app/controllers/gene_attributes_controller.rb', line 15

def show
end

#updateObject

PATCH/PUT /gene_attributes/1 PATCH/PUT /gene_attributes/1.json



49
50
51
52
53
54
55
56
57
58
59
# File 'app/controllers/gene_attributes_controller.rb', line 49

def update
  respond_to do |format|
    if @gene_attribute.update(gene_attribute_params)
      format.html { redirect_to @gene_attribute, notice: 'Gene attribute was successfully updated.' }
      format.json { render :show, status: :ok, location: @gene_attribute }
    else
      format.html { render :edit }
      format.json { render json: @gene_attribute.errors, status: :unprocessable_entity }
    end
  end
end