glib-web 0.5.14 → 0.5.20

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.
Files changed (48) hide show
  1. checksums.yaml +5 -5
  2. data/app/controllers/concerns/glib/json/traversal.rb +2 -1
  3. data/app/controllers/concerns/glib/json/ui.rb +5 -8
  4. data/app/controllers/glib/home_controller.rb +0 -0
  5. data/app/helpers/glib/json_ui/action_builder.rb +10 -0
  6. data/app/helpers/glib/json_ui/menu_builder.rb +11 -6
  7. data/app/helpers/glib/json_ui/page_helper.rb +10 -0
  8. data/app/helpers/glib/json_ui/response_helper.rb +0 -0
  9. data/app/helpers/glib/json_ui/view_builder/fields.rb +2 -0
  10. data/app/helpers/glib/json_ui/view_builder/panels.rb +14 -1
  11. data/app/views/json_ui/garage/_nav_menu.json.jbuilder +0 -1
  12. data/app/views/json_ui/garage/actions/_http.json.jbuilder +9 -3
  13. data/app/views/json_ui/garage/actions/index.json.jbuilder +0 -0
  14. data/app/views/json_ui/garage/forms/basic.json.jbuilder +2 -14
  15. data/app/views/json_ui/garage/forms/dynamic_group.json.jbuilder +31 -16
  16. data/app/views/json_ui/garage/forms/pickers.json.jbuilder +0 -0
  17. data/app/views/json_ui/garage/home/index.json.jbuilder +0 -0
  18. data/app/views/json_ui/garage/lists/{_infinite_scroll_section.json.jbuilder → _autoload_section.json.jbuilder} +4 -2
  19. data/app/views/json_ui/garage/lists/autoload_all.json.jbuilder +32 -0
  20. data/app/views/json_ui/garage/lists/{infinite_scroll.json.jbuilder → autoload_as_needed.json.jbuilder} +9 -12
  21. data/app/views/json_ui/garage/lists/chat_ui.json.jbuilder +112 -0
  22. data/app/views/json_ui/garage/lists/fab.json.jbuilder +6 -8
  23. data/app/views/json_ui/garage/lists/index.json.jbuilder +8 -5
  24. data/app/views/json_ui/garage/notifications/android_post.json.jbuilder +48 -0
  25. data/app/views/json_ui/garage/notifications/index.json.jbuilder +14 -0
  26. data/app/views/json_ui/garage/pages/nav_buttons.json.jbuilder +4 -16
  27. data/app/views/json_ui/garage/tables/_autoload_section.json.jbuilder +6 -2
  28. data/app/views/json_ui/garage/tables/autoload_all.json.jbuilder +15 -10
  29. data/app/views/json_ui/garage/tables/autoload_as_needed.json.jbuilder +13 -2
  30. data/app/views/json_ui/garage/tables/index.json.jbuilder +19 -20
  31. data/app/views/json_ui/garage/tables/layout.json.jbuilder +26 -28
  32. data/app/views/json_ui/garage/views/banners.json.jbuilder +18 -6
  33. data/app/views/json_ui/garage/views/icons.json.jbuilder +1439 -11
  34. data/app/views/json_ui/garage/views/index.json.jbuilder +6 -3
  35. data/app/views/layouts/json_ui/renderer.html.erb +7 -4
  36. data/lib/generators/templates/20191024063257_add_scope_to_texts.rb +1 -1
  37. data/lib/generators/templates/20191126071051_create_active_storage_tables.active_storage.rb +1 -1
  38. data/lib/generators/templates/dynamic_text.rb +1 -1
  39. data/lib/glib-web.rb +5 -5
  40. data/lib/glib/engine.rb +1 -1
  41. data/lib/glib/json_crawler/action_crawlers/forms_submit.rb +4 -4
  42. data/lib/glib/json_crawler/http.rb +1 -1
  43. data/lib/glib/test_helpers.rb +3 -3
  44. data/lib/glib/value.rb +1 -1
  45. data/lib/glib/version.rb +2 -2
  46. data/lib/tasks/db.rake +11 -11
  47. metadata +7 -5
  48. data/app/views/json_ui/garage/lists/chat.json.jbuilder +0 -112
@@ -22,12 +22,15 @@ json_ui_page json do |page|
22
22
  template.thumbnail title: 'Banners', onClick: ->(action) do
23
23
  action.windows_open url: json_ui_garage_url(path: 'views/banners')
24
24
  end
25
- template.thumbnail title: 'Icons', onClick: ->(action) do
26
- action.windows_open url: json_ui_garage_url(path: 'views/icons')
27
- end
28
25
  template.thumbnail title: 'Misc', onClick: ->(action) do
29
26
  action.windows_open url: json_ui_garage_url(path: 'views/misc')
30
27
  end
28
+
29
+ if !Rails.env.test? # Avoid slowing down tests
30
+ template.thumbnail title: 'Icons', onClick: ->(action) do
31
+ action.windows_open url: json_ui_garage_url(path: 'views/icons')
32
+ end
33
+ end
31
34
  end
