gourami 2.0.0 → 2.1.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/.vscode/settings.json +5 -0
- data/lib/gourami/extensions/resources.rb +17 -7
- data/lib/gourami/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aa26e60fe628418fe1bf31fc201b9d491b258650306fc2fe08b50787c5425ac2
|
4
|
+
data.tar.gz: fecc00649a3fa7df0f7acf12ae9baa25cdc8f306caa86819ca4acf523260322b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 50a29467ecefc99fe47b77775e8ff833c883be91a26fd276eae0f490e46893744bfda7370e653f9f3052312b980a6a81220571501f98c5184b7a9386d7866b35
|
7
|
+
data.tar.gz: a9c247005a9b661a3d78177eac2a43d39c1438bc43ed63913c3c256308a5d51a7d9a77540ca4c2fbc072c87767fca31eb996394fc0ef182d661220e427a84f20
|
@@ -72,7 +72,7 @@ module Gourami
|
|
72
72
|
# validate_presence(:trim_end_time) # validates `attributes[:social_broadcasts]["facebook_page-41"][:trim_end_time]`
|
73
73
|
# end
|
74
74
|
# end
|
75
|
-
def with_resource(resource_namespace, resource_uid, offset: nil, &_block)
|
75
|
+
def with_resource(resource_namespace, resource_uid = nil, offset: nil, &_block)
|
76
76
|
@resource_namespace = resource_namespace
|
77
77
|
@resource_uid = resource_uid
|
78
78
|
@offset = offset
|
@@ -86,8 +86,10 @@ module Gourami
|
|
86
86
|
# If a resource namespace is active (within with_resource block), find the resource using the namespace and uid.
|
87
87
|
# Otherwise, return the form object.
|
88
88
|
def current_resource
|
89
|
-
if @resource_namespace
|
89
|
+
if @resource_namespace && @resource_uid
|
90
90
|
send(@resource_namespace)[@resource_uid]
|
91
|
+
elsif @resource_namespace
|
92
|
+
send(@resource_namespace)
|
91
93
|
else
|
92
94
|
super
|
93
95
|
end
|
@@ -156,13 +158,21 @@ module Gourami
|
|
156
158
|
end
|
157
159
|
|
158
160
|
# TODO: YARD
|
159
|
-
def resource_has_errors?(resource_namespace, resource_uid)
|
160
|
-
resource_errors[resource_namespace][resource_uid
|
161
|
+
def resource_has_errors?(resource_namespace, resource_uid = nil)
|
162
|
+
resource_errors[resource_namespace][resource_uid&.to_s].values.map(&:flatten).any?
|
161
163
|
end
|
162
164
|
|
163
165
|
# TODO: YARD
|
164
|
-
def resource_attribute_has_errors?(resource_namespace,
|
165
|
-
|
166
|
+
def resource_attribute_has_errors?(resource_namespace, resource_uid_or_attribute_name, attribute_name = nil)
|
167
|
+
if attribute_name.nil?
|
168
|
+
# 2 arguments: resource_namespace, attribute_name
|
169
|
+
attribute_name = resource_uid_or_attribute_name
|
170
|
+
resource_uid = nil
|
171
|
+
else
|
172
|
+
# 3 arguments: resource_namespace, resource_uid, attribute_name
|
173
|
+
resource_uid = resource_uid_or_attribute_name
|
174
|
+
end
|
175
|
+
resource_errors[resource_namespace][resource_uid&.to_s][attribute_name].any?
|
166
176
|
end
|
167
177
|
|
168
178
|
# Append an error to the given attribute for a resource.
|
@@ -174,7 +184,7 @@ module Gourami
|
|
174
184
|
# @param error [Symbol, String]
|
175
185
|
# The error identifier.
|
176
186
|
def append_resource_error(resource_namespace, resource_uid, attribute_name, error)
|
177
|
-
resource_errors[resource_namespace][resource_uid
|
187
|
+
resource_errors[resource_namespace][resource_uid&.to_s][attribute_name] << error
|
178
188
|
end
|
179
189
|
|
180
190
|
# Determine if current form instance is valid by running the validations
|
data/lib/gourami/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gourami
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- TSMMark
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-08-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -91,6 +91,7 @@ files:
|
|
91
91
|
- ".github/workflows/ci.yml"
|
92
92
|
- ".gitignore"
|
93
93
|
- ".ruby-version"
|
94
|
+
- ".vscode/settings.json"
|
94
95
|
- CODE_OF_CONDUCT.md
|
95
96
|
- Gemfile
|
96
97
|
- LICENSE.txt
|