qube_rails 0.2.0 → 0.2.1
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/CHANGELOG.md +216 -0
- data/README.md +242 -69
- data/app/assets/javascripts/qube_rails/question.js +425 -38
- data/app/assets/stylesheets/qube_rails.css +1201 -907
- data/app/controllers/qube_rails/connections_controller.rb +23 -6
- data/app/controllers/qube_rails/questions_controller.rb +39 -7
- data/app/controllers/qube_rails/runs_controller.rb +4 -3
- data/app/models/qube_rails/connection.rb +22 -2
- data/app/models/qube_rails/run.rb +28 -10
- data/app/views/qube_rails/_error.html.erb +2 -2
- data/app/views/qube_rails/_question.html.erb +4 -1
- data/app/views/qube_rails/question/_choice.html.erb +36 -11
- data/app/views/qube_rails/question/_exit_button.html.erb +8 -0
- data/app/views/qube_rails/question/_field.html.erb +4 -3
- data/app/views/qube_rails/question/_footer.html.erb +19 -5
- data/app/views/qube_rails/question/_pick.html.erb +8 -3
- data/app/views/qube_rails/question/_picks.html.erb +4 -2
- data/app/views/qube_rails/question/_question.html.erb +22 -7
- data/app/views/qube_rails/question/_submit.html.erb +9 -0
- data/app/views/qube_rails/question/fields/_boolean.html.erb +2 -2
- data/app/views/qube_rails/question/fields/_number.html.erb +2 -2
- data/app/views/qube_rails/question/fields/_rows.html.erb +17 -4
- data/app/views/qube_rails/question/fields/_search.html.erb +3 -1
- data/app/views/qube_rails/question/fields/_select.html.erb +6 -5
- data/app/views/qube_rails/question/fields/_text.html.erb +2 -2
- data/app/views/qube_rails/question/rows/_segmented.html.erb +3 -1
- data/app/views/qube_rails/run_status/_detail.html.erb +5 -1
- data/app/views/qube_rails/run_status/_status.html.erb +5 -2
- data/config/locales/en.yml +23 -1
- data/db/migrate/20261031000000_add_qube_connection_type_and_run_headline.rb +12 -0
- data/lib/generators/qube_rails/templates/initializer.rb.tt +12 -4
- data/lib/qube_rails/configuration.rb +3 -2
- data/lib/qube_rails/connection_events.rb +3 -0
- data/lib/qube_rails/operation.rb +115 -32
- data/lib/qube_rails/question_view.rb +235 -29
- data/lib/qube_rails/rows_view.rb +18 -5
- data/lib/qube_rails/run_status_view.rb +12 -7
- data/lib/qube_rails/storyboard/ask_about_add.json +8 -10
- data/lib/qube_rails/storyboard/choose.json +8 -5
- data/lib/qube_rails/storyboard/enum_select.json +4 -3
- data/lib/qube_rails/storyboard/missing_record.json +10 -13
- data/lib/qube_rails/storyboard/name_clash.json +10 -18
- data/lib/qube_rails/storyboard/near_match.json +12 -14
- data/lib/qube_rails/storyboard/number_boolean.json +4 -3
- data/lib/qube_rails/storyboard/record_search.json +14 -15
- data/lib/qube_rails/storyboard/refusal.json +10 -18
- data/lib/qube_rails/storyboard/rows.json +11 -14
- data/lib/qube_rails/storyboard.rb +8 -3
- data/lib/qube_rails/sync_status.rb +4 -2
- data/lib/qube_rails/version.rb +1 -1
- data/lib/qube_rails/view_helpers.rb +4 -2
- data/lib/qube_rails.rb +2 -2
- metadata +5 -2
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"id": "add_transaction / ask_missing",
|
|
6
6
|
"kind": "decision",
|
|
7
7
|
"token": "Mc7pR4tKw2NbY9xQ",
|
|
8
|
-
"message": "
|
|
8
|
+
"message": "This invoice names records QuickBooks doesn't have. Create each one, or use one it has.",
|
|
9
9
|
"data": {
|
|
10
10
|
"operation": "invoice",
|
|
11
11
|
"missing": [
|
|
@@ -33,10 +33,6 @@
|
|
|
33
33
|
]
|
|
34
34
|
},
|
|
35
35
|
"details": [
|
|
36
|
-
{
|
|
37
|
-
"label": "Adding",
|
|
38
|
-
"value": "Invoice"
|
|
39
|
-
},
|
|
40
36
|
{
|
|
41
37
|
"label": "Number",
|
|
42
38
|
"value": "1042"
|
|
@@ -46,24 +42,24 @@
|
|
|
46
42
|
"value": "Lone Star Supply"
|
|
47
43
|
}
|
|
48
44
|
],
|
|
49
|
-
"options": [],
|
|
50
45
|
"choices": [
|
|
51
46
|
{
|
|
52
47
|
"id": "proceed",
|
|
53
|
-
"label": "Add the
|
|
48
|
+
"label": "Add the invoice",
|
|
54
49
|
"description": null,
|
|
55
50
|
"detail": null,
|
|
56
51
|
"fields": [
|
|
57
52
|
{
|
|
58
53
|
"name": "records",
|
|
59
54
|
"type": "rows",
|
|
60
|
-
"label": "
|
|
55
|
+
"label": "",
|
|
61
56
|
"required": true,
|
|
62
57
|
"columns": [
|
|
63
58
|
{
|
|
64
59
|
"name": "action",
|
|
65
60
|
"type": "string",
|
|
66
61
|
"label": "What to do",
|
|
62
|
+
"default": "create",
|
|
67
63
|
"required": true,
|
|
68
64
|
"kind": null,
|
|
69
65
|
"enum": [
|
|
@@ -81,7 +77,7 @@
|
|
|
81
77
|
{
|
|
82
78
|
"name": "list_id",
|
|
83
79
|
"type": "record",
|
|
84
|
-
"label": "
|
|
80
|
+
"label": "Which one",
|
|
85
81
|
"required": true,
|
|
86
82
|
"kind": null,
|
|
87
83
|
"enum": null,
|
|
@@ -108,14 +104,15 @@
|
|
|
108
104
|
}
|
|
109
105
|
]
|
|
110
106
|
}
|
|
111
|
-
]
|
|
107
|
+
],
|
|
108
|
+
"role": "answer"
|
|
112
109
|
},
|
|
113
110
|
{
|
|
114
111
|
"id": "cancel",
|
|
115
|
-
"label": "Cancel",
|
|
116
|
-
"description": "Stop here. Nothing is created.",
|
|
112
|
+
"label": "Cancel adding the invoice",
|
|
117
113
|
"detail": null,
|
|
118
|
-
"fields": []
|
|
114
|
+
"fields": [],
|
|
115
|
+
"role": "cancel"
|
|
119
116
|
}
|
|
120
117
|
]
|
|
121
118
|
},
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"id": "ensure / ask_use",
|
|
6
6
|
"kind": "decision",
|
|
7
7
|
"token": "Wg5qU7vAs3PhB5dD",
|
|
8
|
-
"message": "
|
|
8
|
+
"message": "QuickBooks already has the customer “Riverbend Electric”.",
|
|
9
9
|
"data": {
|
|
10
10
|
"kind": "customer",
|
|
11
11
|
"name": "Riverbend Electric",
|
|
@@ -13,29 +13,20 @@
|
|
|
13
13
|
"list": "customer"
|
|
14
14
|
}
|
|
15
15
|
},
|
|
16
|
-
"details": [
|
|
17
|
-
{
|
|
18
|
-
"label": "Customer",
|
|
19
|
-
"value": "Riverbend Electric"
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
"label": "Held by",
|
|
23
|
-
"value": "Customer"
|
|
24
|
-
}
|
|
25
|
-
],
|
|
26
|
-
"options": [],
|
|
16
|
+
"details": [],
|
|
27
17
|
"choices": [
|
|
28
18
|
{
|
|
29
19
|
"id": "use_existing",
|
|
30
20
|
"label": "Use the existing record",
|
|
31
21
|
"description": "Carry on with the record QuickBooks already has. Nothing new is created.",
|
|
32
22
|
"detail": null,
|
|
33
|
-
"fields": []
|
|
23
|
+
"fields": [],
|
|
24
|
+
"role": "answer"
|
|
34
25
|
},
|
|
35
26
|
{
|
|
36
27
|
"id": "rename",
|
|
37
28
|
"label": "Add it under another name",
|
|
38
|
-
"description": "Try the add again
|
|
29
|
+
"description": "Try the add again with a different name.",
|
|
39
30
|
"detail": null,
|
|
40
31
|
"fields": [
|
|
41
32
|
{
|
|
@@ -44,14 +35,15 @@
|
|
|
44
35
|
"label": "New name",
|
|
45
36
|
"required": true
|
|
46
37
|
}
|
|
47
|
-
]
|
|
38
|
+
],
|
|
39
|
+
"role": "answer"
|
|
48
40
|
},
|
|
49
41
|
{
|
|
50
42
|
"id": "cancel",
|
|
51
|
-
"label": "Cancel",
|
|
52
|
-
"description": "Stop here. Nothing is created.",
|
|
43
|
+
"label": "Cancel adding the invoice",
|
|
53
44
|
"detail": null,
|
|
54
|
-
"fields": []
|
|
45
|
+
"fields": [],
|
|
46
|
+
"role": "cancel"
|
|
55
47
|
}
|
|
56
48
|
]
|
|
57
49
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"title": "A near match",
|
|
3
|
-
"note": "resolve's ask: QuickBooks has no
|
|
3
|
+
"note": "resolve's ask, asked for an invoice: QuickBooks has no customer with exactly that name, and the message names it, so no detail row repeats it. The similar ones are the possible matches (detail says why), the first the main action; the exits' row under them reads \"Cancel adding the invoice\" at its start and \"Not this one\" at its end, which swaps the possible match for a search over every customer, with \"← Back to the possible match\" above it and \"It's not in QuickBooks\" beside its \"Use this one\" (shown once a match is picked; the decline becomes the main action after a search that finds nothing). Without the script the search can't work, so the row holds Cancel and \"It's not in QuickBooks\". With an add from the caller, \"It's not in QuickBooks\" says the record is added as new (adds: true). Each choice's role (pick, search, decline, cancel) says how to weigh it.",
|
|
4
4
|
"prompt": {
|
|
5
5
|
"choices": [
|
|
6
6
|
{
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
"detail": "similar name · ap@riverbend.example · 512-555-0142",
|
|
9
9
|
"fields": [],
|
|
10
10
|
"id": "use:1",
|
|
11
|
-
"label": "Riverbend Electric"
|
|
11
|
+
"label": "Riverbend Electric",
|
|
12
|
+
"role": "pick"
|
|
12
13
|
},
|
|
13
14
|
{
|
|
14
15
|
"description": null,
|
|
@@ -16,43 +17,40 @@
|
|
|
16
17
|
"fields": [
|
|
17
18
|
{
|
|
18
19
|
"kind": "customer",
|
|
19
|
-
"label": "
|
|
20
|
+
"label": "Not listed? Search QuickBooks",
|
|
20
21
|
"name": "list_id",
|
|
21
22
|
"required": true,
|
|
22
23
|
"type": "record"
|
|
23
24
|
}
|
|
24
25
|
],
|
|
25
26
|
"id": "use",
|
|
26
|
-
"label": "Use this one"
|
|
27
|
+
"label": "Use this one",
|
|
28
|
+
"role": "search"
|
|
27
29
|
},
|
|
28
30
|
{
|
|
29
31
|
"description": null,
|
|
30
32
|
"detail": null,
|
|
31
33
|
"fields": [],
|
|
32
34
|
"id": "none",
|
|
33
|
-
"label": "
|
|
35
|
+
"label": "It's not in QuickBooks: add \"Riverbend\" as new",
|
|
36
|
+
"role": "decline"
|
|
34
37
|
},
|
|
35
38
|
{
|
|
36
39
|
"description": null,
|
|
37
40
|
"detail": null,
|
|
38
41
|
"fields": [],
|
|
39
42
|
"id": "cancel",
|
|
40
|
-
"label": "Cancel"
|
|
43
|
+
"label": "Cancel adding the invoice",
|
|
44
|
+
"role": "cancel"
|
|
41
45
|
}
|
|
42
46
|
],
|
|
43
47
|
"data": {
|
|
44
48
|
"name": "Riverbend"
|
|
45
49
|
},
|
|
46
|
-
"details": [
|
|
47
|
-
{
|
|
48
|
-
"label": "Customer",
|
|
49
|
-
"value": "Riverbend"
|
|
50
|
-
}
|
|
51
|
-
],
|
|
50
|
+
"details": [],
|
|
52
51
|
"id": "resolve / ask",
|
|
53
52
|
"kind": "decision",
|
|
54
|
-
"message": "
|
|
55
|
-
"options": [],
|
|
53
|
+
"message": "QuickBooks has no customer named exactly “Riverbend”.",
|
|
56
54
|
"token": "Vq3kT9xRb2LmW8sZ"
|
|
57
55
|
},
|
|
58
56
|
"search": {
|
|
@@ -19,7 +19,6 @@
|
|
|
19
19
|
"value": "3"
|
|
20
20
|
}
|
|
21
21
|
],
|
|
22
|
-
"options": [],
|
|
23
22
|
"choices": [
|
|
24
23
|
{
|
|
25
24
|
"id": "adjust",
|
|
@@ -39,14 +38,16 @@
|
|
|
39
38
|
"label": "Allow a negative quantity on hand",
|
|
40
39
|
"required": false
|
|
41
40
|
}
|
|
42
|
-
]
|
|
41
|
+
],
|
|
42
|
+
"role": "answer"
|
|
43
43
|
},
|
|
44
44
|
{
|
|
45
45
|
"id": "cancel",
|
|
46
46
|
"label": "Cancel",
|
|
47
47
|
"description": null,
|
|
48
48
|
"detail": null,
|
|
49
|
-
"fields": []
|
|
49
|
+
"fields": [],
|
|
50
|
+
"role": "cancel"
|
|
50
51
|
}
|
|
51
52
|
]
|
|
52
53
|
},
|
|
@@ -1,43 +1,40 @@
|
|
|
1
1
|
{
|
|
2
2
|
"title": "A pick from the records there are",
|
|
3
|
-
"note": "resolve's ask_pick: nothing has that name and nothing may be created for it (an account here), so the person picks one: the first active records as rows, then a search over every record of the kind. The search box asks your app's search route and fills a hidden input with the pick's ListID.",
|
|
3
|
+
"note": "resolve's ask_pick: nothing has that name and nothing may be created for it (an account here), so the person picks one: the first active records as rows, then, after \"None of these\", a search over every record of the kind. The search box asks your app's search route and fills a hidden input with the pick's ListID.",
|
|
4
4
|
"prompt": {
|
|
5
5
|
"id": "resolve / ask_pick",
|
|
6
6
|
"kind": "decision",
|
|
7
7
|
"token": "Sb4kQ2rTn8LmV1xZ",
|
|
8
|
-
"message": "QuickBooks has
|
|
8
|
+
"message": "QuickBooks has no account named “Consulting Income”.",
|
|
9
9
|
"data": {
|
|
10
10
|
"name": "Consulting Income",
|
|
11
11
|
"kind": "account"
|
|
12
12
|
},
|
|
13
|
-
"details": [
|
|
14
|
-
{
|
|
15
|
-
"label": "Account",
|
|
16
|
-
"value": "Consulting Income"
|
|
17
|
-
}
|
|
18
|
-
],
|
|
19
|
-
"options": [],
|
|
13
|
+
"details": [],
|
|
20
14
|
"choices": [
|
|
21
15
|
{
|
|
22
16
|
"id": "use:1",
|
|
23
17
|
"label": "Sales",
|
|
24
18
|
"description": null,
|
|
25
19
|
"detail": null,
|
|
26
|
-
"fields": []
|
|
20
|
+
"fields": [],
|
|
21
|
+
"role": "pick"
|
|
27
22
|
},
|
|
28
23
|
{
|
|
29
24
|
"id": "use:2",
|
|
30
25
|
"label": "Sales:Signs",
|
|
31
26
|
"description": null,
|
|
32
27
|
"detail": null,
|
|
33
|
-
"fields": []
|
|
28
|
+
"fields": [],
|
|
29
|
+
"role": "pick"
|
|
34
30
|
},
|
|
35
31
|
{
|
|
36
32
|
"id": "use:3",
|
|
37
33
|
"label": "Service Income",
|
|
38
34
|
"description": null,
|
|
39
35
|
"detail": null,
|
|
40
|
-
"fields": []
|
|
36
|
+
"fields": [],
|
|
37
|
+
"role": "pick"
|
|
41
38
|
},
|
|
42
39
|
{
|
|
43
40
|
"id": "use",
|
|
@@ -52,14 +49,16 @@
|
|
|
52
49
|
"label": "Search for the one to use",
|
|
53
50
|
"required": true
|
|
54
51
|
}
|
|
55
|
-
]
|
|
52
|
+
],
|
|
53
|
+
"role": "search"
|
|
56
54
|
},
|
|
57
55
|
{
|
|
58
56
|
"id": "cancel",
|
|
59
|
-
"label": "Cancel",
|
|
57
|
+
"label": "Cancel adding the invoice",
|
|
60
58
|
"description": null,
|
|
61
59
|
"detail": null,
|
|
62
|
-
"fields": []
|
|
60
|
+
"fields": [],
|
|
61
|
+
"role": "cancel"
|
|
63
62
|
}
|
|
64
63
|
]
|
|
65
64
|
},
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"title": "An answer QuBe Sync refused (422)",
|
|
3
|
-
"note": "The question again, with why QuBe Sync couldn't take the answer (its errors.detail), from flash[:
|
|
4
|
-
"error": "That answer couldn't be used: a new name
|
|
3
|
+
"note": "The question again, with why QuBe Sync couldn't take the answer (its errors.detail) and what was typed, from flash[:qube_rails_refusal].",
|
|
4
|
+
"error": "That answer couldn't be used: a new name can't be one QuickBooks already has.",
|
|
5
|
+
"refused": { "choice": "rename", "values": { "name": "Riverbend Electric" } },
|
|
5
6
|
"prompt": {
|
|
6
7
|
"id": "ensure / ask_rename",
|
|
7
8
|
"kind": "decision",
|
|
8
9
|
"token": "Zk8tX1yDv6SmE8gG",
|
|
9
|
-
"message": "
|
|
10
|
+
"message": "QuickBooks already has the vendor “Riverbend Electric”, so the customer can't have that name too.",
|
|
10
11
|
"data": {
|
|
11
12
|
"kind": "customer",
|
|
12
13
|
"name": "Riverbend Electric",
|
|
@@ -14,17 +15,7 @@
|
|
|
14
15
|
"list": "vendor"
|
|
15
16
|
}
|
|
16
17
|
},
|
|
17
|
-
"details": [
|
|
18
|
-
{
|
|
19
|
-
"label": "Customer",
|
|
20
|
-
"value": "Riverbend Electric"
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
"label": "Held by",
|
|
24
|
-
"value": "Vendor"
|
|
25
|
-
}
|
|
26
|
-
],
|
|
27
|
-
"options": [],
|
|
18
|
+
"details": [],
|
|
28
19
|
"choices": [
|
|
29
20
|
{
|
|
30
21
|
"id": "rename",
|
|
@@ -38,14 +29,15 @@
|
|
|
38
29
|
"label": "New name",
|
|
39
30
|
"required": true
|
|
40
31
|
}
|
|
41
|
-
]
|
|
32
|
+
],
|
|
33
|
+
"role": "answer"
|
|
42
34
|
},
|
|
43
35
|
{
|
|
44
36
|
"id": "cancel",
|
|
45
|
-
"label": "Cancel",
|
|
46
|
-
"description": "Stop here. Nothing is created.",
|
|
37
|
+
"label": "Cancel adding the invoice",
|
|
47
38
|
"detail": null,
|
|
48
|
-
"fields": []
|
|
39
|
+
"fields": [],
|
|
40
|
+
"role": "cancel"
|
|
49
41
|
}
|
|
50
42
|
]
|
|
51
43
|
},
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"title": "Records not in QuickBooks yet",
|
|
3
|
-
"note": "add_transaction's ask_missing: a block per missing record, its fields stacked, each shown while its \"when\" holds. Hardware Kit's add says it's an inventory part, so its type is shown, not asked.
|
|
3
|
+
"note": "add_transaction's ask_missing: a block per missing record, its fields stacked, each shown while its \"when\" holds. Hardware Kit's add says it's an inventory part, so its type is shown, not asked. It asks one record at a time: the button row reads Cancel at the start, then the step count, Back and Next (the submit on the last record). It needs the behaviour script; without it a line says so. \"Use for the other record too\" copies a picked value to the others.",
|
|
4
4
|
"prompt": {
|
|
5
5
|
"id": "add_transaction / ask_missing",
|
|
6
6
|
"kind": "decision",
|
|
7
7
|
"token": "Yj7sW9xCu5RkD7fF",
|
|
8
|
-
"message": "
|
|
8
|
+
"message": "This invoice names records QuickBooks doesn't have. Create each one, or use one it has.",
|
|
9
9
|
"data": {
|
|
10
10
|
"operation": "invoice",
|
|
11
11
|
"missing": [
|
|
@@ -33,10 +33,6 @@
|
|
|
33
33
|
]
|
|
34
34
|
},
|
|
35
35
|
"details": [
|
|
36
|
-
{
|
|
37
|
-
"label": "Adding",
|
|
38
|
-
"value": "Invoice"
|
|
39
|
-
},
|
|
40
36
|
{
|
|
41
37
|
"label": "Number",
|
|
42
38
|
"value": "1042"
|
|
@@ -46,24 +42,24 @@
|
|
|
46
42
|
"value": "Lone Star Supply"
|
|
47
43
|
}
|
|
48
44
|
],
|
|
49
|
-
"options": [],
|
|
50
45
|
"choices": [
|
|
51
46
|
{
|
|
52
47
|
"id": "proceed",
|
|
53
|
-
"label": "Add the
|
|
48
|
+
"label": "Add the invoice",
|
|
54
49
|
"description": null,
|
|
55
50
|
"detail": null,
|
|
56
51
|
"fields": [
|
|
57
52
|
{
|
|
58
53
|
"name": "records",
|
|
59
54
|
"type": "rows",
|
|
60
|
-
"label": "
|
|
55
|
+
"label": "",
|
|
61
56
|
"required": true,
|
|
62
57
|
"columns": [
|
|
63
58
|
{
|
|
64
59
|
"name": "action",
|
|
65
60
|
"type": "string",
|
|
66
61
|
"label": "What to do",
|
|
62
|
+
"default": "create",
|
|
67
63
|
"required": true,
|
|
68
64
|
"kind": null,
|
|
69
65
|
"enum": [
|
|
@@ -81,7 +77,7 @@
|
|
|
81
77
|
{
|
|
82
78
|
"name": "list_id",
|
|
83
79
|
"type": "record",
|
|
84
|
-
"label": "
|
|
80
|
+
"label": "Which one",
|
|
85
81
|
"required": true,
|
|
86
82
|
"kind": null,
|
|
87
83
|
"enum": null,
|
|
@@ -250,14 +246,15 @@
|
|
|
250
246
|
}
|
|
251
247
|
]
|
|
252
248
|
}
|
|
253
|
-
]
|
|
249
|
+
],
|
|
250
|
+
"role": "answer"
|
|
254
251
|
},
|
|
255
252
|
{
|
|
256
253
|
"id": "cancel",
|
|
257
|
-
"label": "Cancel",
|
|
258
|
-
"description": "Stop here. Nothing is created.",
|
|
254
|
+
"label": "Cancel adding the invoice",
|
|
259
255
|
"detail": null,
|
|
260
|
-
"fields": []
|
|
256
|
+
"fields": [],
|
|
257
|
+
"role": "cancel"
|
|
261
258
|
}
|
|
262
259
|
]
|
|
263
260
|
},
|
|
@@ -86,8 +86,11 @@ module QubeRails
|
|
|
86
86
|
end
|
|
87
87
|
|
|
88
88
|
def question_view(screen, answer_path, search_path)
|
|
89
|
-
|
|
90
|
-
|
|
89
|
+
prompt = screen.sample["prompt"]
|
|
90
|
+
refused = screen.sample["refused"]
|
|
91
|
+
refusal = refused && refused.merge("token" => prompt["token"], "message" => screen.sample["error"])
|
|
92
|
+
QuestionView.new(prompt, action_url: answer_path, search_url: search_path,
|
|
93
|
+
error: refusal ? nil : screen.sample["error"], refusal: refusal)
|
|
91
94
|
end
|
|
92
95
|
|
|
93
96
|
# The sample's matches for a search: at most 20 whose label holds q.
|
|
@@ -132,7 +135,9 @@ module QubeRails
|
|
|
132
135
|
view = QuestionView.new(prompt, action_url: "", search_url: "")
|
|
133
136
|
list.concat(%w[question/picks question/pick]) if view.picks.any?
|
|
134
137
|
list << "question/choice" if view.forms.any? || view.exits.any?
|
|
135
|
-
list << "question/
|
|
138
|
+
list << "question/submit" if view.choices.any?
|
|
139
|
+
list << "question/exit_button" if view.joined_form && view.exits.any?
|
|
140
|
+
list << "question/footer" if view.chain? || (!view.joined_form && view.exits.any?)
|
|
136
141
|
list << "error" if sample["error"]
|
|
137
142
|
fields = Array(prompt["choices"]).flat_map { |choice| Array(choice["fields"]) }
|
|
138
143
|
fields.each do |field|
|
|
@@ -10,7 +10,8 @@ module QubeRails
|
|
|
10
10
|
# status.status # => :not_sent, :sending, :needs_answer, :in_quickbooks, :done, :failed or
|
|
11
11
|
# # :cancelled
|
|
12
12
|
# status.qb_id # the record's QuickBooks id on this connection, when it's linked
|
|
13
|
-
# status.error # a failed run's error ({ "
|
|
13
|
+
# status.error # a failed run's error ({ "code", "type", "message", "quickbooks_message",
|
|
14
|
+
# # "hint" }, or an older run's sentence), else nil
|
|
14
15
|
# status.retry? # whether starting it again makes sense
|
|
15
16
|
#
|
|
16
17
|
# Per connection: an invoice can be in one company file and not another.
|
|
@@ -20,7 +21,7 @@ module QubeRails
|
|
|
20
21
|
# 1. the latest run hasn't ended: :sending (starting or running, an unconfirmed start too:
|
|
21
22
|
# unconfirmed? says so) or :needs_answer (awaiting input), whatever the link says;
|
|
22
23
|
# 2. the latest run failed or was cancelled after the link was made (or there's no link):
|
|
23
|
-
# :failed or :cancelled;
|
|
24
|
+
# :failed or :cancelled; a start refused as realtime_required is :failed whatever the link;
|
|
24
25
|
# 3. the record is linked: :in_quickbooks, always with its qb_id;
|
|
25
26
|
# 4. the latest run completed and linked nothing (an operation that doesn't link its record):
|
|
26
27
|
# :done, which a start may follow, since nothing in QuickBooks stands for the record;
|
|
@@ -49,6 +50,7 @@ module QubeRails
|
|
|
49
50
|
end
|
|
50
51
|
|
|
51
52
|
def self.status_of(run, link)
|
|
53
|
+
return :failed if run&.realtime_required?
|
|
52
54
|
return in_flight(run) if run && !run.ended?
|
|
53
55
|
return stopped(run) if stopped_since_link?(run, link)
|
|
54
56
|
return :in_quickbooks if link
|
data/lib/qube_rails/version.rb
CHANGED
|
@@ -10,8 +10,10 @@ module QubeRails
|
|
|
10
10
|
# qube_rails.css.
|
|
11
11
|
def qube_rails_assets(stylesheet: false)
|
|
12
12
|
tags = []
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
# data-turbo-track: under Turbo Drive a changed asset (a gem update) reloads the page, rather
|
|
14
|
+
# than keeping the old script, whose once-per-page guard would skip the new one.
|
|
15
|
+
tags << stylesheet_link_tag("qube_rails", media: "all", "data-turbo-track": "reload") if stylesheet
|
|
16
|
+
tags << javascript_include_tag("qube_rails/question", defer: true, nonce: true, "data-turbo-track": "reload")
|
|
15
17
|
safe_join(tags, "\n")
|
|
16
18
|
end
|
|
17
19
|
|
data/lib/qube_rails.rb
CHANGED
|
@@ -41,8 +41,8 @@ module QubeRails
|
|
|
41
41
|
# is sent, saying which reference and which record.
|
|
42
42
|
class MissingReference < ArgumentError; end
|
|
43
43
|
|
|
44
|
-
#
|
|
45
|
-
#
|
|
44
|
+
# Operation.start on a standard connection, or a start QuBe Sync refused (422
|
|
45
|
+
# realtime_required): workflows run on realtime connections. Its message says how to upgrade.
|
|
46
46
|
class RealtimeRequired < StandardError; end
|
|
47
47
|
|
|
48
48
|
# Seconds after an event before a record's pages are told to refresh once more.
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: qube_rails
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Garrett Lancaster
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-11-28 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: qube_sync
|
|
@@ -89,12 +89,14 @@ files:
|
|
|
89
89
|
- app/views/qube_rails/_run_status.html.erb
|
|
90
90
|
- app/views/qube_rails/question/_choice.html.erb
|
|
91
91
|
- app/views/qube_rails/question/_details.html.erb
|
|
92
|
+
- app/views/qube_rails/question/_exit_button.html.erb
|
|
92
93
|
- app/views/qube_rails/question/_field.html.erb
|
|
93
94
|
- app/views/qube_rails/question/_footer.html.erb
|
|
94
95
|
- app/views/qube_rails/question/_message.html.erb
|
|
95
96
|
- app/views/qube_rails/question/_pick.html.erb
|
|
96
97
|
- app/views/qube_rails/question/_picks.html.erb
|
|
97
98
|
- app/views/qube_rails/question/_question.html.erb
|
|
99
|
+
- app/views/qube_rails/question/_submit.html.erb
|
|
98
100
|
- app/views/qube_rails/question/fields/_boolean.html.erb
|
|
99
101
|
- app/views/qube_rails/question/fields/_number.html.erb
|
|
100
102
|
- app/views/qube_rails/question/fields/_rows.html.erb
|
|
@@ -117,6 +119,7 @@ files:
|
|
|
117
119
|
- db/migrate/20261026230000_add_qube_sync_status_indexes.rb
|
|
118
120
|
- db/migrate/20261027000000_create_qube_sync_marks.rb
|
|
119
121
|
- db/migrate/20261028000000_create_qube_requests.rb
|
|
122
|
+
- db/migrate/20261031000000_add_qube_connection_type_and_run_headline.rb
|
|
120
123
|
- lib/generators/qube_rails/install_generator.rb
|
|
121
124
|
- lib/generators/qube_rails/templates/connection_events.rb.tt
|
|
122
125
|
- lib/generators/qube_rails/templates/initializer.rb.tt
|