egov_utils 0.5.2 → 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: 13a545ce7ff400e06685e48d14e4ed4c0c1f6008c5a8f6b4b2bf0ce1e52cd7fb
4
- data.tar.gz: b7978ca45573830dfaa1aa73c674a6d5fdf202d409f6ed650067df7aac954468
3
+ metadata.gz: 2dea4fb2c51dec77f9cf9c497124b654263c6bcca1a6d407b7df8967d2d996ca
4
+ data.tar.gz: b600a26f595cbf04e750fdbfbe54cd68aafbc02187b57af58b0ad47a960e0192
5
5
  SHA512:
6
- metadata.gz: 4aa4036522744c780cba416f3c61c8e5f85c272262b7e06fda785fd5b504383116c9744c3436095749d6549acb04a7b711a82ade62bc93865d1f8fa498a6555e
7
- data.tar.gz: ae91ff4dc19cae2be5718954983ebde5acf6924c3eaa6874b12233fc90698585edf3022b3b96e2247dc43ed48ff8cdd07207adf5dd58323e9533e2dfce5e82e5
6
+ metadata.gz: 5b8ae83c1052f8a9b8a96959240b7422b304d26981c933ab1a935970780e824e1045931270c9a090e9ce8afd9421e2246fb2ae563ca4a6eaba348f2f6d0302db
7
+ data.tar.gz: fe5c7cf049accc507c2f0caa718fbf10db566942d281b6790e8513d033eeb7c78eef2fc3ee21b98d4021f997a6bc35db2042a8965840e501124338d193c1756c
@@ -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 %>
@@ -1,3 +1,3 @@
1
1
  module EgovUtils
2
- VERSION = '0.5.2'
2
+ VERSION = '0.6.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
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.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ondřej Ezr