Class: DocumentationController
- Inherits:
- 
      ApplicationController
      
        - Object
- ActionController::Base
- ApplicationController
- DocumentationController
 
- Defined in:
- app/controllers/documentation_controller.rb
Constant Summary
Constants included from ProjectsHelper
ProjectsHelper::CLASSIFIER, ProjectsHelper::CLASSIFIER_ANNOTATION
Instance Method Summary collapse
- 
  
    
      #create  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    POST /documentation POST /documentation.json. 
- 
  
    
      #destroy  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    DELETE /documentation/1 DELETE /documentation/1.json. 
- #documentation_params ⇒ Object private
- 
  
    
      #download  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    GET /documentation/download documentation_download_index is the route name, for some inflection bug reason. 
- 
  
    
      #edit  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    GET /documentation/1/edit. 
- 
  
    
      #index  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    GET /documentation GET /documentation.json. 
- #list ⇒ Object
- 
  
    
      #new  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    GET /documentation/new. 
- #search ⇒ Object
- #set_documentation ⇒ Object private
- 
  
    
      #show  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    GET /documentation/1 GET /documentation/1.json. 
- 
  
    
      #update  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    PATCH/PUT /documentation/1 PATCH/PUT /documentation/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
#create ⇒ Object
POST /documentation POST /documentation.json
| 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | # File 'app/controllers/documentation_controller.rb', line 37 def create @documentation = Documentation.new(documentation_params) respond_to do |format| if @documentation.save format.html { redirect_to url_for(@documentation.), notice: 'Documentation was successfully created.' } format.json { render action: 'show', status: :created, location: @documentation } else format.html { render action: 'new' } format.json { render json: @documentation.errors, status: :unprocessable_entity } end end end | 
#destroy ⇒ Object
DELETE /documentation/1 DELETE /documentation/1.json
| 69 70 71 72 73 74 75 | # File 'app/controllers/documentation_controller.rb', line 69 def destroy @documentation.destroy respond_to do |format| format.html { redirect_to documentation_index_url, notice: 'Documentation was successfully destroyed.' } format.json { head :no_content } end end | 
#documentation_params ⇒ Object (private)
| 102 103 104 105 106 107 | # File 'app/controllers/documentation_controller.rb', line 102 def documentation_params params.require(:documentation).permit( :documentation_object_id, :documentation_object_type, :document_id, :annotated_global_entity, :position, document_attributes: [:document_file, :is_public] ) end | 
#download ⇒ Object
GET /documentation/download
documentation_download_index is the route name, for some inflection bug reason
| 91 92 93 94 | # File 'app/controllers/documentation_controller.rb', line 91 def download send_data Export::CSV.generate_csv( Documentation.where(project_id: sessions_current_project_id)), type: 'text', filename: "documentation_#{DateTime.now}.tsv" end | 
#edit ⇒ Object
GET /documentation/1/edit
| 32 33 | # File 'app/controllers/documentation_controller.rb', line 32 def edit end | 
#index ⇒ Object
GET /documentation GET /documentation.json
| 8 9 10 11 12 13 14 15 16 17 18 19 | # File 'app/controllers/documentation_controller.rb', line 8 def index respond_to do |format| format.html { @recent_objects = Documentation.recent_from_project_id(sessions_current_project_id).order(updated_at: :desc).limit(10) render '/shared/data/all/index' } format.json { @documentation = ::Queries::Documentation::Filter.new(params).all.where(project_id: sessions_current_project_id). page(params[:page]).per(params[:per] || 500) } end end | 
#list ⇒ Object
| 77 78 79 | # File 'app/controllers/documentation_controller.rb', line 77 def list @documentation = Documentation.with_project_id(sessions_current_project_id).order(:id).page(params[:page]) #.per(10) end | 
#new ⇒ Object
GET /documentation/new
| 27 28 29 | # File 'app/controllers/documentation_controller.rb', line 27 def new @documentation = Documentation.new end | 
#search ⇒ Object
| 81 82 83 84 85 86 87 | # File 'app/controllers/documentation_controller.rb', line 81 def search if params[:id].blank? redirect_to documentation_path, alert: 'You must select an item from the list with a click or tab press before clicking show.' else redirect_to documentation_path(params[:id]) end end | 
#set_documentation ⇒ Object (private)
| 98 99 100 | # File 'app/controllers/documentation_controller.rb', line 98 def set_documentation @documentation = Documentation.where(project_id: sessions_current_project_id).find(params[:id]) end | 
#show ⇒ Object
GET /documentation/1 GET /documentation/1.json
| 23 24 | # File 'app/controllers/documentation_controller.rb', line 23 def show end | 
#update ⇒ Object
PATCH/PUT /documentation/1 PATCH/PUT /documentation/1.json
| 54 55 56 57 58 59 60 61 62 63 64 65 | # File 'app/controllers/documentation_controller.rb', line 54 def update respond_to do |format| if @documentation.update(documentation_params) format.html { redirect_to url_for(@documentation.), notice: 'Documentation was successfully updated.' } format.json { render :show, status: :ok, location: @documentation } else format.html { render :edit } format.json { render json: @documentation.errors, status: :unprocessable_entity } end end end |