Class: RailsWorkflow::ProcessesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/rails_workflow/processes_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



37
38
39
40
41
42
43
# File 'app/controllers/rails_workflow/processes_controller.rb', line 37

def create
  @process = RailsWorkflow::ProcessManager.start_process(
      params[:process][:template_id], {}
  )

  redirect_to process_url(@process)
end

#destroyObject



51
52
53
54
# File 'app/controllers/rails_workflow/processes_controller.rb', line 51

def destroy
  @process.destroy
  redirect_to processes_path
end

#indexObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'app/controllers/rails_workflow/processes_controller.rb', line 12

def index
  @processes = ProcessDecorator.decorate_collection(undecorated_collection)

  @errors = Error.
      unresolved.order(id: :asc).
      includes(:parent).limit(10)

  @open_user_operations = OperationDecorator.
      decorate_collection(
        RailsWorkflow::Operation.incompleted.
            unassigned.includes(:template).
            limit(20)
      )

  @statistic = {
      all: RailsWorkflow::Process.count,
      statuses: RailsWorkflow::Process.count_by_statuses
  }
end

#newObject



32
33
34
# File 'app/controllers/rails_workflow/processes_controller.rb', line 32

def new
  @process = Process.new(permitted_params).decorate
end

#updateObject



46
47
48
49
# File 'app/controllers/rails_workflow/processes_controller.rb', line 46

def update
  @process.update(permitted_params)
  redirect_to processes_path
end