glib-web 0.4.74 → 0.5.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/controllers/concerns/glib/json/libs.rb +30 -7
- data/app/helpers/glib/json_ui/action_builder.rb +0 -18
- data/app/helpers/glib/json_ui/action_builder/http.rb +19 -0
- data/app/helpers/glib/json_ui/menu_builder.rb +1 -0
- data/app/views/json_ui/garage/actions/_http.json.jbuilder +18 -0
- data/app/views/json_ui/garage/actions/_reload.json.jbuilder +17 -0
- data/app/views/json_ui/garage/actions/index.json.jbuilder +3 -18
- data/app/views/json_ui/garage/lists/templating.json.jbuilder +1 -1
- data/config/routes.rb +2 -0
- metadata +4 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 832af08d8701c658362e9974f4a9ed5a52c5bb5f
|
4
|
+
data.tar.gz: 81b729e8cc79ee02437eb96b715ad8e4ccd86283
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2ee4d1c3b862f97349c17d9d638766006ad47832b26b7abc46d8976139012f1ab2fbe23bf931c0fc36623f06c7a7ae8802e8d766044c9c11a4194a8684214875
|
7
|
+
data.tar.gz: 1d76aa4197f3d12d3131b3224e83d76fe7d8c3aa54a8a258945ca2f76f8b690ef4f281d3d961d3a9b785c8660bb6d66a9ccb45ebc1494a57e2b53162df512ce2
|
@@ -46,14 +46,28 @@ module Glib::Json::Libs
|
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
|
-
def
|
50
|
-
|
51
|
-
|
49
|
+
def glib_json_handle_403
|
50
|
+
render file: Rails.root.join('public', '404.html'), status: :forbidden
|
51
|
+
end
|
52
|
+
|
53
|
+
def glib_json_handle_404
|
54
|
+
raise ActionController::RoutingError.new('Not Found')
|
55
|
+
|
56
|
+
# if json_ui_activated?
|
57
|
+
# render file: Rails.root.join('public', '404.html'), status: :not_found
|
58
|
+
# else
|
59
|
+
# raise exception
|
60
|
+
# end
|
61
|
+
end
|
62
|
+
|
63
|
+
def glib_json_handle_500(exception)
|
64
|
+
if json_ui_activated? && Rails.env.production?
|
65
|
+
Rollbar.error(exception) if defined?(Rollbar)
|
66
|
+
render file: Rails.root.join('public', '500.html'), status: :internal_server_error
|
52
67
|
else
|
53
68
|
raise exception
|
54
69
|
end
|
55
70
|
end
|
56
|
-
|
57
71
|
|
58
72
|
|
59
73
|
module ClassMethods
|
@@ -111,11 +125,20 @@ module Glib::Json::Libs
|
|
111
125
|
end
|
112
126
|
end
|
113
127
|
|
114
|
-
|
115
|
-
|
116
|
-
|
128
|
+
# Call this before other rescues. Later rescue_from statements will take precedence, so more specific
|
129
|
+
# rescues have to be declared later.
|
130
|
+
def json_libs_rescue_500
|
131
|
+
rescue_from StandardError do |exception|
|
132
|
+
glib_json_handle_500(exception)
|
117
133
|
end
|
118
134
|
end
|
119
135
|
|
136
|
+
def json_libs_rescue_404
|
137
|
+
# Removed because it doesn't seem to offer anything extra
|
138
|
+
# rescue_from ActiveRecord::RecordNotFound do |exception|
|
139
|
+
# glib_json_handle_404
|
140
|
+
# end
|
141
|
+
end
|
142
|
+
|
120
143
|
end
|
121
144
|
end
|
@@ -75,24 +75,6 @@ module Glib
|
|
75
75
|
end
|
76
76
|
end
|
77
77
|
|
78
|
-
module Http
|
79
|
-
class Post < Action
|
80
|
-
string :url, cache: true
|
81
|
-
hash :formData
|
82
|
-
end
|
83
|
-
|
84
|
-
class Patch < Action
|
85
|
-
string :url, cache: true
|
86
|
-
hash :formData
|
87
|
-
end
|
88
|
-
|
89
|
-
class Delete < Action
|
90
|
-
string :url, cache: true
|
91
|
-
hash :formData
|
92
|
-
end
|
93
|
-
|
94
|
-
end
|
95
|
-
|
96
78
|
###
|
97
79
|
end
|
98
80
|
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
class Glib::JsonUi::ActionBuilder
|
2
|
+
module Http
|
3
|
+
class Post < Action
|
4
|
+
string :url, cache: true
|
5
|
+
hash :formData
|
6
|
+
end
|
7
|
+
|
8
|
+
class Patch < Action
|
9
|
+
string :url, cache: true
|
10
|
+
hash :formData
|
11
|
+
end
|
12
|
+
|
13
|
+
class Delete < Action
|
14
|
+
string :url, cache: true
|
15
|
+
hash :formData
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
|
2
|
+
section.header padding: glib_json_padding_list, childViews: ->(header) do
|
3
|
+
header.h3 text: 'HTTP'
|
4
|
+
end
|
5
|
+
|
6
|
+
section.rows builder: ->(template) do
|
7
|
+
template.thumbnail title: 'http/post', onClick: ->(action) do
|
8
|
+
action.http_post url: json_ui_garage_url(path: 'forms/basic_post'), formData: { 'user[name]' => 'New Joe' }
|
9
|
+
end
|
10
|
+
|
11
|
+
template.thumbnail title: 'http/patch', onClick: ->(action) do
|
12
|
+
action.http_patch url: json_ui_garage_url(path: 'forms/basic_post'), formData: { 'user[name]' => 'Edit Joe' }
|
13
|
+
end
|
14
|
+
|
15
|
+
template.thumbnail title: 'http/delete', onClick: ->(action) do
|
16
|
+
action.http_delete url: json_ui_garage_url(path: 'forms/basic_post'), formData: { 'user[name]' => 'Delete Joe' }
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
section.header padding: glib_json_padding_list, childViews: ->(header) do
|
2
|
+
header.h3 text: 'Reload'
|
3
|
+
header.spacer height: 6
|
4
|
+
header.label text: 'Reload does not open a new page/screen. Click reload a few times, then click back and notice that it goes back to the page before the reload.'
|
5
|
+
end
|
6
|
+
|
7
|
+
section.rows builder: ->(template) do
|
8
|
+
template.thumbnail title: "windows/reload (timestamp: #{DateTime.current.to_i})", onClick: ->(action) do
|
9
|
+
action.windows_reload
|
10
|
+
end
|
11
|
+
|
12
|
+
reload_counter = params[:reload_counter].to_i
|
13
|
+
reload_counter = 0 if reload_counter > 5
|
14
|
+
template.thumbnail title: "windows/reload with URL (counter: #{reload_counter})", onClick: ->(action) do
|
15
|
+
action.windows_reload url: json_ui_garage_url(path: 'actions/index', reload_counter: reload_counter + 1)
|
16
|
+
end
|
17
|
+
end
|
@@ -15,24 +15,9 @@ json_ui_page json do |page|
|
|
15
15
|
end, ->(section) do
|
16
16
|
render "#{@path_prefix}/actions/timeouts", section: section
|
17
17
|
end, ->(section) do
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
header.label text: 'Reload does not open a new page/screen. Click reload a few times, then click back and notice that it goes back to the page before the reload.'
|
22
|
-
end
|
23
|
-
|
24
|
-
section.rows builder: ->(template) do
|
25
|
-
template.thumbnail title: "windows/reload (timestamp: #{DateTime.current.to_i})", onClick: ->(action) do
|
26
|
-
action.windows_reload
|
27
|
-
end
|
28
|
-
|
29
|
-
reload_counter = params[:reload_counter].to_i
|
30
|
-
reload_counter = 0 if reload_counter > 5
|
31
|
-
template.thumbnail title: "windows/reload with URL (counter: #{reload_counter})", onClick: ->(action) do
|
32
|
-
action.windows_reload url: json_ui_garage_url(path: 'actions/index', reload_counter: reload_counter + 1)
|
33
|
-
end
|
34
|
-
|
35
|
-
end
|
18
|
+
render "#{@path_prefix}/actions/http", section: section
|
19
|
+
end, ->(section) do
|
20
|
+
render "#{@path_prefix}/actions/reload", section: section
|
36
21
|
end
|
37
22
|
]
|
38
23
|
end
|
@@ -14,7 +14,7 @@ json_ui_page json do |page|
|
|
14
14
|
end
|
15
15
|
template.thumbnail title: 'Item with subtitle', subtitle: 'Item subtitle'
|
16
16
|
template.thumbnail title: 'Item with chips', chips: ->(menu) do
|
17
|
-
menu.button text: '
|
17
|
+
menu.button text: 'Finished', styleClass: 'info'
|
18
18
|
menu.button props: { text: 'Succeeded', styleClass: 'success' }
|
19
19
|
end
|
20
20
|
|
data/config/routes.rb
CHANGED
@@ -2,5 +2,7 @@ Glib::Web::Engine.routes.draw do
|
|
2
2
|
scope module: :glib do
|
3
3
|
get 'json_ui_garage', to: 'home#json_ui_garage'
|
4
4
|
post 'json_ui_garage', to: 'home#json_ui_garage'
|
5
|
+
patch 'json_ui_garage', to: 'home#json_ui_garage'
|
6
|
+
delete 'json_ui_garage', to: 'home#json_ui_garage'
|
5
7
|
end
|
6
8
|
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.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ''
|
@@ -79,6 +79,7 @@ files:
|
|
79
79
|
- app/helpers/glib/json_ui/abstract_builder.rb
|
80
80
|
- app/helpers/glib/json_ui/action_builder.rb
|
81
81
|
- app/helpers/glib/json_ui/action_builder/dialogs.rb
|
82
|
+
- app/helpers/glib/json_ui/action_builder/http.rb
|
82
83
|
- app/helpers/glib/json_ui/action_builder/sheets.rb
|
83
84
|
- app/helpers/glib/json_ui/action_builder/snackbars.rb
|
84
85
|
- app/helpers/glib/json_ui/action_builder/windows.rb
|
@@ -107,6 +108,8 @@ files:
|
|
107
108
|
- app/views/app/views/json_ui/vue/renderer.html.erb
|
108
109
|
- app/views/json_ui/garage/_nav_menu.json.jbuilder
|
109
110
|
- app/views/json_ui/garage/actions/_dialogs.json.jbuilder
|
111
|
+
- app/views/json_ui/garage/actions/_http.json.jbuilder
|
112
|
+
- app/views/json_ui/garage/actions/_reload.json.jbuilder
|
110
113
|
- app/views/json_ui/garage/actions/_sheets.json.jbuilder
|
111
114
|
- app/views/json_ui/garage/actions/_snackbars.json.jbuilder
|
112
115
|
- app/views/json_ui/garage/actions/_timeouts.json.jbuilder
|