Class: ConveyancesController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- ConveyancesController
- Defined in:
- app/controllers/conveyances_controller.rb
Constant Summary
Constants included from ProjectsHelper
ProjectsHelper::CLASSIFIER, ProjectsHelper::CLASSIFIER_ANNOTATION
Instance Method Summary collapse
- #api_index ⇒ Object
- #api_show ⇒ Object
- #conveyance_params ⇒ Object private
-
#create ⇒ Object
POST /conveyances or /conveyances.json.
-
#destroy ⇒ Object
DELETE /conveyances/1 or /conveyances/1.json.
-
#edit ⇒ Object
GET /conveyances/1/edit.
-
#index ⇒ Object
GET /conveyances or /conveyances.json.
- #list ⇒ Object
- #new ⇒ Object
- #set_conveyance ⇒ Object private
-
#show ⇒ Object
GET /conveyances/1 or /conveyances/1.json.
-
#update ⇒ Object
PATCH/PUT /conveyances/1 or /conveyances/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
#api_index ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'app/controllers/conveyances_controller.rb', line 27 def api_index @conveyances = Queries::Conveyance::Filter.new(params.merge!(api: true)).all .where(project_id: sessions_current_project_id) .order('conveyances.conveyance_object_type, conveyances.conveyance_object_id, conveyances.position') .page(params[:page]) .per(params[:per]) render '/conveyances/api/v1/index' end |
#api_show ⇒ Object
36 37 38 |
# File 'app/controllers/conveyances_controller.rb', line 36 def api_show render '/conveyances/api/v1/show' end |
#conveyance_params ⇒ Object (private)
99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'app/controllers/conveyances_controller.rb', line 99 def conveyance_params params.require(:conveyance).permit( :sound_id, :conveyance_object_id, :conveyance_object_type, :position, :start_time, :end_time, sound_attributes: [ :sound_file, :name ] ) end |
#create ⇒ Object
POST /conveyances or /conveyances.json
57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'app/controllers/conveyances_controller.rb', line 57 def create @conveyance = Conveyance.new(conveyance_params) respond_to do |format| if @conveyance.save format.html { redirect_to @conveyance, notice: 'Conveyance was successfully created.' } format.json { render :show, status: :created, location: @conveyance } else format.html { render :new, status: :unprocessable_entity } format.json { render json: @conveyance.errors, status: :unprocessable_entity } end end end |
#destroy ⇒ Object
DELETE /conveyances/1 or /conveyances/1.json
85 86 87 88 89 90 91 92 |
# File 'app/controllers/conveyances_controller.rb', line 85 def destroy @conveyance.destroy! respond_to do |format| format.html { redirect_to conveyances_path, status: :see_other, notice: 'Conveyance was successfully destroyed.' } format.json { head :no_content } end end |
#edit ⇒ Object
GET /conveyances/1/edit
53 54 |
# File 'app/controllers/conveyances_controller.rb', line 53 def edit end |
#index ⇒ Object
GET /conveyances or /conveyances.json
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'app/controllers/conveyances_controller.rb', line 8 def index respond_to do |format| format.html { @recent_objects = Conveyance.where( project_id: sessions_current_project_id ).order(updated_at: :desc).limit(10) render '/shared/data/all/index' } format.json { @conveyances = Queries::Conveyance::Filter.new(params) .all .where(project_id: sessions_current_project_id) .where(Queries::Annotator::polymorphic_params(params, Conveyance)) # TODO: -> configured? .page(params[:page]) .per(params[:per]) } end end |
#list ⇒ Object
40 41 42 |
# File 'app/controllers/conveyances_controller.rb', line 40 def list @conveyances = Conveyance.where(project_id: sessions_current_project_id).page(params[:page]) end |
#new ⇒ Object
48 49 50 |
# File 'app/controllers/conveyances_controller.rb', line 48 def new @conveyance = Conveyance.new end |
#set_conveyance ⇒ Object (private)
95 96 97 |
# File 'app/controllers/conveyances_controller.rb', line 95 def set_conveyance @conveyance = Conveyance.find(params[:id]) end |
#show ⇒ Object
GET /conveyances/1 or /conveyances/1.json
45 46 |
# File 'app/controllers/conveyances_controller.rb', line 45 def show end |
#update ⇒ Object
PATCH/PUT /conveyances/1 or /conveyances/1.json
72 73 74 75 76 77 78 79 80 81 82 |
# File 'app/controllers/conveyances_controller.rb', line 72 def update respond_to do |format| if @conveyance.update(conveyance_params) format.html { redirect_to @conveyance, notice: 'Conveyance was successfully updated.' } format.json { render :show, status: :ok, location: @conveyance } else format.html { render :edit, status: :unprocessable_entity } format.json { render json: @conveyance.errors, status: :unprocessable_entity } end end end |