32
35
  end,
33
36
  ->(section) do
@@ -4,16 +4,19 @@
4
4
  <head>
5
5
  <meta charset="utf-8" />
6
6
  <meta content="width=device-width, initial-scale=1, shrink-to-fit=no" name="viewport" />
7
-
7
+
8
8
  <title>App</title>
9
9
  <%= csrf_meta_tags %>
10
-
10
+
11
11
  <%= javascript_pack_tag 'vue_renderer', defer: true %>
12
12
  <%#= javascript_include_tag 'vue_renderer_extras', defer: true %>
13
13
 
14
14
  <%= stylesheet_pack_tag 'vue_renderer' %>
15
15
 
16
- <link href="https://fonts.googleapis.com/css?family=Material+Icons" rel="stylesheet" />
16
+ <link href="//fonts.googleapis.com/css?family=Material+Icons" rel="stylesheet" />
17
+
18
+ <%# Without this, checkboxes and radio buttons will not display. %>
19
+ <link href="//cdn.materialdesignicons.com/2.1.99/css/materialdesignicons.min.css" rel="stylesheet" />
17
20
 
18
21
  <%= yield :head %>
19
22
  </head>
@@ -21,7 +24,7 @@
21
24
  <body>
22
25
  <noscript>Please enable JavaScript to view this web site.</noscript>
23
26
  <div id="app"></div>
24
-
27
+
25
28
  <script>
26
29
  var __page = <%= raw @__json_ui_orig_page%>;
27
30
  </script>
@@ -4,4 +4,4 @@ class AddScopeToTexts < ActiveRecord::Migration[6.0]
4
4
  remove_index :texts, :key
5
5
  add_index :texts, [:scope, :key], unique: true
6
6
  end
7
- end
7
+ 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: "index_active_storage_attachments_uniqueness", unique: true
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)
@@ -1,8 +1,8 @@
1
- require "glib/version"
2
- require "glib/engine" if defined?(::Rails)
3
- require "glib/value"
4
- require "glib/json_crawler"
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'
@@ -4,4 +4,4 @@ module Glib
4
4
  # isolate_namespace Glib::Web
5
5
  end
6
6
  end
7
- end
7
+ end
@@ -30,10 +30,10 @@ module Glib
30
30
  fields << child
31
31
 
32
32
  include_params = case name
33
- when 'fields/check', 'fields/check-v1'
34
- child['checkValue'] == child['value']
35
- else
36
- true
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
@@ -3,7 +3,7 @@ module Glib
3
3
  class Http
4
4
  attr_accessor :history, :response_times, :user, :router
5
5
 
6
- URI_REGEXP = /\A#{URI::regexp}\z/
6
+ URI_REGEXP = /\A#{URI.regexp}\z/
7
7
 
