egov_utils 0.2.6 → 0.2.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/helpers/egov_utils/grid_helper.rb +2 -1
- data/app/views/common/_grid.html.coffee +53 -55
- data/lib/egov_utils/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d662d4819604ac94eb10520bbcaf61ae0c5131417c211f340766b026d9243dae
|
4
|
+
data.tar.gz: ee9510ce33f7a049a16412027ee1d966e8f343eda886ba8198b8699e14bbae4b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f150dd50a3326b9879dc35fa0f7fefc0783f90cd74a977604f4207fc0487edd777a923455e9181c2478469ee9c8d780c709c274646681fd7b7fa34018ae8e9c6
|
7
|
+
data.tar.gz: 7e8dfb724d40a94c232d1504a1eb55b759ea0f93c5f367e6e5dbe2f1926b86fa1b810e5917e3a59fefa9335a51658ecb47e099d2c9bc2a4e4393d38c413f0149
|
@@ -5,7 +5,7 @@ module EgovUtils
|
|
5
5
|
case type
|
6
6
|
when 'integer', 'float', 'decimal'
|
7
7
|
'Number'
|
8
|
-
when 'string', 'list', 'love'
|
8
|
+
when 'string', 'text', 'list', 'love'
|
9
9
|
'String'
|
10
10
|
when 'date', 'datetime'
|
11
11
|
'Date'
|
@@ -17,6 +17,7 @@ module EgovUtils
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def field_for_grid(attribute)
|
20
|
+
binding.pry if attribute.type.nil?
|
20
21
|
s = "\'"
|
21
22
|
s << attribute.name
|
22
23
|
s << '\': {path: "'
|
@@ -42,61 +42,59 @@ $ ->
|
|
42
42
|
]
|
43
43
|
<% end %>
|
44
44
|
|
45
|
+
dataSource = new shield.DataSource
|
46
|
+
schema:
|
47
|
+
data: 'entities'
|
48
|
+
total: 'count'
|
49
|
+
fields:
|
50
|
+
<% schema.available_columns.each do |column| %>
|
51
|
+
<%= raw field_for_grid(column) %>
|
52
|
+
<% end %>
|
53
|
+
events:
|
54
|
+
error: (event) ->
|
55
|
+
if event.errorType == 'transport'
|
56
|
+
alert("Write error: " + event.error.statusText )
|
57
|
+
if event.operation == 'save'
|
58
|
+
this.read()
|
59
|
+
else
|
60
|
+
alert( event.errorType + " error: " + event.error )
|
61
|
+
remote:
|
62
|
+
read:
|
63
|
+
type: 'GET'
|
64
|
+
url: '<%= polymorphic_path(schema.model, schema.to_param.merge(additional_params).merge(format: :json)) %>'
|
65
|
+
dataType: 'json'
|
66
|
+
data: (params)->
|
67
|
+
dataObject = $.extend({}, params)
|
68
|
+
dataObject.offset = params.skip if params.skip
|
69
|
+
dataObject.limit = params.take if params.take
|
70
|
+
delete dataObject.skip
|
71
|
+
delete dataObject.take
|
72
|
+
dataObject
|
73
|
+
modify:
|
74
|
+
create: (items, success, error) ->
|
75
|
+
newItem = items[0]
|
76
|
+
$.ajax
|
77
|
+
url: '<%= polymorphic_path(schema.model, format: :json) %>'
|
78
|
+
type: 'POST'
|
79
|
+
dataType: 'json'
|
80
|
+
data: { <%= grid.model_name.name.underscore %>: newItem.data }
|
81
|
+
complete: (xhr) ->
|
82
|
+
if xhr.readyState == 4 and xhr.status == 201
|
83
|
+
newItem.data.id = xhr.responseJSON.id
|
84
|
+
success()
|
85
|
+
return
|
86
|
+
error(xhr)
|
87
|
+
# remove: (items, success, error) ->
|
88
|
+
# $.ajax(
|
89
|
+
# type: "DELETE"
|
90
|
+
# url: "<%= polymorphic_path(schema.model) %>/" + items[0].data.id + '.json'
|
91
|
+
# dataType: 'json'
|
92
|
+
# ).then(success, error)
|
93
|
+
operations: ['sort', 'skip', 'take']
|
94
|
+
|
45
95
|
$('#<%= grid_id %>').shieldGrid({
|
46
96
|
noRecordsText: '<%= t('label_no_records') %>'
|
47
|
-
dataSource:
|
48
|
-
schema:
|
49
|
-
data: 'entities'
|
50
|
-
total: 'count'
|
51
|
-
fields:
|
52
|
-
<% schema.available_columns.each do |column| %>
|
53
|
-
<%= raw field_for_grid(column) %>
|
54
|
-
<% end %>
|
55
|
-
events:
|
56
|
-
error: (event) ->
|
57
|
-
if event.errorType == 'transport'
|
58
|
-
alert("Write error: " + event.error.statusText )
|
59
|
-
if event.operation == 'save'
|
60
|
-
this.read()
|
61
|
-
else
|
62
|
-
alert( event.errorType + " error: " + event.error )
|
63
|
-
remote: {
|
64
|
-
read: {
|
65
|
-
type: 'GET'
|
66
|
-
url: '<%= polymorphic_path(schema.model, schema.to_param.merge(additional_params).merge(format: :json)) %>'
|
67
|
-
dataType: 'json'
|
68
|
-
data: (params)->
|
69
|
-
dataObject = $.extend({}, params)
|
70
|
-
dataObject.offset = params.skip if params.skip
|
71
|
-
dataObject.limit = params.take if params.take
|
72
|
-
delete dataObject.skip
|
73
|
-
delete dataObject.take
|
74
|
-
dataObject
|
75
|
-
}
|
76
|
-
modify: {
|
77
|
-
create: (items, success, error) ->
|
78
|
-
newItem = items[0]
|
79
|
-
$.ajax
|
80
|
-
url: '<%= polymorphic_path(schema.model, format: :json) %>'
|
81
|
-
type: 'POST'
|
82
|
-
dataType: 'json'
|
83
|
-
data: { <%= grid.model_name.name.underscore %>: newItem.data }
|
84
|
-
complete: (xhr) ->
|
85
|
-
if xhr.readyState == 4 and xhr.status == 201
|
86
|
-
newItem.data.id = xhr.responseJSON.id
|
87
|
-
success()
|
88
|
-
return
|
89
|
-
error(xhr)
|
90
|
-
# remove: (items, success, error) ->
|
91
|
-
# $.ajax(
|
92
|
-
# type: "DELETE"
|
93
|
-
# url: "<%= polymorphic_path(schema.model) %>/" + items[0].data.id + '.json'
|
94
|
-
# dataType: 'json'
|
95
|
-
# ).then(success, error)
|
96
|
-
}
|
97
|
-
operations: ['sort', 'skip', 'take']
|
98
|
-
}
|
99
|
-
},
|
97
|
+
dataSource: dataSource,
|
100
98
|
paging:
|
101
99
|
pageSize: <%= page_size %>
|
102
100
|
messages:
|
@@ -112,12 +110,12 @@ $ ->
|
|
112
110
|
<% if can?(:update, schema.model) || can?(:destroy, schema.model) %>
|
113
111
|
{
|
114
112
|
width: 150
|
115
|
-
title: " "
|
113
|
+
title: "<%= t('label_actions') %>"
|
116
114
|
buttons: [
|
117
115
|
<% if can?(:update, schema.model) %>
|
118
116
|
{cls: 'btn btn-sm btn-primary', caption: '<%= t('label_edit') %>', click: editRecord},
|
119
117
|
<% end %>
|
120
|
-
|
118
|
+
<%= additional_grid_edit_buttons(schema) %>
|
121
119
|
# <% if can?(:destroy, schema.model) %>
|
122
120
|
# {commandName: 'delete', caption: '<%= t('label_delete') %>'}
|
123
121
|
# <% end %>
|
data/lib/egov_utils/version.rb
CHANGED
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.2.
|
4
|
+
version: 0.2.7
|
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: 2018-
|
11
|
+
date: 2018-02-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -605,7 +605,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
605
605
|
version: '0'
|
606
606
|
requirements: []
|
607
607
|
rubyforge_project:
|
608
|
-
rubygems_version: 2.7.
|
608
|
+
rubygems_version: 2.7.5
|
609
609
|
signing_key:
|
610
610
|
specification_version: 4
|
611
611
|
summary: The eGoverment utilities is set of functionalities to support basic eGoverment
|