glib-web 4.33.2 → 4.34.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/controllers/concerns/glib/json/libs.rb +2 -2
- data/app/models/concerns/glib/soft_deletable.rb +1 -1
- data/app/views/json_ui/garage/forms/selects.json.jbuilder +17 -3
- data/lib/glib/rubocop/cops/localize.rb +26 -0
- data/lib/glib/rubocop.rb +1 -0
- data/lib/glib/snapshot.rb +22 -1
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a897a2657114bf12b52da917ad8857e4b7e1070bc99eefe7e4cc49c519508bdb
|
4
|
+
data.tar.gz: 2bf662a93d9a308f5eec89dc7d3562b4ddc7462886f0ec0a239bd64dd81c75d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c8a8915e195ed0e6e5f9e39789fdb886887cdb264e7fbc873f3833906be02b44308ca9a7488a9ad30170720ab0e9761ef46dbdf7e230edaac81f3da764c5fe63
|
7
|
+
data.tar.gz: 4e8d8a377ccf28259fcde1ce4d265cddf4d67096a391e96aabecd48a77742d1ace91775b322614879a355fb1b2d0728144461eb3ff4677983a4013d4bd20bf76
|
@@ -313,7 +313,7 @@ module Glib::Json::Libs
|
|
313
313
|
end
|
314
314
|
end
|
315
315
|
|
316
|
-
def json_libs_rescue_csrf
|
316
|
+
def json_libs_rescue_csrf(sign_in_url_proc)
|
317
317
|
rescue_from ActionController::InvalidAuthenticityToken do |exception|
|
318
318
|
# sign_out(:user)
|
319
319
|
|
@@ -330,7 +330,7 @@ module Glib::Json::Libs
|
|
330
330
|
|
331
331
|
respond_to do |format|
|
332
332
|
format.html do
|
333
|
-
redirect_to
|
333
|
+
redirect_to instance_exec(&sign_in_url_proc)
|
334
334
|
end
|
335
335
|
format.json do
|
336
336
|
render json: {
|
@@ -116,7 +116,7 @@ module Glib
|
|
116
116
|
|
117
117
|
# Use `send()` instead of `association(relationship).scope` because the latter returns new record objects as opposed
|
118
118
|
# to existing objects which could cause a side effect.
|
119
|
-
relation =
|
119
|
+
relation = public_send(relationship)
|
120
120
|
|
121
121
|
# Use `each` instead of `find_each` because `each` is cached which is important to retain the
|
122
122
|
# `marked_for_destruction` status.
|
@@ -4,7 +4,7 @@ page = json_ui_page json
|
|
4
4
|
|
5
5
|
render "#{@path_prefix}/nav_menu", json: json, page: page
|
6
6
|
|
7
|
-
page.form url: json_ui_garage_url(path: 'forms/generic_post'), method: 'post', padding: glib_json_padding_body, childViews: ->(form) do
|
7
|
+
page.form id: 'form', url: json_ui_garage_url(path: 'forms/generic_post'), method: 'post', padding: glib_json_padding_body, childViews: ->(form) do
|
8
8
|
|
9
9
|
form.spacer height: 20
|
10
10
|
form.h2 text: 'Basic select fields'
|
@@ -62,7 +62,7 @@ page.form url: json_ui_garage_url(path: 'forms/generic_post'), method: 'post', p
|
|
62
62
|
options: options,
|
63
63
|
value: ['melbourne', 'sydney'],
|
64
64
|
multiple: true,
|
65
|
-
|
65
|
+
onChange: ->(action) do
|
66
66
|
action.dialogs_alert message: 'Options selected'
|
67
67
|
end
|
68
68
|
|
@@ -141,11 +141,25 @@ page.form url: json_ui_garage_url(path: 'forms/generic_post'), method: 'post', p
|
|
141
141
|
end
|
142
142
|
|
143
143
|
form.fields_select \
|
144
|
+
id: 'lang',
|
144
145
|
name: 'user[languages][]',
|
145
146
|
width: 'matchParent',
|
146
147
|
label: 'Primary Language',
|
147
148
|
options: options,
|
148
149
|
value: ['ja', 'de'],
|
150
|
+
accessory: ->(view) do
|
151
|
+
view.footer padding: { x: 16, y: 10 }, width: 'matchParent', styleClass: 'sticky-footer', childViews: ->(footer) do
|
152
|
+
footer.panels_flow width: 'matchParent', styleClass: 'justify-end', childViews: ->(hori) do
|
153
|
+
hori.label text: 'Reset', styleClass: 'text-primary', onClick: ->(action) do
|
154
|
+
action.components_set targetId: 'lang', data: { value: [] }
|
155
|
+
end
|
156
|
+
hori.spacer width: 16
|
157
|
+
hori.label text: 'Apply', styleClass: 'text-primary', onClick: ->(action) do
|
158
|
+
action.forms_submit targetId: 'form'
|
159
|
+
end
|
160
|
+
end
|
161
|
+
end
|
162
|
+
end,
|
149
163
|
multiple: true
|
150
164
|
|
151
165
|
form.spacer height: 6
|
@@ -196,7 +210,7 @@ page.form url: json_ui_garage_url(path: 'forms/generic_post'), method: 'post', p
|
|
196
210
|
label: 'Time Zone',
|
197
211
|
clearable: true,
|
198
212
|
value: 'America/Chicago'
|
199
|
-
|
213
|
+
# value: 'Australia/Melbourne'
|
200
214
|
|
201
215
|
|
202
216
|
form.button text: 'Submit', onClick: ->(action) { action.forms_submit }
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RuboCop
|
4
|
+
module Cop
|
5
|
+
module Glib
|
6
|
+
class Localize < Base
|
7
|
+
RESTRICT_ON_SEND = %i[h1 h2 h3 h4 h5 p label markdown
|
8
|
+
fields_text fields_number fields_select fields_password
|
9
|
+
fields_textarea fields_check fields_checkGroup fields_chipGroup
|
10
|
+
fields_timeZone fields_radioGroup fields_date fields_datetime].freeze
|
11
|
+
|
12
|
+
def_node_matcher :watched_key?, <<~PATTERN
|
13
|
+
(send _ _ (hash <(pair (sym {:title | :subtitle | :subsubtitle | :label | :placeholder | :text}) $...) ...>))
|
14
|
+
PATTERN
|
15
|
+
|
16
|
+
def on_send(node)
|
17
|
+
watched_key?(node) do |snode|
|
18
|
+
add_offense(snode.first, message: 'Unlocalized string') if snode.first.str_type? || snode.first.dstr_type?
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
alias on_csend on_send
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/lib/glib/rubocop.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require_relative 'rubocop/cops/localize'
|
data/lib/glib/snapshot.rb
CHANGED
@@ -13,10 +13,31 @@ module Glib
|
|
13
13
|
|
14
14
|
before_save do
|
15
15
|
self.attributes_before_save = attributes_in_database
|
16
|
-
self.snapshot_changed =
|
16
|
+
self.snapshot_changed = check_snapshot_changed
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
|
+
def check_snapshot_changed
|
21
|
+
return true if changed?
|
22
|
+
|
23
|
+
associations_for_snapshot.each do |association_name|
|
24
|
+
if (association = self.class.reflect_on_association(association_name))
|
25
|
+
case association.macro
|
26
|
+
when :has_many
|
27
|
+
public_send(association_name).each do |record|
|
28
|
+
return true if record.changed?
|
29
|
+
end
|
30
|
+
when :has_one, :belongs_to
|
31
|
+
return true if public_send(association_name).changed?
|
32
|
+
end
|
33
|
+
else
|
34
|
+
raise "Invalid association: #{association_name}"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
false
|
39
|
+
end
|
40
|
+
|
20
41
|
def where_snapshots(user: nil, field: nil, action: nil, association: nil, association_action: nil, like: nil)
|
21
42
|
query = snapshots
|
22
43
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glib-web
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.34.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ''
|
@@ -417,6 +417,8 @@ files:
|
|
417
417
|
- lib/glib/json_crawler/http.rb
|
418
418
|
- lib/glib/json_crawler/router.rb
|
419
419
|
- lib/glib/mailer_tester.rb
|
420
|
+
- lib/glib/rubocop.rb
|
421
|
+
- lib/glib/rubocop/cops/localize.rb
|
420
422
|
- lib/glib/snapshot.rb
|
421
423
|
- lib/glib/test_helpers.rb
|
422
424
|
- lib/glib/time_freezable_mailer.rb
|