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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 984d9109d176ad8c71c73dcba0ca912ac355ac5c824916467c458c0c6f8258a9
4
- data.tar.gz: add21e575b83c2c556c03bfe3e23e060d2b0fbfa88ee74f8984fa624f5914400
3
+ metadata.gz: 232eed36ec0bbda9d4e20f06396c788220e39ec645fccb29eafd8af32529f8d9
4
+ data.tar.gz: 87039bccf6f8ffd4a7f37499f1b9a6a5072c45d172a60b9a4f918048851a7282
5
5
  SHA512:
6
- metadata.gz: 3df7e5b66d93762bc76b7c42191db13a79bd6492a789818420789ba3c937131066c90d56490efe774acdede15cab28c805bc572c77cd3a5de7dcdcc4476c8b61
7
- data.tar.gz: 2ecf2985b10b22face53190218b33e1cbbeda2dad1d308050a15eebbd354e5013bfaf877cdc71b4da43d3cb2d1fab1f73c548820bc4087aaf19c14ab30bc34b1
6
+ metadata.gz: 49a861539c7f6c9858b15529e824f066ecd63ea67cf089f4719c4d102dab10d8018182ae15a9454441c49b76e2ef902d9f347d1282b38aba664b3dd381bd83c8
7
+ data.tar.gz: 70d7a71119c9ec72105e84803e7124b1ec7c7105b40bb2bd6975466ff1fb7834f8569867729523dfd64b069a46421951d5370979bfb8c1a0b6e59eb58e821bf6
@@ -28,7 +28,7 @@ private
28
28
  hash: {
29
29
  en: {
30
30
  cv: {
31
- be: {
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",
@@ -1,3 +1,3 @@
1
1
  module MKBrut
2
- VERSION = "0.4.2"
2
+ VERSION = "0.5.0"
3
3
  end
data/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "author": "Irrelevant",
6
6
  "license": "Irrelevant",
7
7
  "devDependencies": {
8
- "brut-css": "^0.0.1",
9
- "brut-js": "^0.0.21"
8
+ "brut-css": "~0.0.1",
9
+ "brut-js": "~0.0.21"
10
10
  }
11
11
  }
@@ -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
- fe: { # short for "front-end", again to not have to type it out
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
- be: { # short for "back-end", again not to have to type it out
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: { # short for "constraint violations" to avoid having to type that out
6
- be: { # short for "back-end", again not to have to type it out
7
- email_taken: "This email has been taken",
5
+ cv: {
6
+ cs: {
8
7
  },
9
- fe: { # short for "front-end", again not to have type it out
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.fe for use with client-side
41
+ # translations starting with cv.cs for use with client-side
42
42
  # constraint violation messaging.
43
- I18nTranslations("cv.fe")
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
- body do
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
- # Create <main> with a class named for the page. This will
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 !@form.constraint_violations?
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.fe.valueMissing", field: this_field)
24
+ t("cv.cs.valueMissing", field: this_field)
25
25
  )
26
26
  expect(message_error_message).to have_text(
27
- t("cv.fe.valueMissing", field: this_field)
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.be.not_enough_words", field: this_field)
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.2
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/00000000000000_citext.rb
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