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
42 43 44 45 |
# File 'app/controllers/rails_workflow/process_templates_controller.rb', line 42 def create @process_template = ProcessTemplate.create(permitted_params) redirect_to process_template_operation_templates_path(@process_template) end |
#destroy ⇒ Object
52 53 54 55 |
# File 'app/controllers/rails_workflow/process_templates_controller.rb', line 52 def destroy @process_template.destroy redirect_to process_templates_url end |
#export ⇒ Object
23 24 25 26 |
# File 'app/controllers/rails_workflow/process_templates_controller.rb', line 23 def export template = ProcessTemplate.find(params[:id]) send_data render_to_string(json: template, serializer: ProcessTemplateSerializer), filename: "#{template.title}.json" end |
#index ⇒ Object
28 29 30 31 32 33 |
# File 'app/controllers/rails_workflow/process_templates_controller.rb', line 28 def index @process_templates = ProcessTemplateDecorator. decorate_collection(process_templates_collection) respond_with(@process_templates) end |
#new ⇒ Object
36 37 38 39 |
# File 'app/controllers/rails_workflow/process_templates_controller.rb', line 36 def new @process_template = ProcessTemplate.new(permitted_params).decorate respond_with @process_template end |
#update ⇒ Object
47 48 49 50 |
# File 'app/controllers/rails_workflow/process_templates_controller.rb', line 47 def update @process_template.update(permitted_params) redirect_to process_template_url(@process_template) end |
#upload ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'app/controllers/rails_workflow/process_templates_controller.rb', line 12 def upload uploaded = params[:import_file] json = JSON.parse(uploaded.read) importer = RailsWorkflow::ProcessImporter.new(json) importer.process redirect_to process_templates_path end |