glib-web 0.5.49 → 0.5.51

Sign up to get free protection for your applications and to get access to all the features.
Files changed (30) hide show
  1. checksums.yaml +4 -4
  2. data/app/channels/glib/channel/is_typing_channel.rb +28 -0
  3. data/app/controllers/concerns/glib/json/traversal.rb +0 -0
  4. data/app/controllers/glib/home_controller.rb +0 -0
  5. data/app/helpers/glib/json_ui/abstract_builder.rb +0 -0
  6. data/app/helpers/glib/json_ui/action_builder.rb +1 -0
  7. data/app/helpers/glib/json_ui/list_builders.rb +0 -0
  8. data/app/helpers/glib/json_ui/page_helper.rb +0 -0
  9. data/app/helpers/glib/json_ui/response_helper.rb +0 -0
  10. data/app/helpers/glib/json_ui/view_builder.rb +1 -0
  11. data/app/helpers/glib/json_ui/view_builder/fields.rb +2 -0
  12. data/app/helpers/glib/json_ui/view_builder/panels.rb +0 -0
  13. data/app/views/json_ui/garage/actions/index.json.jbuilder +0 -0
  14. data/app/views/json_ui/garage/forms/_alert_post_data.json.jbuilder +0 -0
  15. data/app/views/json_ui/garage/forms/conditional_value.json.jbuilder +0 -0
  16. data/app/views/json_ui/garage/forms/pickers.json.jbuilder +0 -0
  17. data/app/views/json_ui/garage/forms/selects.json.jbuilder +0 -0
  18. data/app/views/json_ui/garage/forms/show_hide.json.jbuilder +0 -0
  19. data/app/views/json_ui/garage/forms/styled_boxes.json.jbuilder +0 -0
  20. data/app/views/json_ui/garage/home/index.json.jbuilder +0 -0
  21. data/app/views/json_ui/garage/lists/_autoload_section.json.jbuilder +0 -0
  22. data/app/views/json_ui/garage/lists/edit_actions.json.jbuilder +0 -0
  23. data/app/views/json_ui/garage/lists/index.json.jbuilder +0 -0
  24. data/app/views/json_ui/garage/lists/reordering.json.jbuilder +0 -0
  25. data/app/views/json_ui/garage/notifications/action_cable.json.jbuilder +77 -6
  26. data/app/views/json_ui/garage/notifications/android_post.json.jbuilder +0 -0
  27. data/app/views/json_ui/garage/views/maps.json.jbuilder +0 -0
  28. data/lib/glib/json_crawler/router.rb +0 -0
  29. data/lib/glib/test_helpers.rb +0 -0
  30. metadata +23 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: de169b420305a05364d54456a0673cd84551e04ada3db96d93fd68c3b0e7fff5
4
- data.tar.gz: 7c51e166d6e95ca1edb404c4faaf900b6a28a6f5ca940cabe7f534eddbfa8720
3
+ metadata.gz: 54ec1ebfb9977b82473a2a4677d83e0bd82975dbd39a2a3a2ffd4bd901903fb8
4
+ data.tar.gz: 322cfff138b7fa5e99e25b48512d7c56e4426edd94ea9638fad0695f6b4f5f11
5
5
  SHA512:
