glib-web 0.5.15 → 0.5.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/helpers/glib/json_ui/view_builder/panels.rb +13 -0
- data/app/views/json_ui/garage/lists/{_infinite_scroll_section.json.jbuilder → _autoload_section.json.jbuilder} +4 -2
- data/app/views/json_ui/garage/lists/autoload_all.json.jbuilder +32 -0
- data/app/views/json_ui/garage/lists/{infinite_scroll.json.jbuilder → autoload_as_needed.json.jbuilder} +9 -12
- data/app/views/json_ui/garage/lists/fab.json.jbuilder +6 -8
- data/app/views/json_ui/garage/lists/index.json.jbuilder +6 -3
- data/app/views/json_ui/garage/tables/autoload_all.json.jbuilder +13 -10
- data/lib/generators/templates/20191024063257_add_scope_to_texts.rb +1 -1
- data/lib/generators/templates/20191126071051_create_active_storage_tables.active_storage.rb +1 -1
- data/lib/generators/templates/dynamic_text.rb +1 -1
- data/lib/glib-web.rb +5 -5
- data/lib/glib/engine.rb +1 -1
- data/lib/glib/json_crawler/action_crawlers/forms_submit.rb +4 -4
- data/lib/glib/json_crawler/http.rb +1 -1
- data/lib/glib/test_helpers.rb +3 -3
- data/lib/glib/value.rb +1 -1
- data/lib/glib/version.rb +2 -2
- data/lib/tasks/db.rake +11 -11
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f06e6697837bddfa0e71b0263a7dcc23452aff19
|
4
|
+
data.tar.gz: 57677ef8d290617ca0a3bc935450b9c729113623
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4bcfd89c5fbc018bb165b5a9c631435117415320c1465ae49a13975e7da3dfccc58f4a182ec9bd90fae1a7f42fd3426842e1a16b3db1e8bdf6b5bd8052e42ffb
|
7
|
+
data.tar.gz: 89d40c161a93ce26a558029697553801d0e5cae50f0c0bc4f7ab7aec619f917e2487478ff741654f326a4d21e2452d61b2c73000bb054d2571aa12d09e98f451
|
@@ -164,6 +164,19 @@ class Glib::JsonUi::ViewBuilder
|
|
164
164
|
hash :md
|
165
165
|
hash :sm
|
166
166
|
hash :xs
|
167
|
+
|
168
|
+
hash :xlOnly
|
169
|
+
hash :lgOnly
|
170
|
+
hash :mdOnly
|
171
|
+
hash :smOnly
|
172
|
+
hash :xsOnly
|
173
|
+
|
174
|
+
hash :xlAndDown
|
175
|
+
hash :lgAndDown
|
176
|
+
hash :mdAndDown
|
177
|
+
hash :smAndDown
|
178
|
+
hash :xsAndDown
|
179
|
+
|
167
180
|
views :childViews
|
168
181
|
end
|
169
182
|
|
@@ -10,11 +10,13 @@
|
|
10
10
|
# end
|
11
11
|
# end
|
12
12
|
|
13
|
-
section = json_ui_section json
|
13
|
+
# section = json_ui_section json
|
14
|
+
|
15
|
+
section = page.list_section_builder
|
14
16
|
section.rows builder: ->(row) do
|
15
17
|
batch_count = 30
|
16
18
|
batch_count.times do |i|
|
17
|
-
index =
|
19
|
+
index = page_index * batch_count + i
|
18
20
|
row.thumbnail title: "Item #{index}"
|
19
21
|
end
|
20
22
|
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
|
2
|
+
page_index = params[:page].to_i
|
3
|
+
next_page = {
|
4
|
+
url: json_ui_garage_url(path: 'lists/autoload_all', page: page_index + 1, section_only: 'v1'),
|
5
|
+
autoload: 'all'
|
6
|
+
}
|
7
|
+
|
8
|
+
page = json_ui_page json
|
9
|
+
|
10
|
+
if params[:section_only].present?
|
11
|
+
sleep 1
|
12
|
+
|
13
|
+
json.nextPage next_page if page_index < 3
|
14
|
+
json.sections do
|
15
|
+
json.child! do
|
16
|
+
render 'json_ui/garage/lists/autoload_section', page: page, page_index: page_index
|
17
|
+
end
|
18
|
+
end
|
19
|
+
else
|
20
|
+
json.title 'Lists'
|
21
|
+
|
22
|
+
render "#{@path_prefix}/nav_menu", json: json, page: page
|
23
|
+
|
24
|
+
page.list nextPage: next_page, firstSection: ->(section) do
|
25
|
+
render 'json_ui/garage/lists/autoload_section', page: page, page_index: page_index
|
26
|
+
end, onScrollToBottom: ->(action) do
|
27
|
+
action.snackbars_alert message: 'Scrolled to Bottom'
|
28
|
+
end, onScrollToTop: ->(action) do
|
29
|
+
action.snackbars_alert message: 'Scrolled to Top'
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
@@ -1,34 +1,31 @@
|
|
1
1
|
|
2
2
|
page_index = params[:page].to_i
|
3
3
|
next_page = {
|
4
|
-
url: json_ui_garage_url(path: 'lists/
|
5
|
-
|
6
|
-
autoLoad: true
|
4
|
+
url: json_ui_garage_url(path: 'lists/autoload_as_needed', page: page_index + 1, section_only: 'v1'),
|
5
|
+
autoload: 'asNeeded'
|
7
6
|
}
|
8
7
|
|
8
|
+
page = json_ui_page json
|
9
|
+
|
9
10
|
# TODO: Cater
|
10
11
|
# - for SEO: one URL for a standalone page and one URL for pagination only
|
11
12
|
# - for generic approach, e.g. excluding nav_menu when there is no change
|
12
13
|
if params[:section_only].present?
|
13
|
-
|
14
|
+
sleep 1
|
15
|
+
|
16
|
+
json.nextPage next_page if page_index < 3
|
14
17
|
json.sections do
|
15
18
|
json.child! do
|
16
|
-
render 'json_ui/garage/lists/
|
19
|
+
render 'json_ui/garage/lists/autoload_section', page: page, page_index: page_index
|
17
20
|
end
|
18
21
|
end
|
19
22
|
else
|
20
23
|
json.title 'Lists'
|
21
24
|
|
22
|
-
# options = { nextPage: nextPage }
|
23
|
-
# json_body_with_list json, nil, nil, options do
|
24
|
-
# render 'json_ui/garage/lists/infinite_scroll_section', json: json, page: page
|
25
|
-
# end
|
26
|
-
|
27
|
-
page = json_ui_page json
|
28
25
|
render "#{@path_prefix}/nav_menu", json: json, page: page
|
29
26
|
|
30
27
|
page.list nextPage: next_page, firstSection: ->(section) do
|
31
|
-
render 'json_ui/garage/lists/
|
28
|
+
render 'json_ui/garage/lists/autoload_section', page: page, page_index: page_index
|
32
29
|
end, onScrollToBottom: ->(action) do
|
33
30
|
action.snackbars_alert message: 'Scrolled to Bottom'
|
34
31
|
end, onScrollToTop: ->(action) do
|
@@ -1,14 +1,12 @@
|
|
1
1
|
json.title 'Lists'
|
2
2
|
|
3
|
-
json_ui_page json
|
4
|
-
|
3
|
+
page = json_ui_page json
|
4
|
+
render "#{@path_prefix}/nav_menu", json: json, page: page
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
body.fab icon: 'add', onClick: ->(action) { action.dialogs_alert message: 'Perform action' }
|
6
|
+
page.body childViews: ->(body) do
|
7
|
+
body.fab icon: 'add', onClick: ->(action) { action.dialogs_alert message: 'Perform action' }
|
9
8
|
|
10
|
-
|
11
|
-
|
12
|
-
end
|
9
|
+
body.panels_list width: 'matchParent', firstSection: ->(section) do
|
10
|
+
render 'json_ui/garage/lists/autoload_section', page: page, page_index: 0
|
13
11
|
end
|
14
12
|
end
|
@@ -11,15 +11,18 @@ json_ui_page json do |page|
|
|
11
11
|
template.thumbnail title: 'Edit Actions', onClick: ->(action) do
|
12
12
|
action.windows_open url: json_ui_garage_url(path: 'lists/edit_actions')
|
13
13
|
end
|
14
|
-
template.thumbnail title: 'Infinite Scroll', onClick: ->(action) do
|
15
|
-
action.windows_open url: json_ui_garage_url(path: 'lists/infinite_scroll')
|
16
|
-
end
|
17
14
|
template.thumbnail title: 'FAB (Floating Action Button)', onClick: ->(action) do
|
18
15
|
action.windows_open url: json_ui_garage_url(path: 'lists/fab')
|
19
16
|
end
|
20
17
|
template.thumbnail title: 'Chat Prototype', onClick: ->(action) do
|
21
18
|
action.windows_open url: json_ui_garage_url(path: 'lists/chat')
|
22
19
|
end
|
20
|
+
template.thumbnail title: 'Autoload as Needed', onClick: ->(action) do
|
21
|
+
action.windows_open url: json_ui_garage_url(path: 'lists/autoload_as_needed')
|
22
|
+
end
|
23
|
+
template.thumbnail title: 'Autoload All', onClick: ->(action) do
|
24
|
+
action.windows_open url: json_ui_garage_url(path: 'lists/autoload_all')
|
25
|
+
end
|
23
26
|
end
|
24
27
|
|
25
28
|
end
|
@@ -21,18 +21,21 @@ if params[:section_only].present?
|
|
21
21
|
else
|
22
22
|
json.title 'Tables'
|
23
23
|
|
24
|
-
json_ui_page json
|
25
|
-
|
26
|
-
|
27
|
-
page.table nextPage: next_page, firstSection: ->(section) do
|
28
|
-
section.header cellViews: ->(header) do
|
29
|
-
column_indexes.each do |i|
|
30
|
-
header.label text: "Heading#{i}"
|
31
|
-
end
|
32
|
-
end
|
24
|
+
page = json_ui_page json
|
25
|
+
render "#{@path_prefix}/nav_menu", json: json, page: page
|
33
26
|
|
34
|
-
|
27
|
+
page.table nextPage: next_page, firstSection: ->(section) do
|
28
|
+
section.header cellViews: ->(header) do
|
29
|
+
column_indexes.each do |i|
|
30
|
+
header.label text: "Heading#{i}"
|
31
|
+
end
|
35
32
|
end
|
33
|
+
|
34
|
+
render "#{@path_prefix}/tables/autoload_section", page: page, page_index: page_index, column_indexes: column_indexes
|
35
|
+
end, onScrollToBottom: ->(action) do
|
36
|
+
action.snackbars_alert message: 'Scrolled to Bottom'
|
37
|
+
end, onScrollToTop: ->(action) do
|
38
|
+
action.snackbars_alert message: 'Scrolled to Top'
|
36
39
|
end
|
37
40
|
|
38
41
|
end
|
@@ -20,7 +20,7 @@ class CreateActiveStorageTables < ActiveRecord::Migration[5.2]
|
|
20
20
|
|
21
21
|
t.datetime :created_at, null: false
|
22
22
|
|
23
|
-
t.index [ :record_type, :record_id, :name, :blob_id ], name:
|
23
|
+
t.index [ :record_type, :record_id, :name, :blob_id ], name: 'index_active_storage_attachments_uniqueness', unique: true
|
24
24
|
t.foreign_key :active_storage_blobs, column: :blob_id
|
25
25
|
end
|
26
26
|
end
|
@@ -1,2 +1,2 @@
|
|
1
1
|
dt_redis_url = ENV.fetch('<%= options[:redis_env_key] %>', 'redis://localhost:6379')
|
2
|
-
$dt_redis = Redis.new(url: dt_redis_url)
|
2
|
+
$dt_redis = Redis.new(url: dt_redis_url)
|
data/lib/glib-web.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
4
|
-
require
|
1
|
+
require 'glib/version'
|
2
|
+
require 'glib/engine' if defined?(::Rails)
|
3
|
+
require 'glib/value'
|
4
|
+
require 'glib/json_crawler'
|
5
5
|
|
6
6
|
require 'glib/dynamic_text'
|
7
7
|
require 'glib/crypt'
|
8
|
-
require 'glib/test_helpers'
|
8
|
+
require 'glib/test_helpers'
|
data/lib/glib/engine.rb
CHANGED
@@ -30,10 +30,10 @@ module Glib
|
|
30
30
|
fields << child
|
31
31
|
|
32
32
|
include_params = case name
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
33
|
+
when 'fields/check', 'fields/check-v1'
|
34
|
+
child['checkValue'] == child['value']
|
35
|
+
else
|
36
|
+
true
|
37
37
|
end
|
38
38
|
|
39
39
|
params[child['name']] = child['value'] if include_params
|
data/lib/glib/test_helpers.rb
CHANGED
@@ -25,9 +25,9 @@ module Glib
|
|
25
25
|
@__log_file ||= "#{self.method_name}.json"
|
26
26
|
end
|
27
27
|
|
28
|
-
def __log
|
29
|
-
File.open("#{File.join(__log_dir, __log_file)}",
|
30
|
-
f << JSON.pretty_generate(
|
28
|
+
def __log(json)
|
29
|
+
File.open("#{File.join(__log_dir, __log_file)}", 'w') do |f|
|
30
|
+
f << JSON.pretty_generate(JSON.parse(json))
|
31
31
|
end
|
32
32
|
json
|
33
33
|
end
|
data/lib/glib/value.rb
CHANGED
data/lib/glib/version.rb
CHANGED
data/lib/tasks/db.rake
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
desc
|
1
|
+
desc 'Run migration scripts in db/migrate'
|
2
2
|
|
3
|
-
Rake::Task[
|
3
|
+
Rake::Task['db:structure:dump'].clear
|
4
4
|
|
5
5
|
namespace :db do
|
6
6
|
namespace :fixtures do
|
@@ -17,9 +17,9 @@ namespace :db do
|
|
17
17
|
# allow to specify output directory by FIXTURES_PATH
|
18
18
|
|
19
19
|
desc 'Dumps all models into fixtures.'
|
20
|
-
task :
|
20
|
+
task dump: :environment do
|
21
21
|
models = Dir.glob(Rails.root + 'app/models/**.rb').map do |s|
|
22
|
-
Pathname.new(s).basename.to_s.gsub(/\.rb$/,'').camelize
|
22
|
+
Pathname.new(s).basename.to_s.gsub(/\.rb$/, '').camelize
|
23
23
|
end
|
24
24
|
|
25
25
|
begin
|
@@ -33,20 +33,20 @@ namespace :db do
|
|
33
33
|
end
|
34
34
|
|
35
35
|
# specify FIXTURES_PATH to test/fixtures if you do test:unit
|
36
|
-
dump_dir = ENV['FIXTURES_PATH'] ||
|
36
|
+
dump_dir = ENV['FIXTURES_PATH'] || 'test/fixtures/'
|
37
37
|
|
38
38
|
excludes = YAML.load_file(File.join(Rails.root, 'config', 'excluded_fixtures.yml'))
|
39
39
|
|
40
|
-
puts
|
41
|
-
puts
|
42
|
-
puts
|
40
|
+
puts 'Found models: ' + models.join(', ')
|
41
|
+
puts 'Excluding: ' + excludes.join(', ')
|
42
|
+
puts 'Dumping to: ' + dump_dir
|
43
43
|
|
44
44
|
models.each do |m|
|
45
45
|
unless excludes.include?(m)
|
46
46
|
model = m.constantize
|
47
47
|
next unless model.ancestors.include?(ActiveRecord::Base)
|
48
48
|
|
49
|
-
ids = model.column_names.select{ |k| k.ends_with?('_id') }.sort
|
49
|
+
ids = model.column_names.select { |k| k.ends_with?('_id') }.sort
|
50
50
|
|
51
51
|
entries = if model.column_names.include?('id')
|
52
52
|
model.unscoped.order(:id).all
|
@@ -63,7 +63,7 @@ namespace :db do
|
|
63
63
|
|
64
64
|
entries.each do |a|
|
65
65
|
attrs = Hash[a.attributes.sort]
|
66
|
-
attrs.delete_if{ |k,v| v.nil? }
|
66
|
+
attrs.delete_if { |k, v| v.nil? }
|
67
67
|
|
68
68
|
id = if attrs.include?('id')
|
69
69
|
[a.id]
|
@@ -92,4 +92,4 @@ namespace :db do
|
|
92
92
|
end
|
93
93
|
end
|
94
94
|
end
|
95
|
-
end
|
95
|
+
end
|
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: 0.5.
|
4
|
+
version: 0.5.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ''
|
@@ -142,12 +142,13 @@ files:
|
|
142
142
|
- app/views/json_ui/garage/home/blank.json.jbuilder
|
143
143
|
- app/views/json_ui/garage/home/index.json.jbuilder
|
144
144
|
- app/views/json_ui/garage/home/slow.json.jbuilder
|
145
|
-
- app/views/json_ui/garage/lists/
|
145
|
+
- app/views/json_ui/garage/lists/_autoload_section.json.jbuilder
|
146
|
+
- app/views/json_ui/garage/lists/autoload_all.json.jbuilder
|
147
|
+
- app/views/json_ui/garage/lists/autoload_as_needed.json.jbuilder
|
146
148
|
- app/views/json_ui/garage/lists/chat.json.jbuilder
|
147
149
|
- app/views/json_ui/garage/lists/edit_actions.json.jbuilder
|
148
150
|
- app/views/json_ui/garage/lists/fab.json.jbuilder
|
149
151
|
- app/views/json_ui/garage/lists/index.json.jbuilder
|
150
|
-
- app/views/json_ui/garage/lists/infinite_scroll.json.jbuilder
|
151
152
|
- app/views/json_ui/garage/lists/templating.json.jbuilder
|
152
153
|
- app/views/json_ui/garage/notifications/index.json.jbuilder
|
153
154
|
- app/views/json_ui/garage/notifications/web_socket.json.jbuilder
|