glib-web 4.36.9 → 4.37.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/app/views/json_ui/garage/_nav_menu.json.jbuilder +0 -1
- data/app/views/json_ui/garage/pages/_header.json.jbuilder +11 -0
- data/app/views/json_ui/garage/pages/full_width_height.json.jbuilder +22 -9
- data/app/views/json_ui/garage/pages/layout.json.jbuilder +35 -10
- data/app/views/json_ui/garage/views/_checkbox_expand.json.jbuilder +32 -0
- data/app/views/json_ui/garage/views/_expand_shrink_ex.json.jbuilder +28 -0
- data/app/views/json_ui/garage/views/controls.json.jbuilder +12 -0
- data/lib/glib/rubocop/cops/multiline_method_call_style.rb +181 -0
- data/lib/glib/rubocop.rb +1 -0
- metadata +10 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4e3330ddf2fc14630ca3e1a47cc4500bb6ef0e6dd3cb9617a67d49034ccb3b95
|
4
|
+
data.tar.gz: bc130cbf2e69f387893fd3c84f6d5e431a9fc16e15ea17b7601281264c277727
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b282c99b9141afaaf6662296f859451b9eb021276c294adfd8d402214bb42b91c4cd63da3a0713a4ec6a9c3dc6300c29758016a5e9db79ba4422671ea7da7da
|
7
|
+
data.tar.gz: 6432b2181a9f351ebd83d8adde7052b20f3b7b0a841fd98331532e1551efe475aacaf41cfd93de655badb1477f72251694b052d0c6c08089fbd9dcc17a098d34
|
@@ -0,0 +1,11 @@
|
|
1
|
+
panel.panels_vertical \
|
2
|
+
width: 'matchParent',
|
3
|
+
styleClass: 'card',
|
4
|
+
padding: glib_json_padding_body,
|
5
|
+
backgroundColor: '#b3bac2',
|
6
|
+
childViews: ->(vertical) do
|
7
|
+
vertical.h1 text: 'Header'
|
8
|
+
vertical.spacer height: 10
|
9
|
+
vertical.p text: 'This header uses a column layout to hide the heading on small screens.'
|
10
|
+
vertical.p text: 'On small screens, it will be replaced with a scrollable header.'
|
11
|
+
end
|
@@ -3,14 +3,27 @@ json.title 'Pages'
|
|
3
3
|
page = json_ui_page json
|
4
4
|
render "#{@path_prefix}/nav_menu", json: json, page: page
|
5
5
|
|
6
|
-
page.header
|
7
|
-
|
8
|
-
|
6
|
+
page.header(
|
7
|
+
padding: glib_json_padding_body,
|
8
|
+
backgroundColor: '#b3bac2',
|
9
|
+
childViews: ->(header) do
|
10
|
+
header.h1 text: 'Header'
|
11
|
+
end
|
12
|
+
)
|
9
13
|
|
10
|
-
page.body
|
11
|
-
|
12
|
-
|
14
|
+
page.body(
|
15
|
+
height: 'matchParent',
|
16
|
+
padding: glib_json_padding_body,
|
17
|
+
childViews: ->(body) do
|
18
|
+
body.button width: 'matchParent', height: 'matchParent', text: 'Full Width/Height'
|
19
|
+
end
|
20
|
+
)
|
13
21
|
|
14
|
-
page.footer
|
15
|
-
|
16
|
-
|
22
|
+
page.footer(
|
23
|
+
height: 80,
|
24
|
+
padding: glib_json_padding_body,
|
25
|
+
backgroundColor: '#b3bac2',
|
26
|
+
childViews: ->(footer) do
|
27
|
+
footer.h1 text: 'Footer'
|
28
|
+
end
|
29
|
+
)
|
@@ -3,16 +3,41 @@ json.title 'Pages'
|
|
3
3
|
page = json_ui_page json
|
4
4
|
render "#{@path_prefix}/nav_menu", json: json, page: page
|
5
5
|
|
6
|
-
page.header
|
7
|
-
header
|
8
|
-
|
6
|
+
page.header(
|
7
|
+
childViews: ->(header) do
|
8
|
+
header.panels_column(
|
9
|
+
smAndDown: { hide: true },
|
10
|
+
childViews: ->(column) do
|
11
|
+
render "#{@path_prefix}/pages/header", panel: column, json: json
|
12
|
+
end
|
13
|
+
)
|
14
|
+
end
|
15
|
+
)
|
16
|
+
|
17
|
+
page.footer(
|
18
|
+
padding: glib_json_padding_body,
|
19
|
+
backgroundColor: '#b3bac2',
|
20
|
+
childViews: ->(footer) do
|
21
|
+
footer.h1 text: 'Footer'
|
22
|
+
end
|
23
|
+
)
|
9
24
|
|
10
|
-
page.
|
11
|
-
|
12
|
-
|
25
|
+
page.scroll(
|
26
|
+
childViews: ->(scroll) do
|
27
|
+
scroll.panels_column(
|
28
|
+
md: { hide: true },
|
29
|
+
childViews: ->(column) do
|
30
|
+
render "#{@path_prefix}/pages/header", panel: scroll, json: json
|
31
|
+
end
|
32
|
+
)
|
13
33
|
|
14
|
-
|
15
|
-
|
16
|
-
|
34
|
+
scroll.panels_vertical(
|
35
|
+
padding: glib_json_padding_body,
|
36
|
+
childViews: ->(vertical) do
|
37
|
+
(1..100).each do |index|
|
38
|
+
vertical.label text: 'Content'
|
39
|
+
end
|
40
|
+
end
|
41
|
+
)
|
17
42
|
end
|
18
|
-
|
43
|
+
)
|
@@ -0,0 +1,32 @@
|
|
1
|
+
page = local_assigns[:page] || json_ui_page(json)
|
2
|
+
|
3
|
+
page.body childViews: ->(body) do
|
4
|
+
body.panels_responsive width: 300, styleClass: 'border rounded-lg popovers-menu bg-white pa-4', childViews: ->(res) do
|
5
|
+
res.panels_form method: 'POST', url: json_ui_garage_url(path: 'forms/generic_post_all'), width: 'matchParent', childViews: ->(form) do
|
6
|
+
render 'json_ui/garage/views/expand_shrink_ex',
|
7
|
+
title: 'Choose fruits',
|
8
|
+
id: 'fruit',
|
9
|
+
expand: false,
|
10
|
+
view: form do |view|
|
11
|
+
view.fields_checkGroup name: 'user[fruits][]', styleClass: 'pb-2', childViews: ->(cg) do
|
12
|
+
cg.fields_check label: 'Banana', checkValue: 'banana'
|
13
|
+
cg.fields_check label: 'Grape', checkValue: 'grape'
|
14
|
+
cg.fields_check label: 'Strawberry', checkValue: 'strawberry'
|
15
|
+
end
|
16
|
+
end
|
17
|
+
form.spacer height: 8
|
18
|
+
render 'json_ui/garage/views/expand_shrink_ex',
|
19
|
+
title: 'Choose drinks',
|
20
|
+
id: 'drink',
|
21
|
+
expand: true,
|
22
|
+
view: form do |view|
|
23
|
+
view.fields_checkGroup name: 'user[drinks][]', styleClass: 'pb-2', childViews: ->(cg) do
|
24
|
+
cg.fields_check label: 'Coffee', checkValue: 'coffee'
|
25
|
+
cg.fields_check label: 'Water', checkValue: 'water'
|
26
|
+
cg.fields_check label: 'Milk', checkValue: 'milk'
|
27
|
+
end
|
28
|
+
end
|
29
|
+
form.fields_submit text: 'submit'
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
expand = local_assigns[:expand] || false
|
2
|
+
|
3
|
+
view.panels_responsive width: 'matchParent', childViews: ->(res) do
|
4
|
+
# shrink
|
5
|
+
res.panels_flow id: "#{id}-shrink", displayed: !expand, width: 'matchParent', styleClass: 'items-center justify-between flex-nowrap', childViews: ->(flow) do
|
6
|
+
flow.label text: title
|
7
|
+
flow.icon name: 'arrow_drop_down', size: 20, onClick: ->(action) do
|
8
|
+
action.runMultiple childActions: ->(saction) do
|
9
|
+
saction.components_set targetId: "#{id}-expand", data: { displayed: true }
|
10
|
+
saction.components_set targetId: "#{id}-shrink", data: { displayed: false }
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
# expand
|
16
|
+
res.panels_responsive id: "#{id}-expand", displayed: expand, width: 'matchParent', childViews: ->(sres) do
|
17
|
+
sres.panels_flow width: 'matchParent', styleClass: 'items-center justify-between flex-nowrap', childViews: ->(flow) do
|
18
|
+
flow.label text: title
|
19
|
+
flow.icon name: 'arrow_drop_up', size: 20, onClick: ->(action) do
|
20
|
+
action.runMultiple childActions: ->(saction) do
|
21
|
+
saction.components_set targetId: "#{id}-shrink", data: { displayed: true }
|
22
|
+
saction.components_set targetId: "#{id}-expand", data: { displayed: false }
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
yield(sres)
|
27
|
+
end
|
28
|
+
end
|
@@ -129,6 +129,18 @@ page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
|
|
129
129
|
action.dialogs_alert message: 'Perform action'
|
130
130
|
end
|
131
131
|
|
132
|
+
scroll.spacer height: 20
|
133
|
+
scroll.button text: 'popovers/show checkboxes', onClick: ->(action) do
|
134
|
+
action.popovers_show content: ->(pg) do
|
135
|
+
render 'json_ui/garage/views/checkbox_expand', page: pg
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
scroll.spacer height: 20
|
140
|
+
scroll.button text: 'popovers/open checkboxes', onClick: ->(action) do
|
141
|
+
action.popovers_open url: json_ui_garage_url(path: 'views/_checkbox_expand')
|
142
|
+
end
|
143
|
+
|
132
144
|
scroll.spacer height: 20
|
133
145
|
scroll.button \
|
134
146
|
icon: 'info',
|
@@ -0,0 +1,181 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RuboCop
|
4
|
+
module Cop
|
5
|
+
module Glib
|
6
|
+
# Enforces parentheses style for multi-line method calls with arguments.
|
7
|
+
#
|
8
|
+
# @example
|
9
|
+
# # bad
|
10
|
+
# page.footer padding: glib_json_padding_body, backgroundColor: '#b3bac2', childViews: ->(footer) do
|
11
|
+
# footer.h1 text: 'Footer'
|
12
|
+
# end
|
13
|
+
#
|
14
|
+
# # bad
|
15
|
+
# page.footer \
|
16
|
+
# padding: glib_json_padding_body,
|
17
|
+
# backgroundColor: '#b3bac2',
|
18
|
+
# childViews: ->(footer) do
|
19
|
+
# footer.h1 text: 'Footer'
|
20
|
+
# end
|
21
|
+
#
|
22
|
+
# # good
|
23
|
+
# page.footer(
|
24
|
+
# padding: glib_json_padding_body,
|
25
|
+
# backgroundColor: '#b3bac2',
|
26
|
+
# childViews: ->(footer) do
|
27
|
+
# footer.h1 text: 'Footer'
|
28
|
+
# end
|
29
|
+
# )
|
30
|
+
class MultilineMethodCallStyle < Base
|
31
|
+
extend AutoCorrector
|
32
|
+
|
33
|
+
MSG = 'Use parentheses style for multi-line method calls: ' \
|
34
|
+
'wrap arguments in parentheses and place each argument on its own line.'
|
35
|
+
|
36
|
+
def on_send(node)
|
37
|
+
return unless multi_line_call_with_args?(node)
|
38
|
+
return if proper_parentheses_style?(node)
|
39
|
+
return if proper_backslash_style?(node) && allow_backslash?
|
40
|
+
|
41
|
+
add_offense(node) do |corrector|
|
42
|
+
autocorrect(corrector, node)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
alias on_csend on_send
|
47
|
+
|
48
|
+
private
|
49
|
+
|
50
|
+
def multi_line_call_with_args?(node)
|
51
|
+
node.multiline? && node.arguments.any?
|
52
|
+
end
|
53
|
+
|
54
|
+
def allow_backslash?
|
55
|
+
# Allow backslash style without warnings when configured
|
56
|
+
# Set to true to allow both styles (but auto-correct will still convert to parentheses)
|
57
|
+
# Set to false to enforce parentheses style always
|
58
|
+
cop_config.fetch('AllowBackslashStyle', true)
|
59
|
+
end
|
60
|
+
|
61
|
+
def proper_backslash_style?(node)
|
62
|
+
source = processed_source.buffer.source
|
63
|
+
method_end_pos = node.loc.selector.end_pos
|
64
|
+
|
65
|
+
# Check if there's a backslash right after the method name
|
66
|
+
next_char_pos = method_end_pos
|
67
|
+
while next_char_pos < source.length && source[next_char_pos] == ' '
|
68
|
+
next_char_pos += 1
|
69
|
+
end
|
70
|
+
|
71
|
+
return false unless source[next_char_pos] == '\\'
|
72
|
+
|
73
|
+
# Check that each argument is on its own line
|
74
|
+
args = collect_arguments(node)
|
75
|
+
return false if args.empty?
|
76
|
+
|
77
|
+
args.each_cons(2) do |arg1, arg2|
|
78
|
+
return false if arg1.loc.line == arg2.loc.line
|
79
|
+
end
|
80
|
+
|
81
|
+
true
|
82
|
+
end
|
83
|
+
|
84
|
+
def proper_parentheses_style?(node)
|
85
|
+
return false unless node.parenthesized?
|
86
|
+
|
87
|
+
# Check that first argument is on a new line after opening paren
|
88
|
+
first_arg = node.first_argument
|
89
|
+
return false if first_arg.loc.line == node.loc.selector.line
|
90
|
+
|
91
|
+
# Check that each argument is on its own line
|
92
|
+
args = collect_arguments(node)
|
93
|
+
return false if args.empty?
|
94
|
+
|
95
|
+
args.each_cons(2) do |arg1, arg2|
|
96
|
+
return false if arg1.loc.line == arg2.loc.line
|
97
|
+
end
|
98
|
+
|
99
|
+
# Check that closing paren is on its own line
|
100
|
+
source = processed_source.buffer.source
|
101
|
+
close_paren_pos = node.loc.end.begin_pos
|
102
|
+
line_start = source.rindex("\n", close_paren_pos) || 0
|
103
|
+
line_content = source[line_start...close_paren_pos].strip
|
104
|
+
|
105
|
+
return false unless line_content.empty?
|
106
|
+
|
107
|
+
true
|
108
|
+
end
|
109
|
+
|
110
|
+
def collect_arguments(node)
|
111
|
+
args = []
|
112
|
+
|
113
|
+
node.arguments.each do |arg|
|
114
|
+
if arg.hash_type?
|
115
|
+
# For hash arguments, treat each pair as a separate argument
|
116
|
+
arg.pairs.each { |pair| args << pair }
|
117
|
+
else
|
118
|
+
args << arg
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
args
|
123
|
+
end
|
124
|
+
|
125
|
+
def autocorrect(corrector, node)
|
126
|
+
method_end_pos = node.loc.selector.end_pos
|
127
|
+
|
128
|
+
# Find the indentation of the method call
|
129
|
+
line_begin_pos = processed_source.buffer.line_range(node.loc.line).begin_pos
|
130
|
+
base_indent = node.source_range.begin_pos - line_begin_pos
|
131
|
+
arg_indent = ' ' * (base_indent + 2)
|
132
|
+
|
133
|
+
# Build the new argument list
|
134
|
+
arg_parts = []
|
135
|
+
node.arguments.each do |arg|
|
136
|
+
next if arg.block_pass_type? # Skip block arguments like &block
|
137
|
+
|
138
|
+
if arg.hash_type?
|
139
|
+
arg.pairs.each do |pair|
|
140
|
+
arg_parts << pair.source
|
141
|
+
end
|
142
|
+
else
|
143
|
+
arg_parts << arg.source
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
# Build the replacement with parentheses style
|
148
|
+
if arg_parts.any?
|
149
|
+
# Opening paren on same line as method, arguments on separate lines
|
150
|
+
replacement = "(\n#{arg_indent}" + arg_parts.join(",\n#{arg_indent}")
|
151
|
+
|
152
|
+
# If there's a block, add it on the last argument line
|
153
|
+
if node.block_literal?
|
154
|
+
block_source = node.block_literal.source
|
155
|
+
replacement += " #{block_source}"
|
156
|
+
end
|
157
|
+
|
158
|
+
# Closing paren on its own line at base indentation
|
159
|
+
replacement += "\n#{' ' * base_indent})"
|
160
|
+
else
|
161
|
+
# No arguments, just the block (shouldn't happen for multi-line, but handle it)
|
162
|
+
replacement = if node.block_literal?
|
163
|
+
" #{node.block_literal.source}"
|
164
|
+
else
|
165
|
+
'()'
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
# Remove everything from method name to end of node
|
170
|
+
range = Parser::Source::Range.new(
|
171
|
+
processed_source.buffer,
|
172
|
+
method_end_pos,
|
173
|
+
node.source_range.end_pos
|
174
|
+
)
|
175
|
+
|
176
|
+
corrector.replace(range, replacement)
|
177
|
+
end
|
178
|
+
end
|
179
|
+
end
|
180
|
+
end
|
181
|
+
end
|
data/lib/glib/rubocop.rb
CHANGED
metadata
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glib-web
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.37.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ''
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
date: 2019-10-04 00:00:00.000000000 Z
|
@@ -136,7 +136,7 @@ dependencies:
|
|
136
136
|
- - ">="
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
|
-
description:
|
139
|
+
description:
|
140
140
|
email: ''
|
141
141
|
executables: []
|
142
142
|
extensions: []
|
@@ -321,6 +321,7 @@ files:
|
|
321
321
|
- app/views/json_ui/garage/notifications/android_post.json.jbuilder
|
322
322
|
- app/views/json_ui/garage/notifications/index.json.jbuilder
|
323
323
|
- app/views/json_ui/garage/notifications/web_socket.json.jbuilder
|
324
|
+
- app/views/json_ui/garage/pages/_header.json.jbuilder
|
324
325
|
- app/views/json_ui/garage/pages/custom_style_class.json.jbuilder
|
325
326
|
- app/views/json_ui/garage/pages/full_width.json.jbuilder
|
326
327
|
- app/views/json_ui/garage/pages/full_width_height.json.jbuilder
|
@@ -378,6 +379,8 @@ files:
|
|
378
379
|
- app/views/json_ui/garage/test_page/selectable.json.jbuilder
|
379
380
|
- app/views/json_ui/garage/test_page/window.json.jbuilder
|
380
381
|
- app/views/json_ui/garage/views/_chart_data.json.jbuilder
|
382
|
+
- app/views/json_ui/garage/views/_checkbox_expand.json.jbuilder
|
383
|
+
- app/views/json_ui/garage/views/_expand_shrink_ex.json.jbuilder
|
381
384
|
- app/views/json_ui/garage/views/banners.json.jbuilder
|
382
385
|
- app/views/json_ui/garage/views/calendar_data.json.jbuilder
|
383
386
|
- app/views/json_ui/garage/views/charts.json.jbuilder
|
@@ -439,6 +442,7 @@ files:
|
|
439
442
|
- lib/glib/mailer_tester.rb
|
440
443
|
- lib/glib/rubocop.rb
|
441
444
|
- lib/glib/rubocop/cops/localize.rb
|
445
|
+
- lib/glib/rubocop/cops/multiline_method_call_style.rb
|
442
446
|
- lib/glib/snapshot.rb
|
443
447
|
- lib/glib/test_helpers.rb
|
444
448
|
- lib/glib/time_freezable_mailer.rb
|
@@ -446,10 +450,10 @@ files:
|
|
446
450
|
- lib/glib/value.rb
|
447
451
|
- lib/glib/version.rb
|
448
452
|
- lib/tasks/db.rake
|
449
|
-
homepage:
|
453
|
+
homepage:
|
450
454
|
licenses: []
|
451
455
|
metadata: {}
|
452
|
-
post_install_message:
|
456
|
+
post_install_message:
|
453
457
|
rdoc_options: []
|
454
458
|
require_paths:
|
455
459
|
- lib
|
@@ -465,7 +469,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
465
469
|
version: '0'
|
466
470
|
requirements: []
|
467
471
|
rubygems_version: 3.4.6
|
468
|
-
signing_key:
|
472
|
+
signing_key:
|
469
473
|
specification_version: 4
|
470
474
|
summary: ''
|
471
475
|
test_files: []
|