mkbrut 0.4.2 → 0.5.0
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/lib/mkbrut/segments/demo.rb +5 -1
- data/lib/mkbrut/version.rb +1 -1
- data/package.json +2 -2
- data/templates/Base/app/config/i18n/en/1_defaults.rb +2 -2
- data/templates/Base/app/config/i18n/en/2_app.rb +4 -4
- data/templates/Base/app/src/front_end/layouts/default_layout.rb.erb +6 -9
- data/templates/segments/Demo/app/src/front_end/handlers/guestbook_message_handler.rb +1 -1
- data/templates/segments/Demo/specs/e2e/guest_message.spec.rb +3 -3
- metadata +4 -4
- /data/templates/Base/app/src/back_end/data_models/migrations/{00000000000000_citext.rb → 20240101130000_citext.rb} +0 -0
- /data/templates/{Base → segments/Demo}/app/src/front_end/css/fonts.css +0 -0
- /data/templates/{Base → segments/Demo}/app/src/front_end/fonts/monaspace-xenon.ttf +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 232eed36ec0bbda9d4e20f06396c788220e39ec645fccb29eafd8af32529f8d9
|
4
|
+
data.tar.gz: 87039bccf6f8ffd4a7f37499f1b9a6a5072c45d172a60b9a4f918048851a7282
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 49a861539c7f6c9858b15529e824f066ecd63ea67cf089f4719c4d102dab10d8018182ae15a9454441c49b76e2ef902d9f347d1282b38aba664b3dd381bd83c8
|
7
|
+
data.tar.gz: 70d7a71119c9ec72105e84803e7124b1ec7c7105b40bb2bd6975466ff1fb7834f8569867729523dfd64b069a46421951d5370979bfb8c1a0b6e59eb58e821bf6
|
data/lib/mkbrut/segments/demo.rb
CHANGED
@@ -28,7 +28,7 @@ private
|
|
28
28
|
hash: {
|
29
29
|
en: {
|
30
30
|
cv: {
|
31
|
-
|
31
|
+
ss: {
|
32
32
|
not_enough_words: "%{field} does not have enough words",
|
33
33
|
already_posted: "You've already posted a message. Thanks for that!",
|
34
34
|
},
|
@@ -72,6 +72,10 @@ end
|
|
72
72
|
project_root: project_root,
|
73
73
|
import: "constraint-violations.css"
|
74
74
|
),
|
75
|
+
MKBrut::Ops::AddCSSImport.new(
|
76
|
+
project_root: project_root,
|
77
|
+
import: "fonts.css"
|
78
|
+
),
|
75
79
|
MKBrut::Ops::InsertCodeInMethod.new(
|
76
80
|
file: project_root / "app" / "src" / "front_end" / "pages"/ "home_page.rb",
|
77
81
|
class_name: "HomePage",
|
data/lib/mkbrut/version.rb
CHANGED
data/package.json
CHANGED
@@ -88,7 +88,7 @@
|
|
88
88
|
},
|
89
89
|
cv: { # short for "constraint violations" to avoid having to type that out
|
90
90
|
this_field: "This field",
|
91
|
-
|
91
|
+
cs: { # short for "client-side", again to not have to type it out
|
92
92
|
# These keys use camel-case because that is how the browser defines
|
93
93
|
# these values, based on ValidityState
|
94
94
|
badInput: "%{field} is the wrong type of data",
|
@@ -102,7 +102,7 @@
|
|
102
102
|
valueMissing: "%{field} is required",
|
103
103
|
general: "Form is invalid",
|
104
104
|
},
|
105
|
-
|
105
|
+
ss: { # short for "server-side", again not to have to type it out
|
106
106
|
# These are snake case, which is idiomatic for Ruby. The values
|
107
107
|
# here are all based on DataObjectValidator's behavior
|
108
108
|
required: "%{field} is required",
|
@@ -2,11 +2,11 @@
|
|
2
2
|
{
|
3
3
|
# en: must be the first entry, thus indicating this is the EN translations
|
4
4
|
en: {
|
5
|
-
cv: {
|
6
|
-
|
7
|
-
email_taken: "This email has been taken",
|
5
|
+
cv: {
|
6
|
+
cs: {
|
8
7
|
},
|
9
|
-
|
8
|
+
ss: {
|
9
|
+
email_taken: "This email has been taken",
|
10
10
|
},
|
11
11
|
},
|
12
12
|
pages: { # Page-specific messages - this key is relied-upon by Brut to exist
|
@@ -38,9 +38,9 @@ class DefaultLayout < Brut::FrontEnd::Layout
|
|
38
38
|
PageIdentifier(@page_name)
|
39
39
|
|
40
40
|
# Brut::FrontEnd::Components::I18nTranslations, which includes
|
41
|
-
# translations starting with cv.
|
41
|
+
# translations starting with cv.cs for use with client-side
|
42
42
|
# constraint violation messaging.
|
43
|
-
I18nTranslations("cv.
|
43
|
+
I18nTranslations("cv.cs")
|
44
44
|
# Brut::FrontEnd::Components::I18nTranslations, which includes
|
45
45
|
# translations for cv.this_field, which is used with client-side
|
46
46
|
# constraint violation messaging.
|
@@ -58,17 +58,14 @@ class DefaultLayout < Brut::FrontEnd::Layout
|
|
58
58
|
)
|
59
59
|
)
|
60
60
|
end
|
61
|
-
|
61
|
+
# Adds the page's name as a class name. You can use this for
|
62
|
+
# CSS if needed.
|
63
|
+
body(class: @page_name) do
|
62
64
|
# Render the <brut-tracing> element, which will send
|
63
65
|
# OpenTelemetry traces back to the server to be joined up with
|
64
66
|
# the server's traces.
|
65
67
|
brut_tracing url: "/__brut/instrumentation", show_warnings: true
|
66
|
-
#
|
67
|
-
# allow you to use CSS nested selectors to style this page
|
68
|
-
# only, if that is your CSS strategy.
|
69
|
-
main class: @page_name do
|
70
|
-
yield # Contents of the page are inserted here
|
71
|
-
end
|
68
|
+
yield # Contents of the page are inserted here
|
72
69
|
end
|
73
70
|
end
|
74
71
|
end
|
@@ -9,7 +9,7 @@ class GuestbookMessageHandler < AppHandler
|
|
9
9
|
# If client-side constraint violation checking was skipped,
|
10
10
|
# but there ARE such violations, the form will be able to check
|
11
11
|
# that server-side and return true for #constraint_violations?
|
12
|
-
if
|
12
|
+
if @form.valid?
|
13
13
|
save_message
|
14
14
|
end
|
15
15
|
|
@@ -21,10 +21,10 @@ RSpec.describe "You can leave a guestbook message" do
|
|
21
21
|
this_field = t("cv.this_field")
|
22
22
|
|
23
23
|
expect(name_error_message).to have_text(
|
24
|
-
t("cv.
|
24
|
+
t("cv.cs.valueMissing", field: this_field)
|
25
25
|
)
|
26
26
|
expect(message_error_message).to have_text(
|
27
|
-
t("cv.
|
27
|
+
t("cv.cs.valueMissing", field: this_field)
|
28
28
|
)
|
29
29
|
|
30
30
|
name_field = page.locator("form input[name='name']")
|
@@ -39,7 +39,7 @@ RSpec.describe "You can leave a guestbook message" do
|
|
39
39
|
flash = page.locator("[role='alert']")
|
40
40
|
expect(flash).to have_text(t(:guestbook_not_saved))
|
41
41
|
expect(message_error_message).to have_text(
|
42
|
-
t("cv.
|
42
|
+
t("cv.ss.not_enough_words", field: this_field)
|
43
43
|
)
|
44
44
|
|
45
45
|
message_field.fill("OK, fine, this site is awesome!")
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mkbrut
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dave Copeland
|
@@ -100,14 +100,12 @@ files:
|
|
100
100
|
- templates/Base/app/src/app.rb.erb
|
101
101
|
- templates/Base/app/src/back_end/data_models/app_data_model.rb
|
102
102
|
- templates/Base/app/src/back_end/data_models/db.rb
|
103
|
-
- templates/Base/app/src/back_end/data_models/migrations/
|
103
|
+
- templates/Base/app/src/back_end/data_models/migrations/20240101130000_citext.rb
|
104
104
|
- templates/Base/app/src/back_end/data_models/seed/seed_data.rb
|
105
105
|
- templates/Base/app/src/front_end/components/app_component.rb
|
106
106
|
- templates/Base/app/src/front_end/components/custom_element_registration.rb.erb
|
107
|
-
- templates/Base/app/src/front_end/css/fonts.css
|
108
107
|
- templates/Base/app/src/front_end/css/index.css
|
109
108
|
- templates/Base/app/src/front_end/css/svgs.css
|
110
|
-
- templates/Base/app/src/front_end/fonts/monaspace-xenon.ttf
|
111
109
|
- templates/Base/app/src/front_end/forms/app_form.rb
|
112
110
|
- templates/Base/app/src/front_end/handlers/app_handler.rb
|
113
111
|
- templates/Base/app/src/front_end/images/LogoPylon.png
|
@@ -169,6 +167,8 @@ files:
|
|
169
167
|
- templates/segments/Demo/app/src/back_end/data_models/migrations/20250628194124_guestbook.rb
|
170
168
|
- templates/segments/Demo/app/src/front_end/components/flash_component.rb
|
171
169
|
- templates/segments/Demo/app/src/front_end/css/constraint-violations.css
|
170
|
+
- templates/segments/Demo/app/src/front_end/css/fonts.css
|
171
|
+
- templates/segments/Demo/app/src/front_end/fonts/monaspace-xenon.ttf
|
172
172
|
- templates/segments/Demo/app/src/front_end/forms/guestbook_message_form.rb
|
173
173
|
- templates/segments/Demo/app/src/front_end/handlers/guestbook_message_handler.rb
|
174
174
|
- templates/segments/Demo/app/src/front_end/pages/guestbook_page.rb
|
File without changes
|
File without changes
|
File without changes
|