Class: OriginRelationshipsController
- Inherits:
- 
      ApplicationController
      
        - Object
- ActionController::Base
- ApplicationController
- OriginRelationshipsController
 
- Defined in:
- app/controllers/origin_relationships_controller.rb
Constant Summary
Constants included from ProjectsHelper
ProjectsHelper::CLASSIFIER, ProjectsHelper::CLASSIFIER_ANNOTATION
Instance Method Summary collapse
- 
  
    
      #autocomplete  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    TODO: remove. 
- 
  
    
      #create  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    POST /origin_relationships POST /origin_relationships.json. 
- 
  
    
      #destroy  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    DELETE /origin_relationships/1 DELETE /origin_relationships/1.json. 
- 
  
    
      #edit  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    GET /origin_relationships/1/edit. 
- 
  
    
      #index  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    GET /origin_relationships GET /origin_relationships.json. 
- #list ⇒ Object
- 
  
    
      #new  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    GET /origin_relationships/new. 
- 
  
    
      #origin_relationship_params  ⇒ Object 
    
    
  
  
  
  
  private
  
  
  
  
    Never trust parameters from the scary internet, only allow the white list through. 
- #search ⇒ Object
- 
  
    
      #set_origin_relationship  ⇒ Object 
    
    
  
  
  
  
  private
  
  
  
  
    Use callbacks to share common setup or constraints between actions. 
- 
  
    
      #show  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    GET /origin_relationships/1 GET /origin_relationships/1.json. 
- 
  
    
      #update  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    PATCH/PUT /origin_relationships/1 PATCH/PUT /origin_relationships/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, #cumulative_projects_created_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_login_link, #project_matches, #project_tag, #projects_list, #projects_search_form, #sound_cumulative_gb_per_year, #sound_gb_per_year, #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
TODO: remove
| 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | # File 'app/controllers/origin_relationships_controller.rb', line 90 def autocomplete @origin_relationships = origin_relationship .where(project_id: sessions_current_project_id) .where('origin_relationship ILIKE ?', "#{params[:term]}%") data = @origin_relationships.collect do |t| {id: t.id, label: t.origin_relationship, gid: t.to_global_id.to_s, response_values: { params[:method] => t.id }, label_html: t.origin_relationship } end render json: data end | 
#create ⇒ Object
POST /origin_relationships POST /origin_relationships.json
| 43 44 45 46 47 48 49 50 51 52 53 54 55 | # File 'app/controllers/origin_relationships_controller.rb', line 43 def create @origin_relationship = OriginRelationship.new(origin_relationship_params) respond_to do |format| if @origin_relationship.save format.html { redirect_to @origin_relationship, notice: 'Origin relationship was successfully created.' } format.json { render :show, status: :created, location: @origin_relationship } else format.html { render :new } format.json { render json: @origin_relationship.errors, status: :unprocessable_entity } end end end | 
#destroy ⇒ Object
DELETE /origin_relationships/1 DELETE /origin_relationships/1.json
| 73 74 75 76 77 78 79 | # File 'app/controllers/origin_relationships_controller.rb', line 73 def destroy @origin_relationship.destroy respond_to do |format| format.html { redirect_to origin_relationships_url, notice: 'Origin relationship was successfully destroyed.' } format.json { head :no_content } end end | 
#edit ⇒ Object
GET /origin_relationships/1/edit
| 34 35 | # File 'app/controllers/origin_relationships_controller.rb', line 34 def edit end | 
#index ⇒ Object
GET /origin_relationships GET /origin_relationships.json
| 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # File 'app/controllers/origin_relationships_controller.rb', line 8 def index respond_to do |format| format.html{ @recent_objects = OriginRelationship.recent_from_project_id(sessions_current_project_id).order(updated_at: :desc).limit(10) render '/shared/data/all/index' } format.json{ @origin_relationships = Queries::OriginRelationship::Filter.new(params) .all .page(params[:page]) .per(params[:per]) } end end | 
#list ⇒ Object
| 37 38 39 | # File 'app/controllers/origin_relationships_controller.rb', line 37 def list @origin_relationships = OriginRelationship.with_project_id(sessions_current_project_id).page(params[:page]) end | 
#new ⇒ Object
GET /origin_relationships/new
| 29 30 31 | # File 'app/controllers/origin_relationships_controller.rb', line 29 def new @origin_relationship = OriginRelationship.new end | 
#origin_relationship_params ⇒ Object (private)
Never trust parameters from the scary internet, only allow the white list through.
| 117 118 119 | # File 'app/controllers/origin_relationships_controller.rb', line 117 def origin_relationship_params params.require(:origin_relationship).permit(:old_object_id, :old_object_type, :new_object_id, :new_object_type, :position, :created_by_id, :updated_by_id, :project_id) end | 
#search ⇒ Object
| 81 82 83 84 85 86 87 | # File 'app/controllers/origin_relationships_controller.rb', line 81 def search if params[:id].blank? redirect_to origin_relationships_path, alert: 'You must select an item from the list with a click or tab press before clicking show.' else redirect_to origin_relationship_path(params[:id]) end end | 
#set_origin_relationship ⇒ Object (private)
Use callbacks to share common setup or constraints between actions.
| 112 113 114 | # File 'app/controllers/origin_relationships_controller.rb', line 112 def set_origin_relationship @origin_relationship = OriginRelationship.where(project_id: sessions_current_project_id).find(params[:id]) end | 
#show ⇒ Object
GET /origin_relationships/1 GET /origin_relationships/1.json
| 25 26 | # File 'app/controllers/origin_relationships_controller.rb', line 25 def show end | 
#update ⇒ Object
PATCH/PUT /origin_relationships/1 PATCH/PUT /origin_relationships/1.json
| 59 60 61 62 63 64 65 66 67 68 69 | # File 'app/controllers/origin_relationships_controller.rb', line 59 def update respond_to do |format| if @origin_relationship.update(origin_relationship_params) format.html { redirect_to @origin_relationship, notice: 'Origin relationship was successfully updated.' } format.json { render :show, status: :ok, location: @origin_relationship } else format.html { render :edit } format.json { render json: @origin_relationship.errors, status: :unprocessable_entity } end end end |