Class: Intro::Admin::ToursController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Intro::ApplicationController
- ApplicationController
- Intro::Admin::ToursController
- Defined in:
- app/controllers/intro/admin/tours_controller.rb
Instance Method Summary collapse
- #attempt ⇒ Object
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #publish ⇒ Object
- #route ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Methods inherited from Intro::ApplicationController
Instance Method Details
#attempt ⇒ Object
35 36 37 38 |
# File 'app/controllers/intro/admin/tours_controller.rb', line 35 def attempt tour = Intro::Tour.new(tour_params) render json: { data: tour.expose_attributes } end |
#create ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'app/controllers/intro/admin/tours_controller.rb', line 21 def create @tour = Intro::Tour.new(tour_params) if @tour.save redirect_to admin_tour_path(@tour), notice: t('intro.admin.add_success') else render :new end end |
#destroy ⇒ Object
51 52 53 54 |
# File 'app/controllers/intro/admin/tours_controller.rb', line 51 def destroy @tour.destroy redirect_to admin_tours_path end |
#edit ⇒ Object
44 |
# File 'app/controllers/intro/admin/tours_controller.rb', line 44 def edit; end |
#index ⇒ Object
12 13 14 15 |
# File 'app/controllers/intro/admin/tours_controller.rb', line 12 def index @tours = Intro::Tour.page(params[:page]).per(15) @tours = @tours.recent end |
#new ⇒ Object
17 18 19 |
# File 'app/controllers/intro/admin/tours_controller.rb', line 17 def new @tour = Intro::Tour.new end |
#publish ⇒ Object
56 57 58 59 60 61 |
# File 'app/controllers/intro/admin/tours_controller.rb', line 56 def publish @tour.update(published: 'true' == params[:published]) redirect_to :back rescue => e redirect_to admin_tours_path end |
#route ⇒ Object
31 32 33 |
# File 'app/controllers/intro/admin/tours_controller.rb', line 31 def route render json: { data: Intro::Tour.extract_route(params[:path]) } end |
#show ⇒ Object
40 41 42 |
# File 'app/controllers/intro/admin/tours_controller.rb', line 40 def show render :edit end |
#update ⇒ Object
46 47 48 49 |
# File 'app/controllers/intro/admin/tours_controller.rb', line 46 def update flash.now[:notice] = t('intro.admin.update_success') if @tour.update(tour_params) render :edit end |