6
- metadata.gz: f00a06fe4f39340bc75b19553e19ce2f65f0d5f6bf64ea2287357b7e68475cc774062417cbd854e727905f7c3d434a0705f5322f083c22f4ace99dce79be7cc6
7
- data.tar.gz: fe0894ee4fd7580f86c603e9cd3572ff0550fb772ace25cc63f5a74002fe1a3ec5a9aecd5446b04d2c8823a7de9a8a19f4e82c7fe4f8dc2816b23eafee9dd1e8
6
+ metadata.gz: 1462c3983c1a0a344e39171f7a5e41d5d394ff13fb7fa4f0ad62f27ac07e6ef272fe487090a502361305542e406bbc3f22d4d2001e014e1f87a4ef5b4a9ae959
7
+ data.tar.gz: 4c337b87a009042358b5848e902d41f2b03229679acbb93ff482246d57fae3fc0855bebb3902204b8fad12b4c36ff78a9aec788ff50f5db97a3fa77780d15c7d
@@ -0,0 +1,28 @@
1
+ module Glib
2
+ module Channel
3
+ class IsTypingChannel < ApplicationCable::Channel
4
+ class << self
5
+ attr_accessor :channel_name
6
+ end
7
+
8
+ def channel_name
9
+ self.class.channel_name
10
+ end
11
+
12
+ def subscribed
13
+ stream_from "#{self.class.channel_name}_#{params['conversation_id']}"
14
+ end
15
+
16
+ def typing(data)
17
+ ActionCable.server.broadcast \
18
+ "#{self.class.channel_name}_#{params['conversation_id']}",
19
+ action: {
20
+ action: 'component/set',
21
+ name: User.find(data['user_id']).full_name,
22
+ status: data['status'],
23
+ user_id: data['user_id']
24
+ }
25
+ end
26
+ end
27
+ end
28
+ end
File without changes
File without changes
File without changes
@@ -99,6 +99,7 @@ module Glib
99
99
  class Push < Action
100
100
  string :channel
101
101
  string :event
102
+ hash :payload
102
103
  end
103
104
  end
104
105
 
File without changes
File without changes
File without changes
@@ -109,6 +109,7 @@ module Glib
109
109
  end
110
110
 
111
111
  class Label < AbstractText
112
+ hash :actionCable
112
113
  # string :format
113
114
  action :onClick
114
115
  end
@@ -76,6 +76,8 @@ class Glib::JsonUi::ViewBuilder
76
76
  icon :leftIcon
77
77
  string :leftText
78
78
  string :rightText
79
+ action :onTypeStart
80
+ action :onTypeEnd
79
81
  end
80
82
 
81
83
  class Number < Text
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -1,3 +1,4 @@
1
+ json.title 'ActionCable Real-time Update'
1
2
  page = json_ui_page json
2
3
 
3
4
  # Implement a page that shows how ActionCable works in json_ui
@@ -9,14 +10,16 @@ page = json_ui_page json
9
10
  # end
10
11
  # end
11
12
 
12
- # 2. Example for textarea
13
- # - TODO: Put onKeyUp in Textarea class in app/helpers/glib/json_ui/view_builder/fields.rb
14
- # - TODO: Implement onKeyUp in glib-web-npm
15
- # - TODO: Implement cables_push in glib-web-npm
16
- # form.fields_textarea prop: :content, width: 'matchParent', label: 'Message', onKeyUp: ->(action) do
17
- # action.cables_push channel: 'message', event: 'typing'
13
+ # page.form url: json_ui_garage_url(path: 'forms/basic_post'), method: 'post', padding: glib_json_padding_body, childViews: ->(form) do
14
+ # form.fields_textarea \
15
+ # width: 'matchParent',
16
+ # label: 'Message',
17
+ # onKeyUp: ->(action) do
18
+ # action.cables_push channel: 'isTypingChannel', data: { conversationId: 1, userId: 1 }
19
+ # end
18
20
  # end
19
21
 
22
+
20
23
  # 3. Example for online status
21
24
  # - TODO: Implement "repeat: true" in glib-web-npm
22
25
  # page.on load: ->(action) do
@@ -24,3 +27,71 @@ page = json_ui_page json
24
27
  # subaction.cables_push channel: 'message', event: 'online'
25
28
  # end
26
29
  # end
