Class: ProtocolRelationshipsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- ProtocolRelationshipsController
- Defined in:
- app/controllers/protocol_relationships_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /protocol_relationships POST /protocol_relationships.json.
-
#destroy ⇒ Object
DELETE /protocol_relationships/1 DELETE /protocol_relationships/1.json.
-
#edit ⇒ Object
GET /protocol_relationships/1/edit.
-
#index ⇒ Object
GET /protocol_relationships GET /protocol_relationships.json.
- #list ⇒ Object
-
#new ⇒ Object
GET /protocol_relationships/new.
- #protocol_relationship_params ⇒ Object private
- #search ⇒ Object
- #set_protocol_relationship ⇒ Object private
-
#show ⇒ Object
GET /protocol_relationships/1 GET /protocol_relationships/1.json.
-
#update ⇒ Object
PATCH/PUT /protocol_relationships/1 PATCH/PUT /protocol_relationships/1.json.
Methods included from DataControllerConfiguration::ProjectDataControllerConfiguration
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
#invalid_object, #project_link, #project_matches, #project_tag, #projects_list, #projects_search_form
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
#create ⇒ Object
POST /protocol_relationships POST /protocol_relationships.json
49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'app/controllers/protocol_relationships_controller.rb', line 49 def create @protocol_relationship = ProtocolRelationship.new(protocol_relationship_params) respond_to do |format| if @protocol_relationship.save format.html { redirect_to @protocol_relationship, notice: 'Protocol relationship was successfully created.' } format.json { render :show, status: :created, location: @protocol_relationship } else format.html { render :new } format.json { render json: @protocol_relationship.errors, status: :unprocessable_entity } end end end |
#destroy ⇒ Object
DELETE /protocol_relationships/1 DELETE /protocol_relationships/1.json
79 80 81 82 83 84 85 |
# File 'app/controllers/protocol_relationships_controller.rb', line 79 def destroy @protocol_relationship.destroy respond_to do |format| format.html { redirect_to protocol_relationships_url, notice: 'Protocol relationship was successfully destroyed.' } format.json { head :no_content } end end |
#edit ⇒ Object
GET /protocol_relationships/1/edit
40 41 |
# File 'app/controllers/protocol_relationships_controller.rb', line 40 def edit end |
#index ⇒ Object
GET /protocol_relationships GET /protocol_relationships.json
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'app/controllers/protocol_relationships_controller.rb', line 8 def index respond_to do |format| format.html { @recent_objects = ProtocolRelationship.recent_from_project_id(sessions_current_project_id).order(updated_at: :desc).limit(10) render '/shared/data/all/index' } format.json { @protocol_relationships = ProtocolRelationship.where(project_id: sessions_current_project_id).where( Queries::Annotator::polymorphic_params(params, ProtocolRelationship) ) } end end |
#list ⇒ Object
43 44 45 |
# File 'app/controllers/protocol_relationships_controller.rb', line 43 def list @protocol_relationships = ProtocolRelationship.with_project_id(sessions_current_project_id).page(params[:page]) end |
#new ⇒ Object
GET /protocol_relationships/new
29 30 31 32 33 34 35 36 37 |
# File 'app/controllers/protocol_relationships_controller.rb', line 29 def new @protocol_relationship = ProtocolRelationship.new if !Protocol.with_project_id(sessions_current_project_id).any? redirect_to new_protocol_path, notice: 'Create a protocol or two first.' and return end @protocol_relationship= ProtocolRelationship.new(protocol_relationship_params) end |
#protocol_relationship_params ⇒ Object (private)
101 102 103 |
# File 'app/controllers/protocol_relationships_controller.rb', line 101 def protocol_relationship_params params.require(:protocol_relationship).permit(:protocol_id, :protocol_relationship_object_id, :protocol_relationship_object_type, :annotated_global_entity) end |
#search ⇒ Object
87 88 89 90 91 92 93 |
# File 'app/controllers/protocol_relationships_controller.rb', line 87 def search if params[:id].blank? redirect_to protocol_relationships_path, notice: 'You must select an item from the list with a click or tab press before clicking show.' else redirect_to protocol_relationship_path(params[:id]) end end |
#set_protocol_relationship ⇒ Object (private)
97 98 99 |
# File 'app/controllers/protocol_relationships_controller.rb', line 97 def set_protocol_relationship @protocol_relationship = ProtocolRelationship.where(project_id: sessions_current_project_id).find(params[:id]) end |
#show ⇒ Object
GET /protocol_relationships/1 GET /protocol_relationships/1.json
25 26 |
# File 'app/controllers/protocol_relationships_controller.rb', line 25 def show end |
#update ⇒ Object
PATCH/PUT /protocol_relationships/1 PATCH/PUT /protocol_relationships/1.json
65 66 67 68 69 70 71 72 73 74 75 |
# File 'app/controllers/protocol_relationships_controller.rb', line 65 def update respond_to do |format| if @protocol_relationship.update(protocol_relationship_params) format.html { redirect_to @protocol_relationship, notice: 'Protocol relationship was successfully updated.' } format.json { render :show, status: :ok, location: @protocol_relationship } else format.html { render :edit } format.json { render json: @protocol_relationship.errors, status: :unprocessable_entity } end end end |