Class: ControlledVocabularyTermsController
- Inherits:
- 
      ApplicationController
      
        - Object
- ActionController::Base
- ApplicationController
- ControlledVocabularyTermsController
 
- Defined in:
- app/controllers/controlled_vocabulary_terms_controller.rb
Constant Summary
Constants included from ProjectsHelper
ProjectsHelper::CLASSIFIER, ProjectsHelper::CLASSIFIER_ANNOTATION
Instance Method Summary collapse
- 
  
    
      #api_index  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    GET /api/v1/controlled_vocabulary_terms. 
- 
  
    
      #api_show  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    GET /api/v1/controlled_vocabulary_terms/:id. 
- #autocomplete ⇒ Object
- #citations ⇒ Object
- #clone_from_project ⇒ Object
- #confidences ⇒ Object
- #controlled_vocabulary_term_params ⇒ Object private
- 
  
    
      #create  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    POST /controlled_vocabulary_terms.json. 
- #depictions ⇒ Object
- 
  
    
      #destroy  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    DELETE /controlled_vocabulary_terms/1.json. 
- 
  
    
      #download  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    GET /controlled_vocabulary_terms/download. 
- 
  
    
      #edit  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    GET /controlled_vocabulary_terms/1/edit. 
- 
  
    
      #filter_params  ⇒ Object 
    
    
  
  
  
  
  private
  
  
  
  
    ! No corresponding filter.rb. 
- 
  
    
      #index  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    GET /controlled_vocabulary_terms GET /controlled_vocabulary_terms.json. 
- #list ⇒ Object
- 
  
    
      #new  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    GET /controlled_vocabulary_terms/new. 
- #search ⇒ Object
- #set_controlled_vocabulary_term ⇒ Object private
- 
  
    
      #show  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    GET /controlled_vocabulary_terms/1 GET /controlled_vocabulary_terms/1.json. 
- 
  
    
      #tagged_objects  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    GET /controlled_vocabulary_terms/1/tagged_objects. 
- 
  
    
      #update  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    PATCH/PUT /controlled_vocabulary_terms/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
