Class: RailsWorkflow::ProcessTemplatesController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ApplicationController
- RailsWorkflow::ProcessTemplatesController
- Defined in:
- app/controllers/rails_workflow/process_templates_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #export ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #update ⇒ Object
- #upload ⇒ Object
Instance Method Details
#create ⇒ Object
38 39 40 41 |
# File 'app/controllers/rails_workflow/process_templates_controller.rb', line 38 def create @process_template = ProcessTemplate.create(permitted_params) redirect_to process_template_operation_templates_path(@process_template) end |
#destroy ⇒ Object
48 49 50 51 |
# File 'app/controllers/rails_workflow/process_templates_controller.rb', line 48 def destroy @process_template.destroy redirect_to process_templates_url end |
#export ⇒ Object
24 25 26 27 |
# File 'app/controllers/rails_workflow/process_templates_controller.rb', line 24 def export template = ProcessTemplate.find(params[:id]) send_data render_to_string(json: template, serializer: ProcessTemplateSerializer), filename: "#{template.title}.json" end |
#index ⇒ Object
29 30 31 32 |
# File 'app/controllers/rails_workflow/process_templates_controller.rb', line 29 def index @process_templates = ProcessTemplateDecorator .decorate_collection(process_templates_collection) end |
#new ⇒ Object
34 35 36 |
# File 'app/controllers/rails_workflow/process_templates_controller.rb', line 34 def new @process_template = ProcessTemplate.new(permitted_params).decorate end |
#update ⇒ Object
43 44 45 46 |
# File 'app/controllers/rails_workflow/process_templates_controller.rb', line 43 def update @process_template.update(permitted_params) redirect_to process_template_url(@process_template) end |
#upload ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'app/controllers/rails_workflow/process_templates_controller.rb', line 13 def upload uploaded = params[:import_file] json = JSON.parse(uploaded.read) importer = RailsWorkflow::ProcessImporter.new(json) importer.process redirect_to process_templates_path end |