glib-web 0.4.52 → 0.4.54

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 33f2a64c1f50414b9f78db6257981c7d10e3e1f7
4
- data.tar.gz: 6931884f622dd063adafab4a1424db2614b34388
3
+ metadata.gz: ecdaf7a5551b21c24cdaf87798c3d8d23bcad631
4
+ data.tar.gz: f286b63e80b6e71459809b245931fc4a55974fbb
5
5
  SHA512:
6
- metadata.gz: c74e46c58ac038df0cdadc164b1c969aaa3ec29ffa444c835b1cf3ed9f689bfc9dd6e2ef1ec6256c86a564b5819d65ac80d14563685276f5b3399dbe6926815c
7
- data.tar.gz: 8bbc6f11e229715e6caa490d452dbdfee1dd9b2a0e8d244aa4ad669d464802712accffabebcb9b9fa4df8faf32a444822da9f7847da34389c4028853d9a94140
6
+ metadata.gz: c288e2f16adecd42e54a7f7b2840f6a77c6d10a890e8e22ef6917ed9000b564c9df7934cc021bb86582f53f7c406790f1c2b2631424a0bae78328a4bf841cd02
7
+ data.tar.gz: fda78f4480c7be505f7fc0addbfc03586b9d364207845e17d49f69cfb6da27a4a5673439d101e6f7c335e7aec71a7a11cb911ad225b3c033388defbea619d559
@@ -115,26 +115,25 @@ module Glib::Auth
115
115
  self.before_action(options.slice(:only, :except, :if, :unless)) do |controller|
116
116
  resource_name ||= resource_name_from_controller
117
117
 
118
- if !(resource_key = options[:class]).nil?
119
- resource = case resource_key
120
- when false
121
- resource_name.to_sym
122
- when Symbol, Class
123
- resource_key
118
+ begin
119
+ if !(resource_key = options[:class]).nil?
120
+ resource = case resource_key
121
+ when false
122
+ resource_name.to_sym
123
+ when Symbol, Class
124
+ resource_key
125
+ else
126
+ raise "Invalid resource class: #{resource_key}"
127
+ end
128
+
129
+ authorize resource
130
+ elsif (resource_instance = controller.instance_variable_get("@#{resource_name}"))
131
+ authorize resource_instance
124
132
  else
125
- raise "Invalid resource class: #{resource_key}"
133
+ authorize resource_name.camelize.constantize
126
134
  end
127
-
128
- authorize resource
129
- # if (policy = policy(resource)) && policy.class.instance_variable_defined?(:@manage_permission)
130
- # skip_authorization if policy.manage?
131
- # else
132
- # authorize resource
133
- # end
134
- elsif (resource_instance = controller.instance_variable_get("@#{resource_name}"))
135
- authorize resource_instance
136
- else
137
- authorize resource_name.camelize.constantize
135
+ rescue Pundit::NotAuthorizedError => e
136
+ raise_access_denied(e.record, e.policy)
138
137
  end
139
138
 
140
139
  verify_authorized
@@ -146,6 +146,13 @@ module Glib
146
146
  class TabBar < View
147
147
  color :color
148
148
 
149
+ def buttons(block)
150
+ json.buttons do
151
+ block.call page.menu_builder
152
+ end
153
+ end
154
+
155
+ # Should be deprecated
149
156
  def tabButtons(block)
150
157
  json.tabButtons do
151
158
  block.call page.menu_builder
@@ -25,6 +25,7 @@ json_ui_page json do |page|
25
25
  end
26
26
 
27
27
  reload_counter = params[:reload_counter].to_i
28
+ reload_counter = 0 if reload_counter > 5
28
29
  template.thumbnail title: "windows/reload with URL (counter: #{reload_counter})", onClick: ->(action) do
29
30
  action.windows_reload url: json_ui_garage_url(path: 'actions/index', reload_counter: reload_counter + 1)
30
31
  end
@@ -3,17 +3,20 @@ module Glib
3
3
  class WindowsOpen < ActionCrawler
4
4
  def initialize http, args, controller
5
5
  @http = http
6
- json = @http.get args['url'], controller
6
+ if (url = args['url'])
7
+ json = @http.get url, controller
7
8
 
8
- unless json.nil?
9
- crawl json['header']&.[]('childViews')
10
- crawl json['body']&.[]('childViews')
11
- crawl json['footer']&.[]('childViews')
9
+ unless json.nil?
10
+ crawl json['header']&.[]('childViews')
11
+ crawl json['body']&.[]('childViews')
12
+ crawl json['footer']&.[]('childViews')
12
13
 
13
- json['rightNavButtons']&.each do |button|
14
- click button
14
+ json['rightNavButtons']&.each do |button|
15
+ click button
16
+ end
15
17
  end
16
18
  end
19
+
17
20
  end
18
21
  end
19
22
  end
@@ -1,8 +1,8 @@
1
1
  module Glib
2
2
  module JsonCrawler
3
- class Covarage
3
+ class Coverage
4
4
  @@files = []
5
- @@covarage_files = Set.new
5
+ @@coverage_files = Set.new
6
6
 
7
7
  def self.files
8
8
  @@files
@@ -12,8 +12,8 @@ module Glib
12
12
  @@files = files
13
13
  end
14
14
 
15
- def self.covarage_files
16
- @@covarage_files
15
+ def self.coverage_files
16
+ @@coverage_files
17
17
  end
18
18
  end
19
19
  end
@@ -17,7 +17,7 @@ module Glib
17
17
 
18
18
  def self.step(http, args)
19
19
  if controller = http.controller
20
- Glib::JsonCrawler::Covarage.covarage_files.add(http.controller.class.instance_method(http.action_name).source_location.first)
20
+ Glib::JsonCrawler::Coverage.coverage_files.add(http.controller.class.instance_method(http.action_name).source_location.first)
21
21
  end
22
22
 
23
23
  if args.is_a?(Hash) && args['rel'] != 'nofollow'
@@ -31,7 +31,7 @@ module Glib
31
31
  child = case action
32
32
  when 'initiate_navigation'
33
33
  JsonCrawler::NavInitiate.new(http, params, action)
34
- when 'windows/open-v1', 'dialogs/open-v1'
34
+ when 'windows/open-v1', 'dialogs/open-v1', 'windows/reload-v1'
35
35
  JsonCrawler::WindowsOpen.new(http, params, action)
36
36
  # when 'http/delete-v1'
37
37
  # JsonCrawler::ActionHttp.new(:delete, http, params, action)
@@ -1,7 +1,7 @@
1
1
  require_relative './json_crawler/http'
2
2
  require_relative './json_crawler/router'
3
3
  require_relative './json_crawler/action_crawler'
4
- require_relative './json_crawler/covarage'
4
+ require_relative './json_crawler/coverage'
5
5
 
6
6
  require_relative './json_crawler/action_crawlers/nav_initiate'
7
7
  require_relative './json_crawler/action_crawlers/windows_open'
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.52
4
+ version: 0.4.54
5
5
  platform: ruby
6
6
  authors:
7
7
  - ''
@@ -197,7 +197,7 @@ files:
197
197
  - lib/glib/json_crawler/action_crawlers/forms_submit.rb
198
198
  - lib/glib/json_crawler/action_crawlers/nav_initiate.rb
199
199
  - lib/glib/json_crawler/action_crawlers/windows_open.rb
200
- - lib/glib/json_crawler/covarage.rb
200
+ - lib/glib/json_crawler/coverage.rb
201
201
  - lib/glib/json_crawler/http.rb
202
202
  - lib/glib/json_crawler/router.rb
203
203
  - lib/glib/value.rb