8
8
  VALID_RESPONSE_CODES = [
9
9
  (200..299).to_a,
@@ -25,9 +25,9 @@ module Glib
25
25
  @__log_file ||= "#{self.method_name}.json"
26
26
  end
27
27
 
28
- def __log json
29
- File.open("#{File.join(__log_dir, __log_file)}", "w") do |f|
30
- f << JSON.pretty_generate( JSON.parse(json) )
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
@@ -4,4 +4,4 @@ module Glib
4
4
  class DEFAULT
5
5
  end
6
6
  end
7
- end
7
+ end
@@ -1,5 +1,5 @@
1
1
  module Glib
2
2
  module Web
3
- VERSION = "0.0.1"
3
+ VERSION = '0.0.1'
4
4
  end
5
- end
5
+ end
@@ -1,6 +1,6 @@
1
- desc "Run migration scripts in db/migrate"
1
+ desc 'Run migration scripts in db/migrate'
2
2
 
3
- Rake::Task["db:structure:dump"].clear
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 :dump => :environment do
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'] || "test/fixtures/"
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 "Found models: " + models.join(', ')
41
- puts "Excluding: " + excludes.join(', ')
42
- puts "Dumping to: " + dump_dir
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.14
4
+ version: 0.5.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - ''
@@ -142,13 +142,15 @@ 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/_infinite_scroll_section.json.jbuilder
146
- - app/views/json_ui/garage/lists/chat.json.jbuilder
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
148
+ - app/views/json_ui/garage/lists/chat_ui.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
153
+ - app/views/json_ui/garage/notifications/android_post.json.jbuilder
152
154
  - app/views/json_ui/garage/notifications/index.json.jbuilder
153
155
  - app/views/json_ui/garage/notifications/web_socket.json.jbuilder
154
156
  - app/views/json_ui/garage/pages/flat_centered.json.jbuilder
@@ -242,7 +244,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
242
244
  version: '0'
243
245
  requirements: []
244
246
  rubyforge_project:
245
- rubygems_version: 2.6.8
247
+ rubygems_version: 2.7.6
246
248
  signing_key:
247
249
  specification_version: 4
248
250
  summary: ''
@@ -1,112 +0,0 @@
1
- json.title 'Lists'
2
-
3
- liked = params[:liked] == 'true'
4
-
5
- json_ui_page json do |page|
6
- render "#{@path_prefix}/nav_menu", json: json, page: page
7
-
8
- page.list firstSection: ->(section) do
9
- section.header padding: { top: 12, left: 16, right: 16, bottom: 12 }, childViews: ->(header) do
10
- header.h3 text: 'Chat with John Doe'
11
- end
12
-
13
- section.rows builder: ->(template) do
14
- # template.thumbnail title: "windows/reload (timestamp: #{DateTime.current.to_i}) -- #{liked}", onClick: ->(action) do
15
- # action.windows_reload
16
- # end, onLongPress: ->(action) do
17
- # action.sheets_select message: "Context Menu (#{DateTime.current.to_i})", buttons: ->(menu) do
18
- # if liked
19
- # menu.button text: 'Cancel 👍', onClick: ->(subaction) do
20
- # subaction.windows_reload url: json_ui_garage_url(path: 'lists/chat', liked: false)
21
- # end
22
- # else
23
- # menu.button text: 'Give 👍', onClick: ->(subaction) do
24
- # subaction.windows_reload url: json_ui_garage_url(path: 'lists/chat', liked: true)
25
- # end
26
- # end
27
- # end
28
- # end
29
-
30
- template.commentOutgoing subtitle: 'Hey!', subsubtitle: l(10.minutes.ago, format: :short), imageUrl: glib_json_image_standard_url, chips: ->(menu) do
31
- menu.button text: '😊 2', styleClass: 'info'
32
- end
33
-
34
- template.commentOutgoing subtitle: 'How are you?', subsubtitle: l(DateTime.current, format: :short)
35
-
36
- template.commentIncoming title: 'John Doe', subtitle: 'Very well', subsubtitle: l(7.minutes.ago, format: :short), imageUrl: glib_json_image_standard_url, chips: ->(menu) do
37
- menu.button text: "👍 #{liked ? 2 : 1}"
38
- end, onLongPress: ->(action) do
39
- action.sheets_select message: 'Context Menu', buttons: ->(menu) do
40
- if liked
41
- menu.button text: 'Cancel 👍', onClick: ->(subaction) do
42
- subaction.windows_reload url: json_ui_garage_url(path: 'lists/chat', liked: false)
43
- end
44
- else
45
- menu.button text: 'Give 👍', onClick: ->(subaction) do
46
- subaction.windows_reload url: json_ui_garage_url(path: 'lists/chat', liked: true)
47
- end
48
- end
49
- end
50
- end
51
- end
52
-
53
- section.footer padding: { top: 12, left: 16, right: 16, bottom: 12 }, childViews: ->(footer) do
54
- # footer.
55
-
56
- # json.ws({
57
- # "socket" => {
58
- # "endpoint" => "/socket/websocket",
59
- # "params" => {
60
- # vsn: '2.0.0',
61
- # token: 'TOKEN'
62
- # }
63
- # },
64
- # # "topic" => "room:30",
65
- # # "event" => "comments_updated",
66
- # "topic" => "links",
67
- # "events" => ["new_link_added"],
68
- # "header" => {
69
- # "user_id" => 2,
70
- # "prev_item_id" => nil,
71
- # "last_item_id" => nil
72
- # }
73
- # })
74
-
75
- # page.form url: json_ui_garage_url(path: 'forms/basic_post'), method: 'post', padding: glib_json_padding_body, paramNameForFormData: 'formData', onSubmit: ->(action) do
76
- # json.action "ws/push"
77
- # json.topic "links"
78
- # json.event "new_link"
79
- # json.payload({
80
- # "club_id": "2",
81
- # "room_id": "30",
82
- # "user_id": "2"
83
- # # title: "TITLE",
84
- # # url: "URL"
85
- # })
86
-
87
- # end, childViews: ->(form) do
88
- # form.spacer height: 14
89
- # form.label text: "Message: #{params[:message]}"
90
- # form.spacer height: 14
91
-
92
- # form.fields_text name: 'message[body]', width: 'matchParent', label: 'Message'
93
-
94
- # # TODO: Change this to radio for selecting alert vs reload response
95
- # form.fields_password name: 'user[password]', width: 'matchParent', label: 'Password'
96
-
97
- # form.fields_hidden name: 'baseUrl', width: 'matchParent', value: json_ui_garage_url(path: 'notifications/web_socket')
98
-
99
- # form.panels_split width: 'matchParent', content: ->(split) do
100
- # # split.left childViews: ->(left) do
101
- # # if params[:mode] == 'dialog'
102
- # # left.button styleClass: 'link', text: 'cancel', onClick: ->(action) { action.dialogs_close }
103
- # # end
104
- # # end
105
- # split.right childViews: ->(right) do
106
- # right.button text: 'Submit', onClick: ->(action) { action.forms_submit }
107
- # end
108
- # end
109
-
110
- end
111
- end
112
- end