egov_utils 0.4.18 → 0.6.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
  SHA256:
3
- metadata.gz: 4d05b59d1557eeeba773ca94b798335640a14fd913677bd1faf8675067b5f5ae
4
- data.tar.gz: 9a6b4617ee0b416cb74dde62adf398962268a5674e95222176e47cfe9f9029ce
3
+ metadata.gz: 2dea4fb2c51dec77f9cf9c497124b654263c6bcca1a6d407b7df8967d2d996ca
4
+ data.tar.gz: b600a26f595cbf04e750fdbfbe54cd68aafbc02187b57af58b0ad47a960e0192
5
5
  SHA512:
6
- metadata.gz: ceb82cc5e6c591af911c1b5792b6a35c44541ba4d1631f0e98331e9a5967e1df2dd6100f1bf964199b04bc833c6ed25766e59448a4dd9c4bd6d2281995f8e9b2
7
- data.tar.gz: a06bb56fa7e3206977b0bed3075a2577a2d02cd51a064f8b9bed84444a5cc2c5530b7ac9b51599859771050814503722d75bec58d635564f59e880272fd6deae
6
+ metadata.gz: 5b8ae83c1052f8a9b8a96959240b7422b304d26981c933ab1a935970780e824e1045931270c9a090e9ce8afd9421e2246fb2ae563ca4a6eaba348f2f6d0302db
7
+ data.tar.gz: fe5c7cf049accc507c2f0caa718fbf10db566942d281b6790e8513d033eeb7c78eef2fc3ee21b98d4021f997a6bc35db2042a8965840e501124338d193c1756c
@@ -1,9 +1,9 @@
1
1
  ActiveSupport::Reloader.to_prepare do
2
2
  begin
3
- require_dependency "#{Rails.application.class.parent_name.underscore}/roles"
3
+ require_dependency "#{Rails.application.class.module_parent_name.underscore}/roles"
4
4
  rescue LoadError => e
5
5
  Rails.logger.warn "!! You have not defined roles."
6
- Rails.logger.warn "!! Please define it in lib/#{Rails.application.class.parent_name.underscore}/roles."
6
+ Rails.logger.warn "!! Please define it in lib/#{Rails.application.class.module_arent_name.underscore}/roles."
7
7
  Rails.logger.warn "!! EgovUtils roles management will not work without it."
8
8
  end
9
9
  end
@@ -3,6 +3,7 @@ require 'request_store_rails'
3
3
 
4
4
  module EgovUtils
5
5
  class User < Principal
6
+ DEFAULT_ROLE = nil
6
7
 
7
8
  has_and_belongs_to_many :groups
8
9
 
@@ -35,9 +36,6 @@ module EgovUtils
35
36
  not_in_group(group).where(provider: nil)
36
37
  }
37
38
 
38
- cattr_accessor :default_role
39
- self.default_role = nil
40
-
41
39
  attribute :generate_password, :boolean, default: false
42
40
 
43
41
  def self.authenticate(login, password, active_only=true)
@@ -129,7 +127,7 @@ module EgovUtils
129
127
  @all_role_names ||= Rails.cache.fetch("#{cache_key}/all_role_names", expires_in: 1.hours) do
130
128
  groups.collect{|g| g.roles}.reduce([], :concat) + roles
131
129
  end
132
- @all_role_names << self.class.default_role if self.class.default_role && !@all_role_names.any?
130
+ @all_role_names << DEFAULT_ROLE if DEFAULT_ROLE && !@all_role_names.any?
133
131
  @all_role_names
134
132
  end
135
133
 
@@ -19,6 +19,14 @@ $ ->
19
19
  item = grid.dataItem(index)
20
20
  $.ajax('<%= polymorphic_path(schema.model) %>/'+item.id+'/edit.js')
21
21
 
22
+ prepareDownload = (format) ->
23
+ return (index) -> downloadRecord(format, index)
24
+
25
+ downloadRecord = (format, index) ->
26
+ grid = $("#<%= grid_id %>").swidget()
27
+ item = grid.dataItem(index)
28
+ window.location.href = '<%= polymorphic_path(schema.model) %>/'+item.id+'.'+format
29
+
22
30
  <% if local_assigns[:detail_for] %>
