glib-web 0.4.74 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2809128e8efe1991ed5a12aeb78637f4e4d4f7af
4
- data.tar.gz: 4896bb9197227a070abf19f033e54d4dd32efff9
3
+ metadata.gz: 832af08d8701c658362e9974f4a9ed5a52c5bb5f
4
+ data.tar.gz: 81b729e8cc79ee02437eb96b715ad8e4ccd86283
5
5
  SHA512:
6
- metadata.gz: bbca01d80afbe23375f5caf90011dffed09e01c6cad9955d270e894934a4fd87d34afca41b495634c813985f6a9606e82e63714faedca19f5a05b527321f6678
7
- data.tar.gz: b7d4840eeeae5194b8966b4458eab5674f6c9c50ede361add2068ce2d699526fb2a076671ea34cba885c863e76814fbd3c9bda7a55550923c635e936bdf469d9
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 json_libs_handle_404
50
- if json_ui_activated?
51
- render file: "#{Rails.root}/public/404.html", status: :not_found
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
- def json_libs_rescue_404
115
- rescue_from ActiveRecord::RecordNotFound do |exception|
116
- json_libs_handle_404
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
@@ -35,6 +35,7 @@ module Glib
35
35
 
36
36
  class Label < MenuItem
37
37
  string :text
38
+ singleton_array :styleClass, :styleClasses
38
39
 
39
40
  # Override
40
41
  def created
@@ -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
- section.header padding: glib_json_padding_list, childViews: ->(header) do
19
- header.h3 text: 'Reload'
20
- header.spacer height: 6
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: 'FInished', styleClass: 'info'
17
+ menu.button text: 'Finished', styleClass: 'info'
18
18
  menu.button props: { text: 'Succeeded', styleClass: 'success' }
19
19
  end
20
20
 
@@ -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.74
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