bpmn-js-rails 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/controllers/bpmn_js_rails/application_controller.rb +6 -0
- data/app/controllers/bpmn_js_rails/decisions_controller.rb +49 -0
- data/app/controllers/bpmn_js_rails/diagrams_controller.rb +49 -0
- data/app/controllers/bpmn_js_rails/forms_controller.rb +53 -0
- data/app/helpers/bpmn_js_rails/view_helper.rb +26 -0
- data/app/views/bpmn_js_rails/decisions/_form.html.ruby +31 -0
- data/app/views/bpmn_js_rails/decisions/edit.html.ruby +5 -0
- data/app/views/bpmn_js_rails/decisions/index.html.ruby +38 -0
- data/app/views/bpmn_js_rails/decisions/new.html.ruby +5 -0
- data/app/views/bpmn_js_rails/decisions/show.html.ruby +23 -0
- data/app/views/bpmn_js_rails/diagrams/_form.html.ruby +31 -0
- data/app/views/bpmn_js_rails/diagrams/edit.html.ruby +5 -0
- data/app/views/bpmn_js_rails/diagrams/index.html.ruby +38 -0
- data/app/views/bpmn_js_rails/diagrams/new.html.ruby +5 -0
- data/app/views/bpmn_js_rails/diagrams/show.html.ruby +23 -0
- data/app/views/bpmn_js_rails/forms/_form.html.ruby +31 -0
- data/app/views/bpmn_js_rails/forms/edit.html.ruby +5 -0
- data/app/views/bpmn_js_rails/forms/index.html.ruby +38 -0
- data/app/views/bpmn_js_rails/forms/new.html.ruby +5 -0
- data/app/views/bpmn_js_rails/forms/show.html.ruby +23 -0
- data/config/routes.rb +4 -1
- data/lib/bpmn_js_rails/engine.rb +1 -1
- data/lib/bpmn_js_rails/version.rb +1 -1
- data/lib/bpmn_js_rails.rb +0 -3
- metadata +34 -2
- data/lib/bpmn-js-rails.rb +0 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: '049e17d90355035f9b68e7a867cc496183bc25fc5b92c04070576a64d1307048'
|
|
4
|
+
data.tar.gz: a510ff4fde74df72f05241c742e4dd270e28338d754f813f4df51bafa7223d07
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fcc4a299ccea02e76fa3375b0616166126c2af1dc0fe974ee28c3429f45ace1246512b891fc3bff8e2e5ceb85365ad0cf88ec051ac24291289bec1d35fc09a34
|
|
7
|
+
data.tar.gz: f82aa5b723167ef047d500270b8a39e7f5f7e5498c47d4fdd0fb35ee5c88f0390cb0060e9ecd4563006260be2bc7d67599e29d19a7633609eefb3d8563d54dda
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
module BpmnJsRails
|
|
2
|
+
class DecisionsController < ApplicationController
|
|
3
|
+
before_action :set_decision, only: %i[show edit update destroy]
|
|
4
|
+
|
|
5
|
+
def index
|
|
6
|
+
@decisions = BpmnJsRails::Decision.order(updated_at: :desc)
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def show; end
|
|
10
|
+
|
|
11
|
+
def new
|
|
12
|
+
@decision = BpmnJsRails::Decision.new
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def create
|
|
16
|
+
@decision = BpmnJsRails::Decision.new(decision_params)
|
|
17
|
+
if @decision.save
|
|
18
|
+
redirect_to @decision, notice: "Decision was successfully created."
|
|
19
|
+
else
|
|
20
|
+
render :new, status: :unprocessable_entity
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def edit; end
|
|
25
|
+
|
|
26
|
+
def update
|
|
27
|
+
if @decision.update(decision_params)
|
|
28
|
+
redirect_to @decision, notice: "Decision was successfully updated."
|
|
29
|
+
else
|
|
30
|
+
render :edit, status: :unprocessable_entity
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def destroy
|
|
35
|
+
@decision.destroy!
|
|
36
|
+
redirect_to decisions_path, notice: "Decision was successfully deleted."
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
private
|
|
40
|
+
|
|
41
|
+
def set_decision
|
|
42
|
+
@decision = BpmnJsRails::Decision.find(params[:id])
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def decision_params
|
|
46
|
+
params.require(:decision).permit(:name, :description, :status, :xml)
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
module BpmnJsRails
|
|
2
|
+
class DiagramsController < ApplicationController
|
|
3
|
+
before_action :set_diagram, only: %i[show edit update destroy]
|
|
4
|
+
|
|
5
|
+
def index
|
|
6
|
+
@diagrams = BpmnJsRails::Diagram.order(updated_at: :desc)
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def show; end
|
|
10
|
+
|
|
11
|
+
def new
|
|
12
|
+
@diagram = BpmnJsRails::Diagram.new
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def create
|
|
16
|
+
@diagram = BpmnJsRails::Diagram.new(diagram_params)
|
|
17
|
+
if @diagram.save
|
|
18
|
+
redirect_to @diagram, notice: "Diagram was successfully created."
|
|
19
|
+
else
|
|
20
|
+
render :new, status: :unprocessable_entity
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def edit; end
|
|
25
|
+
|
|
26
|
+
def update
|
|
27
|
+
if @diagram.update(diagram_params)
|
|
28
|
+
redirect_to @diagram, notice: "Diagram was successfully updated."
|
|
29
|
+
else
|
|
30
|
+
render :edit, status: :unprocessable_entity
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def destroy
|
|
35
|
+
@diagram.destroy!
|
|
36
|
+
redirect_to diagrams_path, notice: "Diagram was successfully deleted."
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
private
|
|
40
|
+
|
|
41
|
+
def set_diagram
|
|
42
|
+
@diagram = BpmnJsRails::Diagram.find(params[:id])
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def diagram_params
|
|
46
|
+
params.require(:diagram).permit(:name, :description, :status, :xml)
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
module BpmnJsRails
|
|
2
|
+
class FormsController < ApplicationController
|
|
3
|
+
before_action :set_form, only: %i[show edit update destroy]
|
|
4
|
+
|
|
5
|
+
def index
|
|
6
|
+
@forms = BpmnJsRails::Form.order(updated_at: :desc)
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def show; end
|
|
10
|
+
|
|
11
|
+
def new
|
|
12
|
+
@form = BpmnJsRails::Form.new
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def create
|
|
16
|
+
@form = BpmnJsRails::Form.new(form_params)
|
|
17
|
+
if @form.save
|
|
18
|
+
redirect_to @form, notice: "Form was successfully created."
|
|
19
|
+
else
|
|
20
|
+
render :new, status: :unprocessable_entity
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def edit; end
|
|
25
|
+
|
|
26
|
+
def update
|
|
27
|
+
if @form.update(form_params)
|
|
28
|
+
redirect_to @form, notice: "Form was successfully updated."
|
|
29
|
+
else
|
|
30
|
+
render :edit, status: :unprocessable_entity
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def destroy
|
|
35
|
+
@form.destroy!
|
|
36
|
+
redirect_to forms_path, notice: "Form was successfully deleted."
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
private
|
|
40
|
+
|
|
41
|
+
def set_form
|
|
42
|
+
@form = BpmnJsRails::Form.find(params[:id])
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def form_params
|
|
46
|
+
params.require(:form).permit(:name, :description, :status).tap do |permitted|
|
|
47
|
+
if params[:form][:schema].present?
|
|
48
|
+
permitted[:schema] = JSON.parse(params[:form][:schema])
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
@@ -251,6 +251,32 @@ module BpmnJsRails
|
|
|
251
251
|
end
|
|
252
252
|
end
|
|
253
253
|
|
|
254
|
+
# ── PascalCase helpers for .html.ruby views ─────────────────
|
|
255
|
+
|
|
256
|
+
def BpmnJsViewer(diagram_or_xml, **html_options)
|
|
257
|
+
output_buffer << bpmn_js_viewer(diagram_or_xml, **html_options)
|
|
258
|
+
end
|
|
259
|
+
|
|
260
|
+
def BpmnJsModeler(diagram_or_xml, field_name: nil, **html_options)
|
|
261
|
+
output_buffer << bpmn_js_modeler(diagram_or_xml, field_name: field_name, **html_options)
|
|
262
|
+
end
|
|
263
|
+
|
|
264
|
+
def FormJsViewer(form_or_schema, data: {}, **html_options)
|
|
265
|
+
output_buffer << form_js_viewer(form_or_schema, data: data, **html_options)
|
|
266
|
+
end
|
|
267
|
+
|
|
268
|
+
def FormJsEditor(form_or_schema, field_name: nil, **html_options)
|
|
269
|
+
output_buffer << form_js_editor(form_or_schema, field_name: field_name, **html_options)
|
|
270
|
+
end
|
|
271
|
+
|
|
272
|
+
def DmnJsViewer(decision_or_xml, **html_options)
|
|
273
|
+
output_buffer << dmn_js_viewer(decision_or_xml, **html_options)
|
|
274
|
+
end
|
|
275
|
+
|
|
276
|
+
def DmnJsModeler(decision_or_xml, field_name: nil, **html_options)
|
|
277
|
+
output_buffer << dmn_js_modeler(decision_or_xml, field_name: field_name, **html_options)
|
|
278
|
+
end
|
|
279
|
+
|
|
254
280
|
private
|
|
255
281
|
|
|
256
282
|
def extract_schema(form_or_schema)
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
Form(model: decision, url: decision.persisted? ? decision_path(decision) : decisions_path, class: "ui form bpmn-form") {
|
|
2
|
+
if decision.errors.any?
|
|
3
|
+
Message(type: :error) { |c|
|
|
4
|
+
c.header { text pluralize(decision.errors.count, "error") + " prohibited this decision from being saved" }
|
|
5
|
+
decision.errors.full_messages.each { |msg| Paragraph { text msg } }
|
|
6
|
+
}
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
Wrapper(html_class: "bpmn-header-bar") {
|
|
10
|
+
VStack(spacing: 8) {
|
|
11
|
+
HStack(spacing: 12, align: "end") {
|
|
12
|
+
Wrapper(style: "flex: 1;") {
|
|
13
|
+
TextField(:name, placeholder: "Decision name")
|
|
14
|
+
}
|
|
15
|
+
Select(:status, BpmnJsRails::Decision::STATUSES)
|
|
16
|
+
Button(variant: :primary, type: :submit, icon: "save", size: :small) {
|
|
17
|
+
text decision.persisted? ? "Update" : "Create"
|
|
18
|
+
}
|
|
19
|
+
if decision.persisted?
|
|
20
|
+
Button(href: decision_path(decision), size: :small, variant: :basic, icon: "eye") { text "View" }
|
|
21
|
+
end
|
|
22
|
+
Button(href: decisions_path, size: :small, variant: :basic, icon: "arrow left") { text "Back" }
|
|
23
|
+
}
|
|
24
|
+
TextField(:description, placeholder: "Optional description")
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
Wrapper(html_class: "bpmn-content") {
|
|
29
|
+
DmnJsModeler(decision, field_name: "decision[xml]")
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
HStack(justify: "between", align: "center") {
|
|
2
|
+
Header(size: :h2) { text "Decisions" }
|
|
3
|
+
Button(href: new_decision_path, variant: :primary, icon: "plus") { text "New Decision" }
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
Divider(hidden: true)
|
|
7
|
+
|
|
8
|
+
if @decisions.any?
|
|
9
|
+
text datatable(columns: ["Name", "Description", "Status", "Version", "Updated", "Actions"]) {
|
|
10
|
+
capture {
|
|
11
|
+
@decisions.each do |decision|
|
|
12
|
+
TableRow {
|
|
13
|
+
TableCell { Link(href: decision_path(decision)) { text decision.name } }
|
|
14
|
+
TableCell { text truncate(decision.description.to_s, length: 60) }
|
|
15
|
+
TableCell {
|
|
16
|
+
Label(color: decision.status == "published" ? :green : :grey, size: :mini) { text decision.status }
|
|
17
|
+
}
|
|
18
|
+
TableCell { text decision.version.to_s }
|
|
19
|
+
TableCell { text time_ago_in_words(decision.updated_at) + " ago" }
|
|
20
|
+
TableCell {
|
|
21
|
+
HStack(spacing: 4) {
|
|
22
|
+
Button(href: decision_path(decision), size: :mini, variant: :basic, icon: "eye")
|
|
23
|
+
Button(href: edit_decision_path(decision), size: :mini, variant: :basic, icon: "edit")
|
|
24
|
+
output_buffer << link_to(decision_path(decision), class: "ui mini basic red button", data: { turbo_method: :delete, turbo_confirm: "Are you sure?" }) {
|
|
25
|
+
capture { Icon(name: "trash") }
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
end
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
else
|
|
34
|
+
Message(type: :info) {
|
|
35
|
+
text "No decisions yet. "
|
|
36
|
+
Link(href: new_decision_path) { text "Create one" }
|
|
37
|
+
}
|
|
38
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
content_for(:head) { dmn_js_assets(:viewer) }
|
|
2
|
+
|
|
3
|
+
Wrapper(id: "bpmn-app") {
|
|
4
|
+
Wrapper(html_class: "bpmn-header-bar") {
|
|
5
|
+
HStack(justify: "between", align: "center") {
|
|
6
|
+
HStack(spacing: 12, align: "center") {
|
|
7
|
+
Header(size: :h3) { text @decision.name }
|
|
8
|
+
Label(color: @decision.status == "published" ? :green : :grey, size: :small) { text @decision.status }
|
|
9
|
+
Text(size: :small, color: :grey) { text "v#{@decision.version}" }
|
|
10
|
+
}
|
|
11
|
+
HStack(spacing: 8) {
|
|
12
|
+
Button(href: edit_decision_path(@decision), size: :small, variant: :primary, icon: "edit") { text "Edit" }
|
|
13
|
+
Button(href: decisions_path, size: :small, variant: :basic, icon: "arrow left") { text "Back" }
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
if @decision.description.present?
|
|
17
|
+
Wrapper(html_class: "bpmn-description") { text @decision.description }
|
|
18
|
+
end
|
|
19
|
+
}
|
|
20
|
+
Wrapper(html_class: "bpmn-content") {
|
|
21
|
+
DmnJsViewer(@decision)
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
Form(model: diagram, url: diagram.persisted? ? diagram_path(diagram) : diagrams_path, class: "ui form bpmn-form") {
|
|
2
|
+
if diagram.errors.any?
|
|
3
|
+
Message(type: :error) { |c|
|
|
4
|
+
c.header { text pluralize(diagram.errors.count, "error") + " prohibited this diagram from being saved" }
|
|
5
|
+
diagram.errors.full_messages.each { |msg| Paragraph { text msg } }
|
|
6
|
+
}
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
Wrapper(html_class: "bpmn-header-bar") {
|
|
10
|
+
VStack(spacing: 8) {
|
|
11
|
+
HStack(spacing: 12, align: "end") {
|
|
12
|
+
Wrapper(style: "flex: 1;") {
|
|
13
|
+
TextField(:name, placeholder: "Diagram name")
|
|
14
|
+
}
|
|
15
|
+
Select(:status, BpmnJsRails::Diagram::STATUSES)
|
|
16
|
+
Button(variant: :primary, type: :submit, icon: "save", size: :small) {
|
|
17
|
+
text diagram.persisted? ? "Update" : "Create"
|
|
18
|
+
}
|
|
19
|
+
if diagram.persisted?
|
|
20
|
+
Button(href: diagram_path(diagram), size: :small, variant: :basic, icon: "eye") { text "View" }
|
|
21
|
+
end
|
|
22
|
+
Button(href: diagrams_path, size: :small, variant: :basic, icon: "arrow left") { text "Back" }
|
|
23
|
+
}
|
|
24
|
+
TextField(:description, placeholder: "Optional description")
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
Wrapper(html_class: "bpmn-content") {
|
|
29
|
+
BpmnJsModeler(diagram, field_name: "diagram[xml]")
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
HStack(justify: "between", align: "center") {
|
|
2
|
+
Header(size: :h2) { text "Diagrams" }
|
|
3
|
+
Button(href: new_diagram_path, variant: :primary, icon: "plus") { text "New Diagram" }
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
Divider(hidden: true)
|
|
7
|
+
|
|
8
|
+
if @diagrams.any?
|
|
9
|
+
text datatable(columns: ["Name", "Description", "Status", "Version", "Updated", "Actions"]) {
|
|
10
|
+
capture {
|
|
11
|
+
@diagrams.each do |diagram|
|
|
12
|
+
TableRow {
|
|
13
|
+
TableCell { Link(href: diagram_path(diagram)) { text diagram.name } }
|
|
14
|
+
TableCell { text truncate(diagram.description.to_s, length: 60) }
|
|
15
|
+
TableCell {
|
|
16
|
+
Label(color: diagram.status == "published" ? :green : :grey, size: :mini) { text diagram.status }
|
|
17
|
+
}
|
|
18
|
+
TableCell { text diagram.version.to_s }
|
|
19
|
+
TableCell { text time_ago_in_words(diagram.updated_at) + " ago" }
|
|
20
|
+
TableCell {
|
|
21
|
+
HStack(spacing: 4) {
|
|
22
|
+
Button(href: diagram_path(diagram), size: :mini, variant: :basic, icon: "eye")
|
|
23
|
+
Button(href: edit_diagram_path(diagram), size: :mini, variant: :basic, icon: "edit")
|
|
24
|
+
output_buffer << link_to(diagram_path(diagram), class: "ui mini basic red button", data: { turbo_method: :delete, turbo_confirm: "Are you sure?" }) {
|
|
25
|
+
capture { Icon(name: "trash") }
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
end
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
else
|
|
34
|
+
Message(type: :info) {
|
|
35
|
+
text "No diagrams yet. "
|
|
36
|
+
Link(href: new_diagram_path) { text "Create one" }
|
|
37
|
+
}
|
|
38
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
content_for(:head) { bpmn_js_assets(:viewer) }
|
|
2
|
+
|
|
3
|
+
Wrapper(id: "bpmn-app") {
|
|
4
|
+
Wrapper(html_class: "bpmn-header-bar") {
|
|
5
|
+
HStack(justify: "between", align: "center") {
|
|
6
|
+
HStack(spacing: 12, align: "center") {
|
|
7
|
+
Header(size: :h3) { text @diagram.name }
|
|
8
|
+
Label(color: @diagram.status == "published" ? :green : :grey, size: :small) { text @diagram.status }
|
|
9
|
+
Text(size: :small, color: :grey) { text "v#{@diagram.version}" }
|
|
10
|
+
}
|
|
11
|
+
HStack(spacing: 8) {
|
|
12
|
+
Button(href: edit_diagram_path(@diagram), size: :small, variant: :primary, icon: "edit") { text "Edit" }
|
|
13
|
+
Button(href: diagrams_path, size: :small, variant: :basic, icon: "arrow left") { text "Back" }
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
if @diagram.description.present?
|
|
17
|
+
Wrapper(html_class: "bpmn-description") { text @diagram.description }
|
|
18
|
+
end
|
|
19
|
+
}
|
|
20
|
+
Wrapper(html_class: "bpmn-content") {
|
|
21
|
+
BpmnJsViewer(@diagram)
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
Form(model: form, url: form.persisted? ? form_path(form) : forms_path, class: "ui form bpmn-form") {
|
|
2
|
+
if form.errors.any?
|
|
3
|
+
Message(type: :error) { |c|
|
|
4
|
+
c.header { text pluralize(form.errors.count, "error") + " prohibited this form from being saved" }
|
|
5
|
+
form.errors.full_messages.each { |msg| Paragraph { text msg } }
|
|
6
|
+
}
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
Wrapper(html_class: "bpmn-header-bar") {
|
|
10
|
+
VStack(spacing: 8) {
|
|
11
|
+
HStack(spacing: 12, align: "end") {
|
|
12
|
+
Wrapper(style: "flex: 1;") {
|
|
13
|
+
TextField(:name, placeholder: "Form name")
|
|
14
|
+
}
|
|
15
|
+
Select(:status, BpmnJsRails::Form::STATUSES)
|
|
16
|
+
Button(variant: :primary, type: :submit, icon: "save", size: :small) {
|
|
17
|
+
text form.persisted? ? "Update" : "Create"
|
|
18
|
+
}
|
|
19
|
+
if form.persisted?
|
|
20
|
+
Button(href: form_path(form), size: :small, variant: :basic, icon: "eye") { text "View" }
|
|
21
|
+
end
|
|
22
|
+
Button(href: forms_path, size: :small, variant: :basic, icon: "arrow left") { text "Back" }
|
|
23
|
+
}
|
|
24
|
+
TextField(:description, placeholder: "Optional description")
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
Wrapper(html_class: "bpmn-content") {
|
|
29
|
+
FormJsEditor(form, field_name: "form[schema]")
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
HStack(justify: "between", align: "center") {
|
|
2
|
+
Header(size: :h2) { text "Forms" }
|
|
3
|
+
Button(href: new_form_path, variant: :primary, icon: "plus") { text "New Form" }
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
Divider(hidden: true)
|
|
7
|
+
|
|
8
|
+
if @forms.any?
|
|
9
|
+
text datatable(columns: ["Name", "Description", "Status", "Version", "Updated", "Actions"]) {
|
|
10
|
+
capture {
|
|
11
|
+
@forms.each do |form|
|
|
12
|
+
TableRow {
|
|
13
|
+
TableCell { Link(href: form_path(form)) { text form.name } }
|
|
14
|
+
TableCell { text truncate(form.description.to_s, length: 60) }
|
|
15
|
+
TableCell {
|
|
16
|
+
Label(color: form.status == "published" ? :green : :grey, size: :mini) { text form.status }
|
|
17
|
+
}
|
|
18
|
+
TableCell { text form.version.to_s }
|
|
19
|
+
TableCell { text time_ago_in_words(form.updated_at) + " ago" }
|
|
20
|
+
TableCell {
|
|
21
|
+
HStack(spacing: 4) {
|
|
22
|
+
Button(href: form_path(form), size: :mini, variant: :basic, icon: "eye")
|
|
23
|
+
Button(href: edit_form_path(form), size: :mini, variant: :basic, icon: "edit")
|
|
24
|
+
output_buffer << link_to(form_path(form), class: "ui mini basic red button", data: { turbo_method: :delete, turbo_confirm: "Are you sure?" }) {
|
|
25
|
+
capture { Icon(name: "trash") }
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
end
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
else
|
|
34
|
+
Message(type: :info) {
|
|
35
|
+
text "No forms yet. "
|
|
36
|
+
Link(href: new_form_path) { text "Create one" }
|
|
37
|
+
}
|
|
38
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
content_for(:head) { form_js_assets(:viewer) }
|
|
2
|
+
|
|
3
|
+
Wrapper(id: "bpmn-app") {
|
|
4
|
+
Wrapper(html_class: "bpmn-header-bar") {
|
|
5
|
+
HStack(justify: "between", align: "center") {
|
|
6
|
+
HStack(spacing: 12, align: "center") {
|
|
7
|
+
Header(size: :h3) { text @form.name }
|
|
8
|
+
Label(color: @form.status == "published" ? :green : :grey, size: :small) { text @form.status }
|
|
9
|
+
Text(size: :small, color: :grey) { text "v#{@form.version}" }
|
|
10
|
+
}
|
|
11
|
+
HStack(spacing: 8) {
|
|
12
|
+
Button(href: edit_form_path(@form), size: :small, variant: :primary, icon: "edit") { text "Edit" }
|
|
13
|
+
Button(href: forms_path, size: :small, variant: :basic, icon: "arrow left") { text "Back" }
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
if @form.description.present?
|
|
17
|
+
Wrapper(html_class: "bpmn-description") { text @form.description }
|
|
18
|
+
end
|
|
19
|
+
}
|
|
20
|
+
Wrapper(html_class: "bpmn-content") {
|
|
21
|
+
FormJsViewer(@form)
|
|
22
|
+
}
|
|
23
|
+
}
|
data/config/routes.rb
CHANGED
data/lib/bpmn_js_rails/engine.rb
CHANGED
|
@@ -12,7 +12,7 @@ module BpmnJsRails
|
|
|
12
12
|
|
|
13
13
|
initializer "bpmn_js_rails.importmap", before: "importmap" do |app|
|
|
14
14
|
if app.config.respond_to?(:importmap)
|
|
15
|
-
app.config.importmap.paths << root.join("config/importmap.rb")
|
|
15
|
+
app.config.importmap.paths << Engine.root.join("config/importmap.rb")
|
|
16
16
|
end
|
|
17
17
|
end
|
|
18
18
|
|
data/lib/bpmn_js_rails.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: bpmn-js-rails
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- nathan
|
|
@@ -23,6 +23,20 @@ dependencies:
|
|
|
23
23
|
- - ">="
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
25
|
version: 8.1.0
|
|
26
|
+
- !ruby/object:Gem::Dependency
|
|
27
|
+
name: ui
|
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
|
29
|
+
requirements:
|
|
30
|
+
- - ">="
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '0'
|
|
33
|
+
type: :runtime
|
|
34
|
+
prerelease: false
|
|
35
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
36
|
+
requirements:
|
|
37
|
+
- - ">="
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
version: '0'
|
|
26
40
|
description: bpmn-io/bpmn-js and form-js packaged as a Rails engine
|
|
27
41
|
email:
|
|
28
42
|
- nathankidd@hey.com
|
|
@@ -65,6 +79,10 @@ files:
|
|
|
65
79
|
- app/assets/stylesheets/dmn-js/dmn-js-shared.css
|
|
66
80
|
- app/assets/stylesheets/form-js/form-js-editor.css
|
|
67
81
|
- app/assets/stylesheets/form-js/form-js.css
|
|
82
|
+
- app/controllers/bpmn_js_rails/application_controller.rb
|
|
83
|
+
- app/controllers/bpmn_js_rails/decisions_controller.rb
|
|
84
|
+
- app/controllers/bpmn_js_rails/diagrams_controller.rb
|
|
85
|
+
- app/controllers/bpmn_js_rails/forms_controller.rb
|
|
68
86
|
- app/helpers/bpmn_js_rails/view_helper.rb
|
|
69
87
|
- app/javascript/bpmn_js_rails/controllers/bpmn_js_modeler_controller.js
|
|
70
88
|
- app/javascript/bpmn_js_rails/controllers/bpmn_js_viewer_controller.js
|
|
@@ -76,12 +94,26 @@ files:
|
|
|
76
94
|
- app/models/bpmn_js_rails/decision.rb
|
|
77
95
|
- app/models/bpmn_js_rails/diagram.rb
|
|
78
96
|
- app/models/bpmn_js_rails/form.rb
|
|
97
|
+
- app/views/bpmn_js_rails/decisions/_form.html.ruby
|
|
98
|
+
- app/views/bpmn_js_rails/decisions/edit.html.ruby
|
|
99
|
+
- app/views/bpmn_js_rails/decisions/index.html.ruby
|
|
100
|
+
- app/views/bpmn_js_rails/decisions/new.html.ruby
|
|
101
|
+
- app/views/bpmn_js_rails/decisions/show.html.ruby
|
|
102
|
+
- app/views/bpmn_js_rails/diagrams/_form.html.ruby
|
|
103
|
+
- app/views/bpmn_js_rails/diagrams/edit.html.ruby
|
|
104
|
+
- app/views/bpmn_js_rails/diagrams/index.html.ruby
|
|
105
|
+
- app/views/bpmn_js_rails/diagrams/new.html.ruby
|
|
106
|
+
- app/views/bpmn_js_rails/diagrams/show.html.ruby
|
|
107
|
+
- app/views/bpmn_js_rails/forms/_form.html.ruby
|
|
108
|
+
- app/views/bpmn_js_rails/forms/edit.html.ruby
|
|
109
|
+
- app/views/bpmn_js_rails/forms/index.html.ruby
|
|
110
|
+
- app/views/bpmn_js_rails/forms/new.html.ruby
|
|
111
|
+
- app/views/bpmn_js_rails/forms/show.html.ruby
|
|
79
112
|
- config/importmap.rb
|
|
80
113
|
- config/routes.rb
|
|
81
114
|
- db/migrate/20260319000001_create_bpmn_js_rails_diagrams.rb
|
|
82
115
|
- db/migrate/20260319000002_create_bpmn_js_rails_forms.rb
|
|
83
116
|
- db/migrate/20260319000003_create_bpmn_js_rails_decisions.rb
|
|
84
|
-
- lib/bpmn-js-rails.rb
|
|
85
117
|
- lib/bpmn_js_rails.rb
|
|
86
118
|
- lib/bpmn_js_rails/engine.rb
|
|
87
119
|
- lib/bpmn_js_rails/version.rb
|
data/lib/bpmn-js-rails.rb
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
require "bpmn_js_rails"
|