egov_utils 0.5.2 → 0.6.3

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: 13a545ce7ff400e06685e48d14e4ed4c0c1f6008c5a8f6b4b2bf0ce1e52cd7fb
4
- data.tar.gz: b7978ca45573830dfaa1aa73c674a6d5fdf202d409f6ed650067df7aac954468
3
+ metadata.gz: 9b19c8d6e9175e5b472c8b821d611c8cf7e3a19ee1dce31d8056b368bb367fec
4
+ data.tar.gz: 5dbcfd93cc21019f96569688aac9023032e9c6900617882b0de4352e87525ce8
5
5
  SHA512:
6
- metadata.gz: 4aa4036522744c780cba416f3c61c8e5f85c272262b7e06fda785fd5b504383116c9744c3436095749d6549acb04a7b711a82ade62bc93865d1f8fa498a6555e
7
- data.tar.gz: ae91ff4dc19cae2be5718954983ebde5acf6924c3eaa6874b12233fc90698585edf3022b3b96e2247dc43ed48ff8cdd07207adf5dd58323e9533e2dfce5e82e5
6
+ metadata.gz: 6fcb6a35215f2dbbb0d5468551d21b492d03ee15a5a885758d8ac340cba4cdfed1c0c3d0f9f03b3b7c7e20c171866147e201c42cd82b8e781fbaba8f76e5be5d
7
+ data.tar.gz: 3570ce94d514b715bb68016264488bb4f3cfc4a65f11d1deed2a347c90c167442cc4368f11a17485db955d6c9d7f06fdf1d00ea19d95e577a9a81c4fb3eeb25b
@@ -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
+ $(event.target).data('id', item.id)
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 <%= "download-button-#{format}" %>', 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 %>
@@ -5,5 +5,9 @@ module AzaharaSchemaCurrency
5
5
  association.name.to_s+'-'+attribute.try(:currency_code_col).to_s
6
6
  end
7
7
 
8
+ def currency_code(entity)
9
+ entity.try(currency_code_col)
10
+ end
11
+
8
12
  end
9
13
  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.presence || 0) unless val.is_a?(BigDecimal)
23
+ val = BigDecimal(val.to_s.presence || 0) unless val.is_a?(BigDecimal)
24
24
  val
25
25
  end
26
26
 
@@ -1,3 +1,3 @@
1
1
  module EgovUtils
2
- VERSION = '0.5.2'
2
+ VERSION = '0.6.3'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: egov_utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.6.3
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: 2021-11-21 00:00:00.000000000 Z
11
+ date: 2021-11-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails