petri_flow 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (153) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +28 -0
  4. data/Rakefile +34 -0
  5. data/app/assets/config/wf_manifest.js +2 -0
  6. data/app/assets/javascripts/wf/application.js +4 -0
  7. data/app/assets/stylesheets/wf/application.scss +2 -0
  8. data/app/assets/stylesheets/wf/arcs.css +4 -0
  9. data/app/assets/stylesheets/wf/cases.css +4 -0
  10. data/app/assets/stylesheets/wf/comments.css +4 -0
  11. data/app/assets/stylesheets/wf/fields.css +4 -0
  12. data/app/assets/stylesheets/wf/forms.css +4 -0
  13. data/app/assets/stylesheets/wf/guards.css +4 -0
  14. data/app/assets/stylesheets/wf/places.css +4 -0
  15. data/app/assets/stylesheets/wf/transitions.css +4 -0
  16. data/app/assets/stylesheets/wf/workflows.css +4 -0
  17. data/app/assets/stylesheets/wf/workitem_assignments.css +4 -0
  18. data/app/assets/stylesheets/wf/workitems.css +4 -0
  19. data/app/controllers/wf/application_controller.rb +14 -0
  20. data/app/controllers/wf/arcs_controller.rb +61 -0
  21. data/app/controllers/wf/cases_controller.rb +48 -0
  22. data/app/controllers/wf/comments_controller.rb +30 -0
  23. data/app/controllers/wf/fields_controller.rb +54 -0
  24. data/app/controllers/wf/forms_controller.rb +59 -0
  25. data/app/controllers/wf/guards_controller.rb +58 -0
  26. data/app/controllers/wf/places_controller.rb +53 -0
  27. data/app/controllers/wf/transitions_controller.rb +69 -0
  28. data/app/controllers/wf/workflows_controller.rb +59 -0
  29. data/app/controllers/wf/workitem_assignments_controller.rb +30 -0
  30. data/app/controllers/wf/workitems_controller.rb +79 -0
  31. data/app/helpers/wf/application_helper.rb +6 -0
  32. data/app/helpers/wf/arcs_helper.rb +6 -0
  33. data/app/helpers/wf/cases_helper.rb +6 -0
  34. data/app/helpers/wf/comments_helper.rb +6 -0
  35. data/app/helpers/wf/fields_helper.rb +6 -0
  36. data/app/helpers/wf/forms_helper.rb +6 -0
  37. data/app/helpers/wf/guards_helper.rb +6 -0
  38. data/app/helpers/wf/places_helper.rb +6 -0
  39. data/app/helpers/wf/transitions_helper.rb +6 -0
  40. data/app/helpers/wf/workflows_helper.rb +6 -0
  41. data/app/helpers/wf/workitem_assignments_helper.rb +6 -0
  42. data/app/helpers/wf/workitems_helper.rb +6 -0
  43. data/app/jobs/wf/application_job.rb +6 -0
  44. data/app/jobs/wf/fire_timed_workitem_job.rb +15 -0
  45. data/app/mailers/wf/application_mailer.rb +8 -0
  46. data/app/models/wf/application_record.rb +7 -0
  47. data/app/models/wf/arc.rb +42 -0
  48. data/app/models/wf/callbacks/assignment_default.rb +12 -0
  49. data/app/models/wf/callbacks/deadline_default.rb +11 -0
  50. data/app/models/wf/callbacks/enable_default.rb +11 -0
  51. data/app/models/wf/callbacks/fire_default.rb +11 -0
  52. data/app/models/wf/callbacks/hold_timeout_default.rb +11 -0
  53. data/app/models/wf/callbacks/notification_default.rb +11 -0
  54. data/app/models/wf/callbacks/time_default.rb +11 -0
  55. data/app/models/wf/callbacks/unassignment_default.rb +11 -0
  56. data/app/models/wf/case.rb +44 -0
  57. data/app/models/wf/case_assignment.rb +22 -0
  58. data/app/models/wf/case_command/add_comment.rb +17 -0
  59. data/app/models/wf/case_command/add_manual_assignment.rb +17 -0
  60. data/app/models/wf/case_command/add_token.rb +20 -0
  61. data/app/models/wf/case_command/add_workitem_assignment.rb +35 -0
  62. data/app/models/wf/case_command/begin_workitem_action.rb +33 -0
  63. data/app/models/wf/case_command/cancel.rb +17 -0
  64. data/app/models/wf/case_command/cancel_workitem.rb +20 -0
  65. data/app/models/wf/case_command/clear_manual_assignments.rb +16 -0
  66. data/app/models/wf/case_command/clear_workitem_assignments.rb +20 -0
  67. data/app/models/wf/case_command/consume_token.rb +23 -0
  68. data/app/models/wf/case_command/enable_transitions.rb +33 -0
  69. data/app/models/wf/case_command/end_workitem_action.rb +25 -0
  70. data/app/models/wf/case_command/finish_workitem.rb +18 -0
  71. data/app/models/wf/case_command/finished_p.rb +28 -0
  72. data/app/models/wf/case_command/fire_message_transition.rb +20 -0
  73. data/app/models/wf/case_command/fire_transition_internal.rb +41 -0
  74. data/app/models/wf/case_command/lock_token.rb +21 -0
  75. data/app/models/wf/case_command/new.rb +17 -0
  76. data/app/models/wf/case_command/release_token.rb +20 -0
  77. data/app/models/wf/case_command/remove_manual_assignment.rb +17 -0
  78. data/app/models/wf/case_command/remove_workitem_assignment.rb +24 -0
  79. data/app/models/wf/case_command/resume.rb +17 -0
  80. data/app/models/wf/case_command/set_workitem_assignments.rb +32 -0
  81. data/app/models/wf/case_command/start_case.rb +19 -0
  82. data/app/models/wf/case_command/start_workitem.rb +26 -0
  83. data/app/models/wf/case_command/suspend.rb +17 -0
  84. data/app/models/wf/case_command/sweep_automatic_transitions.rb +31 -0
  85. data/app/models/wf/case_command/sweep_timed_transitions.rb +16 -0
  86. data/app/models/wf/case_command/workitem_action.rb +20 -0
  87. data/app/models/wf/comment.rb +21 -0
  88. data/app/models/wf/demo_target.rb +18 -0
  89. data/app/models/wf/entry.rb +33 -0
  90. data/app/models/wf/field.rb +53 -0
  91. data/app/models/wf/field_value.rb +30 -0
  92. data/app/models/wf/form.rb +18 -0
  93. data/app/models/wf/group.rb +21 -0
  94. data/app/models/wf/guard.rb +73 -0
  95. data/app/models/wf/party.rb +22 -0
  96. data/app/models/wf/place.rb +28 -0
  97. data/app/models/wf/token.rb +37 -0
  98. data/app/models/wf/transition.rb +49 -0
  99. data/app/models/wf/transition_static_assignment.rb +21 -0
  100. data/app/models/wf/user.rb +26 -0
  101. data/app/models/wf/workflow.rb +182 -0
  102. data/app/models/wf/workitem.rb +78 -0
  103. data/app/models/wf/workitem_assignment.rb +19 -0
  104. data/app/views/layouts/wf/_alert.html.erb +4 -0
  105. data/app/views/layouts/wf/_footer.html.erb +13 -0
  106. data/app/views/layouts/wf/_nav.html.erb +13 -0
  107. data/app/views/layouts/wf/_notice.html.erb +4 -0
  108. data/app/views/layouts/wf/application.html.erb +34 -0
  109. data/app/views/wf/arcs/_form.html.erb +40 -0
  110. data/app/views/wf/arcs/edit.html.erb +1 -0
  111. data/app/views/wf/arcs/new.html.erb +1 -0
  112. data/app/views/wf/arcs/show.html.erb +67 -0
  113. data/app/views/wf/cases/_form.html.erb +27 -0
  114. data/app/views/wf/cases/index.html.erb +35 -0
  115. data/app/views/wf/cases/new.html.erb +1 -0
  116. data/app/views/wf/cases/show.html.erb +113 -0
  117. data/app/views/wf/comments/new.html.erb +27 -0
  118. data/app/views/wf/fields/_form.html.erb +42 -0
  119. data/app/views/wf/fields/edit.html.erb +1 -0
  120. data/app/views/wf/fields/new.html.erb +1 -0
  121. data/app/views/wf/forms/_form.html.erb +32 -0
  122. data/app/views/wf/forms/edit.html.erb +1 -0
  123. data/app/views/wf/forms/index.html.erb +32 -0
  124. data/app/views/wf/forms/new.html.erb +1 -0
  125. data/app/views/wf/forms/show.html.erb +53 -0
  126. data/app/views/wf/guards/_form.html.erb +43 -0
  127. data/app/views/wf/guards/edit.html.erb +1 -0
  128. data/app/views/wf/guards/new.html.erb +1 -0
  129. data/app/views/wf/places/_form.html.erb +43 -0
  130. data/app/views/wf/places/edit.html.erb +1 -0
  131. data/app/views/wf/places/new.html.erb +1 -0
  132. data/app/views/wf/transitions/_form.html.erb +92 -0
  133. data/app/views/wf/transitions/edit.html.erb +1 -0
  134. data/app/views/wf/transitions/new.html.erb +1 -0
  135. data/app/views/wf/workflows/_form.html.erb +32 -0
  136. data/app/views/wf/workflows/edit.html.erb +1 -0
  137. data/app/views/wf/workflows/index.html.erb +38 -0
  138. data/app/views/wf/workflows/new.html.erb +1 -0
  139. data/app/views/wf/workflows/show.html.erb +177 -0
  140. data/app/views/wf/workitem_assignments/new.html.erb +27 -0
  141. data/app/views/wf/workitems/index.html.erb +68 -0
  142. data/app/views/wf/workitems/pre_finish.html.erb +33 -0
  143. data/app/views/wf/workitems/show.html.erb +211 -0
  144. data/config/routes.rb +30 -0
  145. data/db/migrate/20200130201043_init.rb +226 -0
  146. data/db/migrate/20200130201641_init_some_data.rb +15 -0
  147. data/db/migrate/20200131200455_create_wf_entries.rb +19 -0
  148. data/db/migrate/20200201001543_add_target_field_name_for_guard.rb +7 -0
  149. data/lib/tasks/wf_tasks.rake +5 -0
  150. data/lib/wf/engine.rb +10 -0
  151. data/lib/wf/version.rb +5 -0
  152. data/lib/wf.rb +7 -0
  153. metadata +312 -0
