Class: BiologicalAssociationsGraphsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- BiologicalAssociationsGraphsController
- Defined in:
- app/controllers/biological_associations_graphs_controller.rb
Constant Summary
Constants included from ProjectsHelper
ProjectsHelper::CLASSIFIER, ProjectsHelper::CLASSIFIER_ANNOTATION
Instance Method Summary collapse
- #autocomplete ⇒ Object
- #biological_associations_graph_params ⇒ Object private
-
#create ⇒ Object
POST /biological_associations_graphs POST /biological_associations_graphs.json.
-
#destroy ⇒ Object
DELETE /biological_associations_graphs/1 DELETE /biological_associations_graphs/1.json.
-
#edit ⇒ Object
GET /biological_associations_graphs/1/edit.
-
#index ⇒ Object
GET /biological_associations_graphs GET /biological_associations_graphs.json.
- #list ⇒ Object
-
#new ⇒ Object
GET /biological_associations_graphs/new.
-
#search ⇒ Object
TODO: remove!.
- #set_biological_associations_graph ⇒ Object private
-
#show ⇒ Object
GET /biological_associations_graphs/1 GET /biological_associations_graphs/1.json.
-
#update ⇒ Object
PATCH/PUT /biological_associations_graphs/1 PATCH/PUT /biological_associations_graphs/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
#autocomplete ⇒ Object
82 83 84 85 86 87 |
# File 'app/controllers/biological_associations_graphs_controller.rb', line 82 def autocomplete @biological_associations_graphs = Queries::BiologicalAssociationsGraph::Autocomplete.new( params.require(:term), project_id: sessions_current_project_id ).autocomplete end |
#biological_associations_graph_params ⇒ Object (private)
104 105 106 107 108 109 110 111 |
# File 'app/controllers/biological_associations_graphs_controller.rb', line 104 def biological_associations_graph_params params.require(:biological_associations_graph).permit( :name, :layout, origin_citation_attributes: [:id, :_destroy, :source_id, :pages] , biological_associations_biological_associations_graphs_attributes: [:id, :_destroy, :biological_association_id] ) end |
#create ⇒ Object
POST /biological_associations_graphs POST /biological_associations_graphs.json
44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'app/controllers/biological_associations_graphs_controller.rb', line 44 def create @biological_associations_graph = BiologicalAssociationsGraph.new(biological_associations_graph_params) respond_to do |format| if @biological_associations_graph.save format.html { redirect_to @biological_associations_graph, notice: 'Biological associations graph was successfully created.' } format.json { render :show, status: :created, location: @biological_associations_graph } else format.html { render :new } format.json { render json: @biological_associations_graph.errors, status: :unprocessable_entity } end end end |
#destroy ⇒ Object
DELETE /biological_associations_graphs/1 DELETE /biological_associations_graphs/1.json
74 75 76 77 78 79 80 |
# File 'app/controllers/biological_associations_graphs_controller.rb', line 74 def destroy @biological_associations_graph.destroy respond_to do |format| format.html { redirect_to biological_associations_graphs_url, notice: 'Biological associations graph was successfully destroyed.' } format.json { head :no_content } end end |
#edit ⇒ Object
GET /biological_associations_graphs/1/edit
34 35 36 |
# File 'app/controllers/biological_associations_graphs_controller.rb', line 34 def edit # @biological_associations_graph.souce = Source.new if !@taxon_name.source end |
#index ⇒ Object
GET /biological_associations_graphs GET /biological_associations_graphs.json
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'app/controllers/biological_associations_graphs_controller.rb', line 9 def index respond_to do |format| format.html do @recent_objects = BiologicalAssociationsGraph.recent_from_project_id(sessions_current_project_id).order(updated_at: :desc).limit(10) render '/shared/data/all/index' end format.json { @biological_associations_graphs = ::Queries::BiologicalAssociationsGraph::Filter.new(params).all .page(params[:page]) .per(params[:per]) } end end |
#list ⇒ Object
38 39 40 |
# File 'app/controllers/biological_associations_graphs_controller.rb', line 38 def list @biological_associations_graphs = BiologicalAssociationsGraph.with_project_id(sessions_current_project_id).order(:id).page(params[:page]) #.per(10) end |
#new ⇒ Object
GET /biological_associations_graphs/new
29 30 31 |
# File 'app/controllers/biological_associations_graphs_controller.rb', line 29 def new @biological_associations_graph = BiologicalAssociationsGraph.new(origin_citation: Citation.new) end |
#search ⇒ Object
TODO: remove!
90 91 92 93 94 95 96 |
# File 'app/controllers/biological_associations_graphs_controller.rb', line 90 def search if params[:id].blank? redirect_to biological_associations_graphs_path, alert: 'You must select an item from the list with a click or tab press before clicking show.' else redirect_to biological_associations_graph_path(params[:id]) end end |
#set_biological_associations_graph ⇒ Object (private)
100 101 102 |
# File 'app/controllers/biological_associations_graphs_controller.rb', line 100 def set_biological_associations_graph @biological_associations_graph = BiologicalAssociationsGraph.where(project_id: sessions_current_project_id).find(params[:id]) end |
#show ⇒ Object
GET /biological_associations_graphs/1 GET /biological_associations_graphs/1.json
25 26 |
# File 'app/controllers/biological_associations_graphs_controller.rb', line 25 def show end |
#update ⇒ Object
PATCH/PUT /biological_associations_graphs/1 PATCH/PUT /biological_associations_graphs/1.json
60 61 62 63 64 65 66 67 68 69 70 |
# File 'app/controllers/biological_associations_graphs_controller.rb', line 60 def update respond_to do |format| if @biological_associations_graph.update(biological_associations_graph_params) format.html { redirect_to @biological_associations_graph, notice: 'Biological associations graph was successfully updated.' } format.json { render :show, status: :ok, location: @biological_associations_graph } else format.html { render :edit } format.json { render json: @biological_associations_graph.errors, status: :unprocessable_entity } end end end |