30
+
31
+
32
+ # put on app/channels/is_typing_channel.rb
33
+ # class IsTypingChannel < Glib::Channel::IsTypingChannel
34
+ # self.channel_name = 'IsTypingChannel'
35
+ # end
36
+
37
+ page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
38
+
39
+ channel = 'IsTypingChannel'
40
+ first_user = User.first
41
+ second_user = User.offset(1).first
42
+
43
+ scroll.panels_split width: 'matchParent', content: ->(content) do
44
+ content.left childViews: ->(left) do
45
+ left.fields_textarea \
46
+ width: 'matchParent',
47
+ label: "Messages from #{first_user.full_name}",
48
+ onTypeStart: lambda { |action|
49
+ action.cables_push \
50
+ channel: channel, event: 'typing',
51
+ payload: { status: true, user_id: first_user.id }
52
+ },
53
+ onTypeEnd: lambda { |action|
54
+ action.cables_push \
55
+ channel: channel,
56
+ event: 'typing',
57
+ payload: { status: false, user_id: first_user.id }
58
+ }
59
+ left.spacer height: 10
60
+
61
+ socket_config = {
62
+ channel: channel,
63
+ filterKey: first_user.id,
64
+ params: {
65
+ conversation: 2
66
+ }
67
+ }
68
+ left.label actionCable: socket_config, text: ' '
69
+ end
70
+ content.right childViews: ->(right) do
71
+ right.fields_textarea \
72
+ width: 'matchParent',
73
+ label: "Messages from #{second_user.full_name}",
74
+ onTypeStart: lambda { |action|
75
+ action.cables_push \
76
+ channel: channel, event: 'typing',
77
+ payload: { status: true, user_id: second_user.id }
78
+ },
79
+ onTypeEnd: lambda { |action|
80
+ action.cables_push \
81
+ channel: channel,
82
+ event: 'typing',
83
+ payload: { status: false, user_id: second_user.id }
84
+ }
85
+ right.spacer height: 10
86
+
87
+ socket_config = {
88
+ channel: channel,
89
+ filterKey: second_user.id,
90
+ params: {
91
+ conversation: 2
92
+ }
93
+ }
94
+ right.label actionCable: socket_config, text: ' '
95
+ end
96
+ end
97
+ end
File without changes
File without changes
File without changes
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.49
4
+ version: 0.5.51
5
5
  platform: ruby
6
6
  authors:
7
7
  - ''
@@ -17,9 +17,6 @@ dependencies:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: 5.2.3
20
- - - "<"
21
- - !ruby/object:Gem::Version
22
- version: 6.1.0
23
20
  type: :runtime
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
@@ -27,9 +24,6 @@ dependencies:
27
24
  - - ">="
28
25
  - !ruby/object:Gem::Version
29
26
  version: 5.2.3
30
- - - "<"
31
- - !ruby/object:Gem::Version
32
- version: 6.1.0
33
27
  - !ruby/object:Gem::Dependency
34
28
  name: pundit
35
29
  requirement: !ruby/object:Gem::Requirement
@@ -58,12 +52,33 @@ dependencies:
58
52
  - - "~>"
59
53
  - !ruby/object:Gem::Version
60
54
  version: '2.1'
55
+ - !ruby/object:Gem::Dependency
56
+ name: actioncable
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: 6.0.1
62
+ - - "<"
63
+ - !ruby/object:Gem::Version
64
+ version: 6.1.0
65
+ type: :runtime
66
+ prerelease: false
67
+ version_requirements: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ version: 6.0.1
72
+ - - "<"
73
+ - !ruby/object:Gem::Version
74
+ version: 6.1.0
61
75
  description:
62
76
  email: ''
63
77
  executables: []
64
78
  extensions: []
65
79
  extra_rdoc_files: []
66
80
  files:
81
+ - app/channels/glib/channel/is_typing_channel.rb
67
82
  - app/controllers/concerns/glib/analytics/funnel.rb
68
83
  - app/controllers/concerns/glib/auth/policy.rb
69
84
  - app/controllers/concerns/glib/json/dynamic_text.rb
@@ -254,8 +269,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
254
269
  - !ruby/object:Gem::Version
255
270
  version: '0'
256
271
  requirements: []
257
- rubyforge_project:
258
- rubygems_version: 2.7.6
272
+ rubygems_version: 3.1.4
259
273
  signing_key:
260
274
  specification_version: 4
261
275
  summary: ''