mkbrut 0.4.1 → 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: 626bfeea30265e33ca6d62375a71de613a3c6dfd8686b74daf8e756330a227b9
4
- data.tar.gz: 9cda4b60fb19f5d2dcccc21480ec954d970d5b6aa3402b4fdddf1aea658087f1
3
+ metadata.gz: 232eed36ec0bbda9d4e20f06396c788220e39ec645fccb29eafd8af32529f8d9
4
+ data.tar.gz: 87039bccf6f8ffd4a7f37499f1b9a6a5072c45d172a60b9a4f918048851a7282
5
5
  SHA512:
6
- metadata.gz: 0c62569fa6441862162d60531e0458be4b6459654e6a4d6fe0942a3ffd56c6ca2f5062344e8ebc9f23f4fe72ee3e192e862a8652a1becb54d240de1b0f6d30f5
7
- data.tar.gz: 87921b58cc901bca9c72315de269f0ed69f8056db6cfa37f54c4e38dfcbbdc6553b72e021e826077f17eafb9f78c111ed9ad698cf87d18b191727a906a7240ef
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.1"
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
@@ -0,0 +1,6 @@
1
+ Sequel.migration do
2
+ up do
3
+ run %{CREATE EXTENSION IF NOT EXISTS citext}
4
+ end
5
+ end
6
+
@@ -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
@@ -1,6 +1,5 @@
1
1
  Sequel.migration do
2
2
  up do
3
- run %{CREATE EXTENSION IF NOT EXISTS citext}
4
3
  create_table :guestbook_messages,
5
4
  comment: "Messages people have left in the guestbook",
6
5
  external_id: true do
@@ -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.1
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dave Copeland
@@ -100,13 +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/20240101130000_citext.rb
103
104
  - templates/Base/app/src/back_end/data_models/seed/seed_data.rb
104
105
  - templates/Base/app/src/front_end/components/app_component.rb
105
106
  - templates/Base/app/src/front_end/components/custom_element_registration.rb.erb
106
- - templates/Base/app/src/front_end/css/fonts.css
107
107
  - templates/Base/app/src/front_end/css/index.css
108
108
  - templates/Base/app/src/front_end/css/svgs.css
109
- - templates/Base/app/src/front_end/fonts/monaspace-xenon.ttf
110
109
  - templates/Base/app/src/front_end/forms/app_form.rb
111
110
  - templates/Base/app/src/front_end/handlers/app_handler.rb
112
111
  - templates/Base/app/src/front_end/images/LogoPylon.png
@@ -168,6 +167,8 @@ files:
168
167
  - templates/segments/Demo/app/src/back_end/data_models/migrations/20250628194124_guestbook.rb
169
168
  - templates/segments/Demo/app/src/front_end/components/flash_component.rb
170
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
171
172
  - templates/segments/Demo/app/src/front_end/forms/guestbook_message_form.rb
172
173
  - templates/segments/Demo/app/src/front_end/handlers/guestbook_message_handler.rb
173
174
  - templates/segments/Demo/app/src/front_end/pages/guestbook_page.rb
@@ -175,7 +176,7 @@ files:
175
176
  - templates/segments/Demo/app/src/front_end/pages/new_guestbook_message_page.rb
176
177
  - templates/segments/Demo/specs/back_end/data_models/db/guestbook_message.spec.rb
177
178
  - templates/segments/Demo/specs/e2e/guest_message.spec.rb
178
- - templates/segments/Demo/specs/factories/db/guestbook_message.rb
179
+ - templates/segments/Demo/specs/factories/db/guestbook_message.factory.rb
179
180
  - templates/segments/Demo/specs/front_end/components/flash_component.spec.rb
180
181
  - templates/segments/Demo/specs/front_end/handlers/guestbook_message_handler.spec.rb
181
182
  - templates/segments/Demo/specs/front_end/pages/guestbook_page.spec.rb