dta_rapid 0.7.7 → 0.7.8

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: bccb8653f84a0a483f1890d69997c55287818aa3
4
- data.tar.gz: fed916a8d6ef20f88ab063970dfc6819984f6505
3
+ metadata.gz: 11336a899ad7a81ce54d73940ed2dd189fd78aa3
4
+ data.tar.gz: 69104734e42f08bcc46d65c1b93c024f04d73081
5
5
  SHA512:
6
- metadata.gz: f0da781ca767f8fc0bb8ab70d5657a96d1923bc29dd0bb7d45de428222043c7621b934131dc82502b42c24335f597339e1cf1e12d19dc5e4bcac7e223aa0665b
7
- data.tar.gz: 0f64d7f07cd5c1a46f1f5ad194aaff2f2f4dba1bdb8762d06b57d1c5cb6de900de831769c7f04ae2ac1c598ff02d50324e848df4d7d628ad0f0234a21c4a5ad9
6
+ metadata.gz: a487284e237e9504ff0669eec1f2882c5ba61e0c5ac4e3e0fa71e7d8366da992a22a38c1f33a7877d8262263a43c445651adbe1bba2aa4fe4b901b4db3f58658
7
+ data.tar.gz: 9a44d5bb3e84e93c53dcbfa8aabbd1fcb527964c6583203af7f8b9e6726ae2a033aee797577c40b921418711a5823e5d03e05b6656e3e2943d4f28f6ec4b6ac8
@@ -9,6 +9,7 @@
9
9
  {% if include.validation_message %}data-parsley-error-message="{{ include.validation_message }}"{% endif %}
10
10
  {% if include.pattern %}data-parsley-pattern="{{ include.pattern }}"{% endif %}
11
11
  {% if include.past_date %}data-parsley-past-date{% endif %}
12
+ {% if include.parsley_group %}data-parsley-group="{{ include.parsley_group }}"{% endif %}
12
13
  >
13
14
  </p>
14
15
 
@@ -9,18 +9,19 @@
9
9
 
10
10
  <tbody>
11
11
  {% for i in (1..3) %}
12
- <tr class="item-row" data-label="Service Item">
12
+ {% capture group_number %}item-group-{{i}}{% endcapture %}
13
+ <tr class="item-row" data-label="Service Item" data-parsley-item-row="true" data-parsley-validate-if-empty="" >
13
14
  <td data-label="Date">
14
15
  {% include forms/date-field.html
15
- required="true"
16
16
  past_date="true"
17
+ parsley_group=group_number
17
18
  %}
18
19
  </td>
19
20
 
20
21
  <td data-label="Item number">
21
22
  {% include forms/text-field.html
22
23
  pattern="[0-9]*"
23
- required="true"
24
+ parsley_group=group_number
24
25
  %}
25
26
  </td>
26
27
 
@@ -29,7 +30,7 @@
29
30
  pattern="[0-9]*"
30
31
  type="number"
31
32
  step="0.01"
32
- required="true"
33
+ parsley_group=group_number
33
34
  %}
34
35
  </td>
35
36
  </tr>
@@ -54,4 +55,22 @@
54
55
 
55
56
  xhr.send();
56
57
  }
58
+
59
+ document.addEventListener("DOMContentLoaded", function(event) {
60
+ window.Parsley.addValidator('itemRow', {
61
+ validateString: function(value, requirement, instance) {
62
+ var cells = instance.element.querySelectorAll('input');
63
+ var isFilledIn = Array.prototype.some.call(cells, function(cell) { return cell.value ? true : false });
64
+ var group = cells[0].dataset.parsleyGroup;
65
+
66
+ if (isFilledIn) {
67
+ return instance.parent.validate({group: group, force: true});
68
+ }
69
+ return true;
70
+ },
71
+ messages: {
72
+ en: 'Please enter all fields for this row',
73
+ }
74
+ });
75
+ });
57
76
  </script>
@@ -26,6 +26,7 @@
26
26
  {% if include.list %}list="{{ include.list }}"{% endif %}
27
27
  {% if include.pattern %}data-parsley-pattern="{{ include.pattern }}" pattern="{{ include.pattern }}"{% endif %}
28
28
  {% if include.validation_message %}data-parsley-error-message="{{ include.validation_message }}"{% endif %}
29
+ {% if include.parsley_group %}data-parsley-group="{{ include.parsley_group }}"{% endif %}
29
30
  />
30
31
  {% if include.description %}
31
32
  <p class="uikit-text-input__description">{{ include.description }}</p>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dta_rapid
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.7
4
+ version: 0.7.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gareth Rogers
@@ -118,7 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
118
118
  version: '0'
119
119
  requirements: []
120
120
  rubyforge_project:
121
- rubygems_version: 2.6.10
121
+ rubygems_version: 2.6.8
122
122
  signing_key:
123
123
  specification_version: 4
124
124
  summary: Converting the DTA UI kit (see https://github.com/AusDTO/gov-au-ui-kit) into