#api_index ⇒ Object
GET /api/v1/controlled_vocabulary_terms
| 133 134 135 136 137 138 139 | # File 'app/controllers/controlled_vocabulary_terms_controller.rb', line 133 def api_index @controlled_vocabulary_terms = Queries::ControlledVocabularyTerm::Filter.new(params.merge!(api: true)).all .where(project_id: sessions_current_project_id) .page(params[:page]) .per(params[:per]) render '/controlled_vocabulary_terms/api/v1/index' end | 
#api_show ⇒ Object
GET /api/v1/controlled_vocabulary_terms/:id
| 142 143 144 | # File 'app/controllers/controlled_vocabulary_terms_controller.rb', line 142 def api_show render '/controlled_vocabulary_terms/api/v1/show' end | 
#autocomplete ⇒ Object
| 111 112 113 114 115 116 117 | # File 'app/controllers/controlled_vocabulary_terms_controller.rb', line 111 def autocomplete @controlled_vocabulary_terms = Queries::ControlledVocabularyTerm::Autocomplete.new( params.require(:term), controlled_vocabulary_term_type: filter_params[:type], project_id: sessions_current_project_id ).all end | 
#citations ⇒ Object
| 103 104 105 | # File 'app/controllers/controlled_vocabulary_terms_controller.rb', line 103 def citations render json: @controlled_vocabulary_terms.citations end | 
#clone_from_project ⇒ Object
| 76 77 78 79 80 81 82 83 84 85 | # File 'app/controllers/controlled_vocabulary_terms_controller.rb', line 76 def clone_from_project if ControlledVocabularyTerm.clone_from_project( from_id: params[:project_id], to_id: sessions_current_project_id, klass: params[:target]) render json: {}, status: :ok else render json: {}, status: :unprocessable_entity end end | 
#confidences ⇒ Object
| 107 108 109 | # File 'app/controllers/controlled_vocabulary_terms_controller.rb', line 107 def confidences render json: @controlled_vocabulary_terms.confidences end | 
#controlled_vocabulary_term_params ⇒ Object (private)
| 153 154 155 | # File 'app/controllers/controlled_vocabulary_terms_controller.rb', line 153 def controlled_vocabulary_term_params params.require(:controlled_vocabulary_term).permit(:type, :name, :definition, :uri, :uri_relation, :css_color) end | 
#create ⇒ Object
POST /controlled_vocabulary_terms.json
| 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | # File 'app/controllers/controlled_vocabulary_terms_controller.rb', line 36 def create @controlled_vocabulary_term = ControlledVocabularyTerm.new(controlled_vocabulary_term_params) respond_to do |format| if @controlled_vocabulary_term.save format.json { render action: 'show', status: :created, location: @controlled_vocabulary_term. } else format.json { render json: @controlled_vocabulary_term.errors, status: :unprocessable_entity } end end end | 
#depictions ⇒ Object
| 99 100 101 | # File 'app/controllers/controlled_vocabulary_terms_controller.rb', line 99 def depictions render json: @controlled_vocabulary_terms.depictions end | 
#destroy ⇒ Object
DELETE /controlled_vocabulary_terms/1.json
| 63 64 65 66 67 68 69 70 71 72 73 74 | # File 'app/controllers/controlled_vocabulary_terms_controller.rb', line 63 def destroy @controlled_vocabulary_term.destroy respond_to do |format| if @controlled_vocabulary_term.destroyed? format.html { destroy_redirect @controlled_vocabulary_term, notice: 'OTU was successfully destroyed.' } format.json { head :no_content} else format.html { destroy_redirect @controlled_vocabulary_term, notice: 'OTU was not destroyed, ' + @controlled_vocabulary_term.errors..join('; ') } format.json { render json: @controlled_vocabulary_term.errors, status: :unprocessable_entity } end end end | 
#download ⇒ Object
GET /controlled_vocabulary_terms/download
| 120 121 122 123 124 125 | # File 'app/controllers/controlled_vocabulary_terms_controller.rb', line 120 def download send_data( Export::CSV.generate_csv(ControlledVocabularyTerm.where(project_id: sessions_current_project_id)), type: 'text', filename: "controlled_vocabulary_terms_#{DateTime.now}.tsv") end | 
#edit ⇒ Object
GET /controlled_vocabulary_terms/1/edit
| 31 32 33 | # File 'app/controllers/controlled_vocabulary_terms_controller.rb', line 31 def edit redirect_to manage_controlled_vocabulary_terms_task_path(controlled_vocabulary_term_id: @controlled_vocabulary_term.id) and return end | 
#filter_params ⇒ Object (private)
! No corresponding filter.rb
| 158 159 160 161 162 163 | # File 'app/controllers/controlled_vocabulary_terms_controller.rb', line 158 def filter_params params.permit( type: [], id: [] ).to_h.symbolize_keys.merge!(project_id: sessions_current_project_id) end | 
#index ⇒ Object
GET /controlled_vocabulary_terms GET /controlled_vocabulary_terms.json
| 8 9 10 11 12 13 14 15 16 17 18 | # File 'app/controllers/controlled_vocabulary_terms_controller.rb', line 8 def index respond_to do |format| format.html do @recent_objects = ControlledVocabularyTerm.recent_from_project_id(sessions_current_project_id).order(updated_at: :desc).limit(10) render '/shared/data/all/index' end format.json { @controlled_vocabulary_terms = ControlledVocabularyTerm.where(filter_params).order(:name) } end end | 
#list ⇒ Object
| 95 96 97 | # File 'app/controllers/controlled_vocabulary_terms_controller.rb', line 95 def list @controlled_vocabulary_terms = ControlledVocabularyTerm.with_project_id(sessions_current_project_id).order(:id).page(params[:page]) #.per(10) #.per(3) end | 
#new ⇒ Object
GET /controlled_vocabulary_terms/new
| 26 27 28 | # File 'app/controllers/controlled_vocabulary_terms_controller.rb', line 26 def new redirect_to manage_controlled_vocabulary_terms_task_path and return end | 
#search ⇒ Object
| 87 88 89 90 91 92 93 | # File 'app/controllers/controlled_vocabulary_terms_controller.rb', line 87 def search if params[:id].blank? redirect_to controlled_vocabulary_term_path, alert: 'You must select an item from the list with a click or tab press before clicking show.' else redirect_to controlled_vocabulary_term_path(params[:id]) end end | 
#set_controlled_vocabulary_term ⇒ Object (private)
| 148 149 150 151 | # File 'app/controllers/controlled_vocabulary_terms_controller.rb', line 148 def set_controlled_vocabulary_term @controlled_vocabulary_term = ControlledVocabularyTerm.with_project_id(sessions_current_project_id).find(params[:id]) @recent_object = @controlled_vocabulary_term end | 
#show ⇒ Object
GET /controlled_vocabulary_terms/1 GET /controlled_vocabulary_terms/1.json
| 22 23 | # File 'app/controllers/controlled_vocabulary_terms_controller.rb', line 22 def show end | 
#tagged_objects ⇒ Object
GET /controlled_vocabulary_terms/1/tagged_objects
| 128 129 130 | # File 'app/controllers/controlled_vocabulary_terms_controller.rb', line 128 def tagged_objects set_controlled_vocabulary_term end | 
#update ⇒ Object
PATCH/PUT /controlled_vocabulary_terms/1.json
| 52 53 54 55 56 57 58 59 60 | # File 'app/controllers/controlled_vocabulary_terms_controller.rb', line 52 def update respond_to do |format| if @controlled_vocabulary_term.update(controlled_vocabulary_term_params) format.json { render :show, status: :ok, location: @controlled_vocabulary_term. } else format.json { render json: @controlled_vocabulary_term.errors, status: :unprocessable_entity } end end end |