23
31
  <% detail_col = schema.column(detail_for) %>
24
32
  detailCreated = (evt)->
@@ -95,6 +103,11 @@ $ ->
95
103
  width: 150
96
104
  title: "<%= t('label_actions') %>"
97
105
  buttons: [
106
+ <% if can?(:read, schema.model) %>
107
+ <% local_assigns.fetch(:downloads, {}).each do |format, label| %>
108
+ { cls: 'btn btn-sm btn-secondary', caption: '<%= label %>', click: prepareDownload('<%= format %>') },
109
+ <% end %>
110
+ <% end %>
98
111
  <% if can?(:update, schema.model) %>
99
112
  {cls: 'btn btn-sm btn-primary', caption: '<%= t('label_edit') %>', click: editRecord},
100
113
  <% end %>
@@ -20,7 +20,7 @@ module AzaharaSchemaCurrency
20
20
 
21
21
  def value(record)
22
22
  val = super(record)
23
- val = BigDecimal.new( val.to_s ) unless val.is_a?(BigDecimal)
23
+ val = BigDecimal.new(val.to_s.presence || 0) unless val.is_a?(BigDecimal)
24
24
  val
25
25
  end
26
26
 
@@ -8,7 +8,7 @@ module EgovUtils
8
8
  class AuthSource
9
9
 
10
10
  NETWORK_EXCEPTIONS = [
11
- Net::LDAP::LdapError,
11
+ Net::LDAP::Error,
12
12
  Errno::ECONNABORTED, Errno::ECONNREFUSED, Errno::ECONNRESET,
13
13
  Errno::EHOSTDOWN, Errno::EHOSTUNREACH,
14
14
  SocketError
@@ -338,7 +338,7 @@ module EgovUtils
338
338
  attr_name.collect{|an| get_attr(entry, an).presence }.compact.first.to_s
339
339
  elsif !attr_name.blank?
340
340
  value = entry[attr_name].is_a?(Array) ? entry[attr_name].first : entry[attr_name]
341
- value.to_s.force_encoding('UTF-8')
341
+ value.to_s.dup.force_encoding('UTF-8')
342
342
  end
343
343
  end
344
344
 
@@ -1,3 +1,3 @@
1
1
  module EgovUtils
2
- VERSION = '0.4.18'
2
+ VERSION = '0.6.0'
3
3
  end
metadata CHANGED
@@ -1,29 +1,35 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: egov_utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.18
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ondřej Ezr
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-04-22 00:00:00.000000000 Z
11
+ date: 2021-11-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '5.2'
19
+ version: '5.1'
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '7'
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - "~>"
27
+ - - ">="
25
28
  - !ruby/object:Gem::Version
26
- version: '5.2'
29
+ version: '5.1'
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '7'
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: bcrypt
29
35
  requirement: !ruby/object:Gem::Requirement
@@ -72,14 +78,14 @@ dependencies:
72
78
  requirements:
73
79
  - - "~>"
74
80
  - !ruby/object:Gem::Version
75
- version: '5.0'
81
+ version: '6.0'
76
82
  type: :runtime
77
83
  prerelease: false
78
84
  version_requirements: !ruby/object:Gem::Requirement
79
85
  requirements:
80
86
  - - "~>"
81
87
  - !ruby/object:Gem::Version
82
- version: '5.0'
88
+ version: '6.0'
83
89
  - !ruby/object:Gem::Dependency
84
90
  name: i18n-js
85
91
  requirement: !ruby/object:Gem::Requirement
@@ -156,14 +162,14 @@ dependencies:
156
162
  requirements:
157
163
  - - "~>"
158
164
  - !ruby/object:Gem::Version
159
- version: '2.0'
165
+ version: '3.0'
160
166
  type: :runtime
161
167
  prerelease: false
162
168
  version_requirements: !ruby/object:Gem::Requirement
163
169
  requirements:
164
170
  - - "~>"
165
171
  - !ruby/object:Gem::Version
166
- version: '2.0'
172
+ version: '3.0'
167
173
  - !ruby/object:Gem::Dependency
168
174
  name: money
169
175
  requirement: !ruby/object:Gem::Requirement
@@ -178,6 +184,20 @@ dependencies:
178
184
  - - "~>"
179
185
  - !ruby/object:Gem::Version
180
186
  version: '6.11'
187
+ - !ruby/object:Gem::Dependency
188
+ name: therubyracer
189
+ requirement: !ruby/object:Gem::Requirement
190
+ requirements:
191
+ - - ">="
192
+ - !ruby/object:Gem::Version
193
+ version: '0'
194
+ type: :runtime
195
+ prerelease: false
196
+ version_requirements: !ruby/object:Gem::Requirement
197
+ requirements:
198
+ - - ">="
199
+ - !ruby/object:Gem::Version
200
+ version: '0'
181
201
  - !ruby/object:Gem::Dependency
182
202
  name: request_store_rails
183
203
  requirement: !ruby/object:Gem::Requirement
@@ -352,14 +372,14 @@ dependencies:
352
372
  requirements:
353
373
  - - "~>"
354
374
  - !ruby/object:Gem::Version
355
- version: '0.3'
375
+ version: '0.4'
356
376
  type: :runtime
357
377
  prerelease: false
358
378
  version_requirements: !ruby/object:Gem::Requirement
359
379
  requirements:
360
380
  - - "~>"
361
381
  - !ruby/object:Gem::Version
362
- version: '0.3'
382
+ version: '0.4'
363
383
  - !ruby/object:Gem::Dependency
364
384
  name: egon_gate
365
385
  requirement: !ruby/object:Gem::Requirement
@@ -388,6 +408,62 @@ dependencies:
388
408
  - - "~>"
389
409
  - !ruby/object:Gem::Version
390
410
  version: '1.6'
411
+ - !ruby/object:Gem::Dependency
412
+ name: database_cleaner-active_record
413
+ requirement: !ruby/object:Gem::Requirement
414
+ requirements:
415
+ - - ">="
416
+ - !ruby/object:Gem::Version
417
+ version: '0'
418
+ type: :development
419
+ prerelease: false
420
+ version_requirements: !ruby/object:Gem::Requirement
421
+ requirements:
422
+ - - ">="
423
+ - !ruby/object:Gem::Version
424
+ version: '0'
425
+ - !ruby/object:Gem::Dependency
426
+ name: factory_bot_rails
427
+ requirement: !ruby/object:Gem::Requirement
428
+ requirements:
429
+ - - "~>"
430
+ - !ruby/object:Gem::Version
431
+ version: '4.0'
432
+ type: :development
433
+ prerelease: false
434
+ version_requirements: !ruby/object:Gem::Requirement
435
+ requirements:
436
+ - - "~>"
437
+ - !ruby/object:Gem::Version
438
+ version: '4.0'
439
+ - !ruby/object:Gem::Dependency
440
+ name: rspec-rails
441
+ requirement: !ruby/object:Gem::Requirement
442
+ requirements:
443
+ - - ">="
444
+ - !ruby/object:Gem::Version
445
+ version: '0'
446
+ type: :development
447
+ prerelease: false
448
+ version_requirements: !ruby/object:Gem::Requirement
449
+ requirements:
450
+ - - ">="
451
+ - !ruby/object:Gem::Version
452
+ version: '0'
453
+ - !ruby/object:Gem::Dependency
454
+ name: pry-rails
455
+ requirement: !ruby/object:Gem::Requirement
456
+ requirements:
457
+ - - ">="
458
+ - !ruby/object:Gem::Version
459
+ version: '0'
460
+ type: :development
461
+ prerelease: false
462
+ version_requirements: !ruby/object:Gem::Requirement
463
+ requirements:
464
+ - - ">="
465
+ - !ruby/object:Gem::Version
466
+ version: '0'
391
467
  - !ruby/object:Gem::Dependency
392
468
  name: sqlite3
393
469
  requirement: !ruby/object:Gem::Requirement
@@ -693,7 +769,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
693
769
  - !ruby/object:Gem::Version
694
770
  version: '0'
695
771
  requirements: []
696
- rubygems_version: 3.0.3
772
+ rubygems_version: 3.1.6
697
773
  signing_key:
698
774
  specification_version: 4
699
775
  summary: The eGoverment utilities is set of functionalities to support basic eGoverment