glib-web 6.9.0 → 6.9.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/app/models/glib/model.rb +40 -0
- data/app/models/glib/plain_model.rb +23 -0
- data/app/views/json_ui/garage/test_page/dialog.json.jbuilder +21 -0
- metadata +4 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 386e85f530042a0ae24b60c0f589c88ed6e1f6fdd0b442f851569b4839dbbe33
|
|
4
|
+
data.tar.gz: 402f200bc3162ced6ea29228cbeaf231cc0a8f0ff3ebf9aba680bd5f7090f66e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a6a4f13247dcc3d90b877f60c4b3299046ec2ec4a4afa410d1301ff0120fee4551b01258926fddbb00c7fe501d5d0ccd8f3490236529c084a7be702eca8cab9f
|
|
7
|
+
data.tar.gz: 35e21c9e35d5b5c15d906f17b2c5f2c7fbf452d38b5fa09839864d9d5f37e35282dca8b237f07d5350f8d5430a8054bccf98145e28968ace7dce8fafdc7c5ab0
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
module Glib
|
|
2
|
+
# Base class for table-less FORM-BACKED domain objects — the ActiveModel
|
|
3
|
+
# counterpart of Glib::ApplicationRecord. Apps inherit through a thin
|
|
4
|
+
# `ApplicationModel < Glib::Model` root (parallel to ApplicationRecord), so
|
|
5
|
+
# app code always reads `< ApplicationModel`.
|
|
6
|
+
#
|
|
7
|
+
# Choosing a base for a class under app/models (the three-way rule; see
|
|
8
|
+
# dev-doc best_practices/backend/en/03_model.md item 9):
|
|
9
|
+
#
|
|
10
|
+
# ApplicationRecord — the class is persisted (it has a table).
|
|
11
|
+
# ApplicationModel — table-less, but it BACKS A FORM/REQUEST: it is built
|
|
12
|
+
# from params (`assign_attributes(create_params)`),
|
|
13
|
+
# validates one user transaction, reports errors back
|
|
14
|
+
# to the dialog, and pairs by name with a controller
|
|
15
|
+
# and policy. (This class.)
|
|
16
|
+
# PlainModel — neither: plain domain logic with no framework
|
|
17
|
+
# machinery — catalogs, derivations, tallies,
|
|
18
|
+
# write-orchestration helpers (see Glib::PlainModel).
|
|
19
|
+
#
|
|
20
|
+
# If you are reaching for a bare `include ActiveModel::Model`, you want
|
|
21
|
+
# ApplicationModel instead — the shared mechanics live here.
|
|
22
|
+
class Model
|
|
23
|
+
include ActiveModel::Model
|
|
24
|
+
|
|
25
|
+
# Declares multi-select id-list attributes: a reader plus a normalizing
|
|
26
|
+
# writer that drops the blank entries browsers submit for empty
|
|
27
|
+
# multi-selects and coerces the surviving ids to integers.
|
|
28
|
+
#
|
|
29
|
+
# attr_id_list :member_ids, :assignee_group_ids
|
|
30
|
+
def self.attr_id_list(*attr_names)
|
|
31
|
+
attr_names.each do |attr_name|
|
|
32
|
+
attr_reader attr_name
|
|
33
|
+
|
|
34
|
+
define_method("#{attr_name}=") do |ids|
|
|
35
|
+
instance_variable_set("@#{attr_name}", Array(ids).map(&:presence).compact.map(&:to_i))
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
module Glib
|
|
2
|
+
# Marker base for PLAIN domain objects: domain logic under app/models that
|
|
3
|
+
# neither persists (no table — not ApplicationRecord) nor backs a form or
|
|
4
|
+
# request (no params/validations/errors — not ApplicationModel). Catalogs,
|
|
5
|
+
# derivations, tallies, write-orchestration helpers. Apps inherit through a
|
|
6
|
+
# thin `PlainModel < Glib::PlainModel` root; the base-choosing guide lives on
|
|
7
|
+
# Glib::Model.
|
|
8
|
+
#
|
|
9
|
+
# Deliberately empty: what plain domain objects share is a CONTRACT, not
|
|
10
|
+
# mechanics —
|
|
11
|
+
# - domain logic only: no external I/O (HTTP clients and provider SDKs
|
|
12
|
+
# belong in app/services adapters);
|
|
13
|
+
# - no enqueues (`perform_later`/`deliver_later` are the calling
|
|
14
|
+
# controller's or job's trigger);
|
|
15
|
+
# - writes, when any, go through the ActiveRecord models whose invariants
|
|
16
|
+
# they are.
|
|
17
|
+
# Inheriting this class is the author's declaration that the contract holds.
|
|
18
|
+
# The moment a subclass wants shared BEHAVIOR from here, that behavior
|
|
19
|
+
# belongs in Glib::Model or a concern instead — this base stays a
|
|
20
|
+
# classification, so that inheriting it keeps meaning exactly one thing.
|
|
21
|
+
class PlainModel
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -89,6 +89,27 @@ page.body(
|
|
|
89
89
|
end
|
|
90
90
|
)
|
|
91
91
|
res.spacer height: 4
|
|
92
|
+
res.button(
|
|
93
|
+
text: 'Dialog alert onClose',
|
|
94
|
+
onClick: ->(action) do
|
|
95
|
+
action.dialogs_alert(
|
|
96
|
+
message: 'Close me',
|
|
97
|
+
onClose: ->(subaction) do
|
|
98
|
+
subaction.dialogs_show(
|
|
99
|
+
content: ->(dialog) do
|
|
100
|
+
dialog.body(
|
|
101
|
+
padding: glib_json_padding_body,
|
|
102
|
+
childViews: ->(sbody) do
|
|
103
|
+
sbody.h1 text: 'onClose fired'
|
|
104
|
+
end
|
|
105
|
+
)
|
|
106
|
+
end
|
|
107
|
+
)
|
|
108
|
+
end
|
|
109
|
+
)
|
|
110
|
+
end
|
|
111
|
+
)
|
|
112
|
+
res.spacer height: 4
|
|
92
113
|
res.button(
|
|
93
114
|
text: 'Dialog notification',
|
|
94
115
|
onClick: ->(action) do
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: glib-web
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 6.9.
|
|
4
|
+
version: 6.9.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- ''
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-08-
|
|
11
|
+
date: 2026-08-29 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activestorage
|
|
@@ -277,6 +277,8 @@ files:
|
|
|
277
277
|
- app/models/glib/country_list.rb
|
|
278
278
|
- app/models/glib/dummy_job_application.rb
|
|
279
279
|
- app/models/glib/dynamic_text_record.rb
|
|
280
|
+
- app/models/glib/model.rb
|
|
281
|
+
- app/models/glib/plain_model.rb
|
|
280
282
|
- app/models/glib/state_list.rb
|
|
281
283
|
- app/models/glib/text.rb
|
|
282
284
|
- app/models/snapshot_blob_reference.rb
|