@@ -0,0 +1,40 @@
1
+ <%= form_with(model: arc, url: [@workflow, @arc], local: true) do |f| %>
2
+ <% if arc.errors.any? %>
3
+ <article class="message is-danger">
4
+ <div class="message-header">
5
+ <p>
6
+ <%= pluralize(arc.errors.count, "error") %> prohibited this arc from being saved:
7
+ </p>
8
+ </div>
9
+ <div class="message-body content">
10
+ <ul>
11
+ <% arc.errors.full_messages.each do |message| %>
12
+ <li><%= message %></li>
13
+ <% end %>
14
+ </ul>
15
+ </div>
16
+ </article>
17
+ <% end %>
18
+
19
+ <div class="form-group">
20
+ <%= f.label :place, class: "label" %>
21
+ <%= f.select :place_id, @workflow.places.map{|x| [x.name, x.id]}, {}, class: "form-control custom-select", placeholder: "Place" %>
22
+ </div>
23
+
24
+ <div class="form-group">
25
+ <%= f.label :transition, class: "label" %>
26
+ <%= f.select :transition_id, @workflow.transitions.map{|x| [x.name, x.id]}, {}, class: "custom-select", placeholder: "Transition" %>
27
+ </div>
28
+
29
+ <div class="form-group">
30
+ <div id="notice" class="alert alert-success">
31
+ Direction is base on transition, in: P->T, out: T->P.
32
+ </div>
33
+ <%= f.label :direction, class: "label" %>
34
+ <%= f.select :direction, Wf::Arc.directions.keys, {}, class: "form-control custom-select", placeholder: "Direction" %>
35
+ </div>
36
+
37
+ <div class="form-group">
38
+ <%= f.submit class: "btn btn-primary", data: {disable_with: 'Waiting...'} %>
39
+ </div>
40
+ <% end %>
@@ -0,0 +1 @@
1
+ <%= render "form", workflow: @workflow, arc: @arc %>
@@ -0,0 +1 @@
1
+ <%= render "form", workflow: @workflow, arc: @arc %>
@@ -0,0 +1,67 @@
1
+ <div class="float-right">
2
+ <%= link_to 'Delete Arc', workflow_path(@workflow, @arc), data: {confirm: 'confirm?'}, method: :delete, class: 'btn btn-danger' %>
3
+ <%= link_to 'Edit Arc', edit_workflow_arc_path(@workflow, @arc), class: 'btn btn-primary' %>
4
+ <% if @arc.out? %>
5
+ <%= link_to 'Create Guards', new_arc_guard_path(@arc), class: 'btn btn-primary' %>
6
+ <% end %>
7
+ </div>
8
+ <div>
9
+ <h2>Arc Detail</h2>
10
+ <table class="table table-bordered table-info">
11
+ <tbody>
12
+ <tr>
13
+ <th scope="row">ID</th>
14
+ <td><%= @arc.id %></td>
15
+ </tr>
16
+ <tr>
17
+ <th scope="row">Name</th>
18
+ <td><%= @arc.name %></td>
19
+ </tr>
20
+ <tr>
21
+ <th scope="row">Transition</th>
22
+ <td><%= @arc.transition.name %></td>
23
+ </tr>
24
+ <tr>
25
+ <th scope="row">Place</th>
26
+ <td><%= @arc.place.name %></td>
27
+ </tr>
28
+ <tr>
29
+ <th scope="row">Guards</th>
30
+ <td><%= @arc.guards.map {|x| x.inspect }.join(" & ") %></td>
31
+ </tr>
32
+ <tr>
33
+ <th scope="row">Direction</th>
34
+ <td><%= @arc.direction %></td>
35
+ </tr>
36
+ </tbody>
37
+ </table>
38
+ </div>
39
+
40
+ <div>
41
+ <h2>Guards</h2>
42
+ <table class="table table-bordered table-info">
43
+ <thead>
44
+ <tr>
45
+ <th scope="col">ID</th>
46
+ <th scope="col">Field</th>
47
+ <th scope="col">Op</th>
48
+ <th scope="col">Value</th>
49
+ <th scope="col">Exp</th>
50
+ <th scope="col">Actions</th>
51
+ </tr>
52
+ </thead>
53
+ <tbody>
54
+ <% @arc.guards.each do |guard| %>
55
+ <tr>
56
+ <td><%= guard.id %></td>
57
+ <td><%= guard.fieldable&.form&.name %>/<%= guard.fieldable&.name %></td>
58
+ <td><%= guard.op %></td>
59
+ <td><%= guard.value %></td>
60
+ <td><%= guard.exp %></td>
61
+ <td><%= link_to 'Edit Guard', edit_arc_guard_path(@arc, guard), class: 'btn btn-sm btn-info' %></td>
62
+ <td><%= link_to 'Delete Guard', [@arc, guard], remote: true, method: :delete, data: {confirm: 'confirm?'}, class: 'btn btn-sm btn-info' %></td>
63
+ </tr>
64
+ <% end %>
65
+ </tbody>
66
+ </table>
67
+ </div>
@@ -0,0 +1,27 @@
1
+ <%= form_with(model: wf_case, url: [@workflow, @wf_case], local: true) do |f| %>
2
+ <% if wf_case.errors.any? %>
3
+ <article class="message is-danger">
4
+ <div class="message-header">
5
+ <p>
6
+ <%= pluralize(wf_case.errors.count, "error") %> prohibited this wf_case from being saved:
7
+ </p>
8
+ </div>
9
+ <div class="message-body content">
10
+ <ul>
11
+ <% wf_case.errors.full_messages.each do |message| %>
12
+ <li><%= message %></li>
13
+ <% end %>
14
+ </ul>
15
+ </div>
16
+ </article>
17
+ <% end %>
18
+
19
+ <div class="form-group">
20
+ <%= f.label :targetable, class: "label" %>
21
+ <%= f.select :targetable, options_for_select(Wf::DemoTarget.all.map {|x| [x.name, x.to_global_id]} || []), {include_blank: true}, class: "form-control custom-select", placeholder: "targetable" %>
22
+ </div>
23
+
24
+ <div class="form-group">
25
+ <%= f.submit class: "btn btn-primary", data: {disable_with: 'Waiting...'} %>
26
+ </div>
27
+ <% end %>
@@ -0,0 +1,35 @@
1
+ <div class="float-left"><h2>Cases</h2></div>
2
+ <div class="float-right">
3
+ <%= link_to 'New Case', new_workflow_case_path(@workflow), class: 'btn btn-primary' %>
4
+ </div>
5
+ <div>
6
+ <table class="table table-bordered table-info">
7
+ <thead>
8
+ <tr>
9
+ <th scope="col">ID</th>
10
+ <th scope="col">State</th>
11
+ <th scope="col">Created At</th>
12
+ <th scope="col">Targetable Type</th>
13
+ <th scope="col">Targetable ID</th>
14
+ <th scope="col">Action</th>
15
+ </tr>
16
+ </thead>
17
+ <tbody>
18
+ <% @cases.each do |wf_case| %>
19
+ <tr>
20
+ <td><%= wf_case.id %></td>
21
+ <td><%= wf_case.state %></td>
22
+ <td><%= wf_case.created_at %></td>
23
+ <td><%= wf_case.targetable_type %></td>
24
+ <td><%= wf_case.targetable_id %></td>
25
+ <td>
26
+ <%= link_to "Run", workflow_case_path(@workflow, wf_case), class: 'btn btn-success btn-sm' %>
27
+ </td>
28
+ </tr>
29
+ <% end %>
30
+ </tbody>
31
+ </table>
32
+ </div>
33
+ <div>
34
+ <%= paginate @cases, theme: 'twitter-bootstrap-4' %>
35
+ </div>
@@ -0,0 +1 @@
1
+ <%= render "form", workflow: @workflow, wf_case: @wf_case %>
@@ -0,0 +1,113 @@
1
+ <div>
2
+ <h2>Case Detail</h2>
3
+ <table class="table table-bordered table-info">
4
+ <tbody>
5
+ <tr>
6
+ <th scope="row">ID</th>
7
+ <td><%= @wf_case.id %></td>
8
+ </tr>
9
+ <tr>
10
+ <th scope="row">Workflow</th>
11
+ <td><%= link_to @wf_case.workflow.name, workflow_path(@wf_case.workflow) %></td>
12
+ </tr>
13
+ <tr>
14
+ <th scope="row">State</th>
15
+ <td><%= @wf_case.state %></td>
16
+ </tr>
17
+ <tr>
18
+ <th scope="row">Targetable Type</th>
19
+ <td><%= @wf_case.targetable_type %></td>
20
+ </tr>
21
+ <tr>
22
+ <th scope="row">Targetable ID</th>
23
+ <td><%= @wf_case.targetable_id %></td>
24
+ </tr>
25
+ <tr>
26
+ <th scope="row">Created At</th>
27
+ <td><%= @wf_case.created_at %></td>
28
+ </tr>
29
+ </tbody>
30
+ </table>
31
+ </div>
32
+
33
+ <div>
34
+ <h2>Case Graph</h2>
35
+ <div class="card">
36
+ <div class="card-body">
37
+ <%=raw @wf_case.workflow.render_graph(@wf_case) %>
38
+ </div>
39
+ </div>
40
+ </div>
41
+
42
+ <div>
43
+ <h2>Tokens</h2>
44
+ <table class="table table-bordered table-info">
45
+ <thead>
46
+ <tr>
47
+ <th scope="col">ID</th>
48
+ <th scope="col">Place</th>
49
+ <th scope="col">State</th>
50
+ <th scope="col">Locked Workitem</th>
51
+ <th scope="col">Produced At</th>
52
+ <th scope="col">Locked At</th>
53
+ <th scope="col">Canceled At</th>
54
+ <th scope="col">Consumed At</th>
55
+ <th scope="col">Created At</th>
56
+ </tr>
57
+ </thead>
58
+ <tbody>
59
+ <% @wf_case.tokens.each do |token| %>
60
+ <tr>
61
+ <td><%= token.id %></td>
62
+ <td><%= link_to token.place.name, workflow_place_path(token.workflow, token.place) %> </td>
63
+ <td><%= token.state %></td>
64
+ <td><%= token.locked_workitem_id %></td>
65
+ <td><%= token.produced_at %></td>
66
+ <td><%= token.locked_at %></td>
67
+ <td><%= token.canceled_at %></td>
68
+ <td><%= token.consumed_at %></td>
69
+ <td><%= token.created_at %></td>
70
+ </tr>
71
+ <% end %>
72
+ </tbody>
73
+ </table>
74
+ </div>
75
+
76
+ <div>
77
+ <h2>Workitems</h2>
78
+ <table class="table table-bordered table-info">
79
+ <thead>
80
+ <tr>
81
+ <th scope="col">ID</th>
82
+ <th scope="col">Transition</th>
83
+ <th scope="col">State</th>
84
+ <th scope="col">Holding User</th>
85
+ <th scope="col">Started At</th>
86
+ <th scope="col">Enabled At</th>
87
+ <th scope="col">Canceled At</th>
88
+ <th scope="col">Finished At</th>
89
+ <th scope="col">Overridden At</th>
90
+ <th scope="col">Deadline</th>
91
+ <th scope="col">Detail</th>
92
+ </tr>
93
+ </thead>
94
+ <tbody>
95
+ <% @wf_case.workitems.each do |workitem| %>
96
+ <tr>
97
+ <td><%= link_to workitem.id, workitem_path(workitem) %></td>
98
+ <td>
99
+ <%= link_to workitem.transition.name, workflow_transition_path(workitem.workflow, workitem.transition) %> </td>
100
+ <td><%= workitem.state %></td>
101
+ <td><%= workitem.holding_user_id %></td>
102
+ <td><%= workitem.started_at %></td>
103
+ <td><%= workitem.enabled_at %></td>
104
+ <td><%= workitem.canceled_at %></td>
105
+ <td><%= workitem.finished_at %></td>
106
+ <td><%= workitem.overridden_at %></td>
107
+ <td><%= workitem.deadline %></td>
108
+ <td><%= link_to "Run", workitem_path(workitem), class: 'btn btn-sm btn-success' %></td>
109
+ </tr>
110
+ <% end %>
111
+ </tbody>
112
+ </table>
113
+ </div>
@@ -0,0 +1,27 @@
1
+ <%= form_with(model: @comment, url: workitem_comments_path(@workitem), local: true) do |f| %>
2
+ <% if @comment.errors.any? %>
3
+ <article class="message is-danger">
4
+ <div class="message-header">
5
+ <p>
6
+ <%= pluralize(@comment.errors.count, "error") %> prohibited this comment from being saved:
7
+ </p>
8
+ </div>
9
+ <div class="message-body content">
10
+ <ul>
11
+ <% @comment.errors.full_messages.each do |message| %>
12
+ <li><%= message %></li>
13
+ <% end %>
14
+ </ul>
15
+ </div>
16
+ </article>
17
+ <% end %>
18
+
19
+ <div class="form-group">
20
+ <%= f.label :body, class: "label" %>
21
+ <%= f.text_area :body, class: "form-control", rows: 3, placeholder: "comment" %>
22
+ </div>
23
+
24
+ <div class="form-group">
25
+ <%= f.submit class: "btn btn-primary", value: "Comment", data: {disable_with: 'Waiting...'} %>
26
+ </div>
27
+ <% end %>
@@ -0,0 +1,42 @@
1
+ <%= form_with(model: field, url: [@form, field], local: true) do |f| %>
2
+ <% if field.errors.any? %>
3
+ <article class="message is-danger">
4
+ <div class="message-header">
5
+ <p>
6
+ <%= pluralize(field.errors.count, "error") %> prohibited this field from being saved:
7
+ </p>
8
+ </div>
9
+ <div class="message-body content">
10
+ <ul>
11
+ <% field.errors.full_messages.each do |message| %>
12
+ <li><%= message %></li>
13
+ <% end %>
14
+ </ul>
15
+ </div>
16
+ </article>
17
+ <% end %>
18
+
19
+ <div class="form-group">
20
+ <%= f.label :name, class: "label" %>
21
+ <%= f.text_field :name, class: "form-control", fieldholder: "Name" %>
22
+ </div>
23
+
24
+ <div class="form-group">
25
+ <%= f.label :position, class: "label" %>
26
+ <%= f.text_field :position, class: "form-control", fieldholder: "Position" %>
27
+ </div>
28
+
29
+ <div class="form-group">
30
+ <%= f.label :default_value, class: "label" %>
31
+ <%= f.text_field :default_value, class: "form-control", fieldholder: "Default Value" %>
32
+ </div>
33
+
34
+ <div class="form-group">
35
+ <%= f.label :field_type, class: "label" %>
36
+ <%= f.select :field_type, Wf::Field.field_types.keys, {}, class: "form-control custom-select", fieldholder: "Field Type" %>
37
+ </div>
38
+
39
+ <div class="form-group">
40
+ <%= f.submit class: "btn btn-primary", data: {disable_with: 'Waiting...'} %>
41
+ </div>
42
+ <% end %>
@@ -0,0 +1 @@
1
+ <%= render "form", form: @form, field: @field %>
@@ -0,0 +1 @@
1
+ <%= render "form", form: @form, field: @field %>
@@ -0,0 +1,32 @@
1
+ <%= form_with(model: form, local: true) do |f| %>
2
+ <% if form.errors.any? %>
3
+ <article class="message is-danger">
4
+ <div class="message-header">
5
+ <p>
6
+ <%= pluralize(form.errors.count, "error") %> prohibited this form from being saved:
7
+ </p>
8
+ </div>
9
+ <div class="message-body content">
10
+ <ul>
11
+ <% form.errors.full_messages.each do |message| %>
12
+ <li><%= message %></li>
13
+ <% end %>
14
+ </ul>
15
+ </div>
16
+ </article>
17
+ <% end %>
18
+
19
+ <div class="form-group">
20
+ <%= f.label :name, class: "label" %>
21
+ <%= f.text_field :name, class: "form-control", placeholder: "Name" %>
22
+ </div>
23
+
24
+ <div class="form-group">
25
+ <%= f.label :description, class: "label" %>
26
+ <%= f.text_area :description, class: "form-control", placeholder: "Description" %>
27
+ </div>
28
+
29
+ <div class="form-group">
30
+ <%= f.submit class: "btn btn-primary", data: {disable_with: 'Waiting...'} %>
31
+ </div>
32
+ <% end %>
@@ -0,0 +1 @@
1
+ <%= render "form", form: @form %>
@@ -0,0 +1,32 @@
1
+ <div class="float-left"><h2>Forms</h2></div>
2
+ <div class="float-right">
3
+ <%= link_to 'New Form', new_form_path, class: 'btn btn-primary' %>
4
+ </div>
5
+ <div>
6
+ <table class="table table-bordered table-info">
7
+ <thead>
8
+ <tr>
9
+ <th scope="col">ID</th>
10
+ <th scope="col">Name</th>
11
+ <th scope="col">Description</th>
12
+ <th scope="col">Actions</th>
13
+ </tr>
14
+ </thead>
15
+ <tbody>
16
+ <% @forms.each do |form| %>
17
+ <tr>
18
+ <td><%= form.id %></td>
19
+ <td><%= link_to form.name, form_path(form) %></td>
20
+ <td><%= form.description %></td>
21
+ <td>
22
+ <%= link_to 'Delete Form', form_path(form), method: :delete, data: {confirm: 'confirm?'}, class: 'btn-danger btn btn-sm' %>
23
+ <%= link_to 'Create Field', new_form_field_path(form), class: 'btn btn-info btn-sm' %>
24
+ </td>
25
+ </tr>
26
+ <% end %>
27
+ </tbody>
28
+ </table>
29
+ </div>
30
+ <div>
31
+ <%= paginate @forms, theme: 'twitter-bootstrap-4' %>
32
+ </div>
@@ -0,0 +1 @@
1
+ <%= render "form", form: @form %>
@@ -0,0 +1,53 @@
1
+ <div class="float-right">
2
+ <%= link_to 'Delete Form', form_path(@form), data: {confirm: 'confirm?'}, method: :delete, class: 'btn btn-danger' %>
3
+ <%= link_to 'Edit Form', edit_form_path(@form), class: 'btn btn-primary' %>
4
+ <%= link_to 'Create Fields', new_form_field_path(@form), class: 'btn btn-primary' %>
5
+ </div>
6
+ <div>
7
+ <h2>Form Detail</h2>
8
+ <table class="table table-bordered table-info">
9
+ <tbody>
10
+ <tr>
11
+ <th scope="row">ID</th>
12
+ <td><%= @form.id %></td>
13
+ </tr>
14
+ <tr>
15
+ <th scope="row">Name</th>
16
+ <td><%= @form.name %></td>
17
+ </tr>
18
+ <tr>
19
+ <th scope="row">Description</th>
20
+ <td><%= @form.description %></td>
21
+ </tr>
22
+ </tbody>
23
+ </table>
24
+ </div>
25
+
26
+ <div>
27
+ <h2>Fields</h2>
28
+ <table class="table table-bordered table-info">
29
+ <thead>
30
+ <tr>
31
+ <th scope="col">ID</th>
32
+ <th scope="col">Name</th>
33
+ <th scope="col">Position</th>
34
+ <th scope="col">Field Type</th>
35
+ <th scope="col">Default Value</th>
36
+ <th scope="col">Actions</th>
37
+ </tr>
38
+ </thead>
39
+ <tbody>
40
+ <% @form.fields.each do |field| %>
41
+ <tr>
42
+ <td><%= field.id %></td>
43
+ <td><%= field.name %></td>
44
+ <td><%= field.position %></td>
45
+ <td><%= field.field_type %></td>
46
+ <td><%= field.default_value %></td>
47
+ <td><%= link_to 'Edit Field', edit_form_field_path(@form, field), class: 'btn btn-sm btn-info' %></td>
48
+ <td><%= link_to 'Delete Field', [@form, field], remote: true, method: :delete, data: {confirm: 'confirm?'}, class: 'btn btn-sm btn-info' %></td>
49
+ </tr>
50
+ <% end %>
51
+ </tbody>
52
+ </table>
53
+ </div>
@@ -0,0 +1,43 @@
1
+ <%= form_with(model: guard, url: [@arc, @guard], local: true) do |f| %>
2
+ <% if guard.errors.any? %>
3
+ <article class="message is-danger">
4
+ <div class="message-header">
5
+ <p>
6
+ <%= pluralize(guard.errors.count, "error") %> prohibited this guard from being saved:
7
+ </p>
8
+ </div>
9
+ <div class="message-body content">
10
+ <ul>
11
+ <% guard.errors.full_messages.each do |message| %>
12
+ <li><%= message %></li>
13
+ <% end %>
14
+ </ul>
15
+ </div>
16
+ </article>
17
+ <% end %>
18
+
19
+ <div class="form-group">
20
+ <%= f.label :fieldable, class: "label" %>
21
+ <%= f.select :fieldable, options_for_select(@arc.transition.form&.fields&.map {|x| [x.name, x.to_global_id]} || []), {}, class: "form-control custom-select", placeholder: "fieldable" %>
22
+ </div>
23
+
24
+ <div class="form-group">
25
+ <%= f.label :op, class: "label" %>
26
+ <%= f.select :op, Wf::Guard::OP, {}, class: "form-control custom-select", placeholder: "Op" %>
27
+ </div>
28
+
29
+
30
+ <div class="form-group">
31
+ <%= f.label :value, class: "label" %>
32
+ <%= f.text_field :value, class: "form-control", placeholder: "Value" %>
33
+ </div>
34
+
35
+ <div class="form-group">
36
+ <%= f.label :exp, class: "label" %>
37
+ <%= f.text_field :exp, class: "form-control", placeholder: "Exp" %>
38
+ </div>
39
+
40
+ <div class="form-group">
41
+ <%= f.submit class: "btn btn-primary", data: {disable_with: 'Waiting...'} %>
42
+ </div>
43
+ <% end %>
@@ -0,0 +1 @@
1
+ <%= render "form", arc: @arc, guard: @guard %>
@@ -0,0 +1 @@
1
+ <%= render "form", arc: @arc, guard: @guard %>
@@ -0,0 +1,43 @@
1
+ <%= form_with(model: place, url: [@workflow, @place], local: true) do |f| %>
2
+ <% if place.errors.any? %>
3
+ <article class="message is-danger">
4
+ <div class="message-header">
5
+ <p>
6
+ <%= pluralize(place.errors.count, "error") %> prohibited this place from being saved:
7
+ </p>
8
+ </div>
9
+ <div class="message-body content">
10
+ <ul>
11
+ <% place.errors.full_messages.each do |message| %>
12
+ <li><%= message %></li>
13
+ <% end %>
14
+ </ul>
15
+ </div>
16
+ </article>
17
+ <% end %>
18
+
19
+ <div class="form-group">
20
+ <%= f.label :name, class: "label" %>
21
+ <%= f.text_field :name, class: "form-control", placeholder: "Name" %>
22
+ </div>
23
+
24
+ <div class="form-group">
25
+ <%= f.label :description, class: "label" %>
26
+ <%= f.text_area :description, class: "form-control", placeholder: "Description" %>
27
+ </div>
28
+
29
+
30
+ <div class="form-group">
31
+ <%= f.label :sort_order, class: "label" %>
32
+ <%= f.text_field :sort_order, class: "form-control", placeholder: "Sort Order" %>
33
+ </div>
34
+
35
+ <div class="form-group">
36
+ <%= f.label :place_type, class: "label" %>
37
+ <%= f.select :place_type, Wf::Place.place_types.keys, {}, class: "form-control custom-select", placeholder: "Place Type" %>
38
+ </div>
39
+
40
+ <div class="form-group">
41
+ <%= f.submit class: "btn btn-primary", data: {disable_with: 'Waiting...'} %>
42
+ </div>
43
+ <% end %>
@@ -0,0 +1 @@
1
+ <%= render "form", workflow: @workflow, place: @place %>
@@ -0,0 +1 @@
1
+ <%= render "form", workflow: @workflow, place: @place %>