Class: Admin::OutputsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Admin::OutputsController
- Includes:
- Stenographer::OutputsHelper
- Defined in:
- app/controllers/stenographer/admin/outputs_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Methods included from Stenographer::OutputsHelper
Instance Method Details
#create ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 |
# File 'app/controllers/stenographer/admin/outputs_controller.rb', line 32 def create @output = Output.new(output_params) @output.configuration = params[:configuration].to_json @output.filters = params[:filters].to_json if @output.save redirect_to admin_output_path(@output), notice: 'Output Created' else redirect_to admin_outputs_path, alert: @output.errors..to_sentence end end |
#destroy ⇒ Object
59 60 61 62 63 64 65 |
# File 'app/controllers/stenographer/admin/outputs_controller.rb', line 59 def destroy if @output.destroy redirect_to admin_outputs_path, notice: 'Output Destroyed' else redirect_to admin_output_path(@output), alert: @output.errors..to_sentence end end |
#edit ⇒ Object
44 45 46 |
# File 'app/controllers/stenographer/admin/outputs_controller.rb', line 44 def edit @authentication = @output.authentication end |
#index ⇒ Object
11 12 13 14 15 16 17 |
# File 'app/controllers/stenographer/admin/outputs_controller.rb', line 11 def index @authentication_count = Authentication.count @providers = Authentication.providers page = params[:page] || 1 @outputs = Output.order(id: :desc).paginate(page: page, per_page: Stenographer.per_page) end |
#new ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'app/controllers/stenographer/admin/outputs_controller.rb', line 21 def new authentication_id = params[:output][:authentication_id] @authentication = Authentication.find_by(id: authentication_id) if @authentication.present? @output = Output.new(authentication_id: authentication_id) else redirect_to admin_outputs_path, alert: 'Cannot create an Output without a Provider' end end |
#show ⇒ Object
19 |
# File 'app/controllers/stenographer/admin/outputs_controller.rb', line 19 def show; end |
#update ⇒ Object
48 49 50 51 52 53 54 55 56 57 |
# File 'app/controllers/stenographer/admin/outputs_controller.rb', line 48 def update @output.configuration = params[:configuration].to_json @output.filters = params[:filters].to_json if @output.save redirect_to admin_output_path(@output), notice: 'Output Created' else redirect_to admin_outputs_path, alert: @output.errors..to_sentence end end |