form-jekyll 0.4.1 → 0.4.2

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
  SHA256:
3
- metadata.gz: 97dd4f33155557306f4316bd09c9318f1fb676f8c99354b7a471c90233be97aa
4
- data.tar.gz: 3f60eda698b979bee207915fa4e94a3152d8670f0e4d3b6d83c0f11bb430f90f
3
+ metadata.gz: 1e45546fe7f704b3781861c946e21f369761d572724f1476977df834ccb63b5e
4
+ data.tar.gz: 1bb01c8be4ee7a95d3e2089e7ab0d72210a0f6307fbd426233faf016076a0738
5
5
  SHA512:
6
- metadata.gz: fe672f308a40ef6260ec162c920006ee201d2149c6efb0a5839616058fede6fa51516dcb97bdc69e647b4f553707e180891ba939cf2d2ce1e0c9a1f55d0d8b1a
7
- data.tar.gz: ea94e049f4bd7a2d6fcb1febc10ccb57f69f5a02372a688da5e58437ba7debd3f7ed5b2d6f4f34828b81ab1666dd4fe2d0eaa406c6de121914cca2993f2c38f3
6
+ metadata.gz: eedf2b33692e184c218042aa7d6cdb82e6d635c2fad2f35cb65172772fdabc0a6f80b00e8d030ee22dbef1e67de77ca8e2f557de305e7a1a32c108b5096763b9
7
+ data.tar.gz: 69a48cb0d587dafd55a1802a2c03049e11702c2f9b5674b8d3a6f5f85cfca06bf5f2f44366ea3c0506fd734d32d361c48607a3e51d114766173f215de3d262fc
@@ -0,0 +1,3 @@
1
+ {% if annotation %}
2
+ <div class="field-annotation">{{ annotation | markdownify | improve}}</div>
3
+ {% endif %}
@@ -1,38 +1,47 @@
1
- {% assign address-error = "You need to fill in a complete address." %}
2
-
3
1
  <fieldset class="field-address">
4
2
  <legend>{% include elements/label.html %}</legend>
5
3
 
6
4
  {% if address-fields contains 'street' or address-fields == 'full' %}
7
- <label for="{{ name}}-line1">Address Line 1</label>
8
- <input type="text" id="{{ name}}-line1" {% unless optional %}required="required" data-error="{{ address-error }}"{% endunless %}>
5
+ <div class="form-group">
6
+ <label for="{{ name}}-line1">Address Line 1</label>
7
+ <input type="text" id="{{ name}}-line1" {% unless optional %}required="required"{% endunless %}>
8
+ <p class="help-block with-errors with-errors-inline"></p>
9
+ </div>
9
10
 
10
- <label for="{{ name}}-line2">Address Line 2 {% unless optional %}<span class="optional">(optional)</span>{% endunless %}</label>
11
- <input type="text" id="{{ name }}-line2">
11
+ <div class="form-group">
12
+ <label for="{{ name}}-line2">Address Line 2 {% unless optional %}<span class="optional">(optional)</span>{% endunless %}</label>
13
+ <input type="text" id="{{ name }}-line2">
14
+ <p class="help-block with-errors with-errors-inline"></p>
15
+ </div>
12
16
  {% endif %}
13
17
 
14
18
 
15
19
  {% if address-fields contains 'city' or address-fields == 'full' %}
16
- <label for="{{ name}}-city">City</label>
17
- <input type="text" id="{{ name}}-city" {% unless optional %}required="required" data-error="{{ address-error }}"{% endunless %}>
20
+ <div class="form-group">
21
+ <label for="{{ name}}-city">City</label>
22
+ <input type="text" id="{{ name}}-city" {% unless optional %}required="required" data-error="Please enter a city."{% endunless %}>
23
+ <p class="help-block with-errors with-errors-inline"></p>
24
+ </div>
18
25
  {% endif %}
19
26
 
20
27
  {% if address-fields contains 'state' or address-fields == 'full' %}
21
- <div class="field-address-state">
28
+ <div class="field-address-state form-group">
22
29
  <label for="{{ name}}-state">State</label>
23
- <select id="{{ name}}-state" {% unless optional %}required="required" data-error="{{ address-error }}"{% endunless %}>
30
+ <select id="{{ name}}-state" {% unless optional %}required="required" data-error="Please choose a state."{% endunless %}>
24
31
  <option value="">Choose a state</option>
25
32
  {% for state in layout.address-states %}
26
33
  <option value="{{ state.value }}">{{ state.text }}</option>
27
34
  {% endfor %}
28
35
  </select>
36
+ <p class="help-block with-errors with-errors-inline"></p>
29
37
  </div>
30
38
  {% endif %}
31
39
 
32
40
  {% if address-fields contains 'zip' or address-fields == 'full' %}
33
- <div class="field-address-zip">
34
- <label for="{{ name}}-zip" {% unless optional %}required="required" data-error="{{ address-error }}"{% endunless %}>ZIP Code</label>
41
+ <div class="field-address-zip form-group">
42
+ <label for="{{ name}}-zip" {% unless optional %}required="required" data-error="Please enter a ZIP code."{% endunless %}>ZIP code</label>
35
43
  <input type="number" id="{{ name}}-zip" maxlength="5" class="length-5">
44
+ <p class="help-block with-errors with-errors-inline"></p>
36
45
  </div>
37
46
  {% endif %}
38
47
 
@@ -0,0 +1,7 @@
1
+ <div class="form-group" data-id="date">
2
+ <label for="{{ name }}" class="control-label">{% include elements/label.html %}</label>
3
+ <div class="field-wrapper">
4
+ <input formtype="d02" class="length-13" id="{{ name}}" name="{{ name }}" type="date" step="any" data-required-error="Please enter a valid date." pattern="\d{4}-\d{2}-\d{2}">
5
+ <p class="help-block with-errors"></p>
6
+ </div>
7
+ </div>
@@ -9,11 +9,13 @@
9
9
  {% assign address-fields = 'full' %}
10
10
  {% endif %}
11
11
 
12
+ {% assign annotation = field.annotation %}
12
13
  {% assign description = field.description %}
13
14
  {% assign error = field.error %}
14
15
  {% assign fields = field.fields %}
15
16
  {% assign group = field.group %}
16
17
  {% assign helptext = field.helptext %}
18
+ {% assign hidden = field.hidden %}
17
19
  {% assign if = field.if %}
18
20
  {% assign label = field.label %}
19
21
  {% assign level = field.level %}
@@ -41,8 +43,18 @@
41
43
  {% include {{ includepath }} %}
42
44
  {% elsif field.type == 'link' %}
43
45
  {% include {{ includepath }} %}
46
+ {% elsif field.type == 'address' %}
47
+ <div class="field-address {% if field.hidden %}field-hidden{% endif %}">
48
+
49
+ {% include elements/annotation.html %}
50
+ {% include {{ includepath }} %}
51
+
52
+ </div>
44
53
  {% else %}
45
- <div class="form-group field-{{ field.type }}">
54
+ <div class="form-group field-{{ field.type }} {% if field.hidden %}field-hidden{% endif %}">
55
+
56
+ {% include elements/annotation.html %}
57
+
46
58
  {% if field.type %}
47
59
  {% include {{ includepath }} %}
48
60
  {% else %}
@@ -20,7 +20,7 @@ layout: base
20
20
  </div>
21
21
 
22
22
  <div class="form-settings">
23
- <h5>Settings</h5>
23
+ <h5>Show&hellip;</h5>
24
24
 
25
25
  <a href="javascript:void(0);" class="form-settings-toggle" title="Toggle settings">
26
26
  <img src="/assets/images/settings-toggle.svg" alt="Toggle settings" />
@@ -29,16 +29,26 @@ layout: base
29
29
 
30
30
  <label class="checkbox">
31
31
  <input type="checkbox" id="settings-all-pages">
32
- <span>Show all pages</span>
32
+ <span>Every page</span>
33
33
  </label>
34
34
 
35
35
  <label class="checkbox">
36
36
  <input type="checkbox" id="settings-all-conditionals">
37
- <span>Show hidden conditionals</span>
37
+ <span>All conditionals</span>
38
+ </label>
39
+
40
+ <label class="checkbox">
41
+ <input type="checkbox" id="settings-all-annotations">
42
+ <span>Annotations</span>
43
+ </label>
44
+
45
+ <label class="checkbox">
46
+ <input type="checkbox" id="settings-show-hidden">
47
+ <span>Hidden fields</span>
38
48
  </label>
39
49
 
40
50
  <label class="checkbox">
41
51
  <input type="checkbox" id="settings-top-nav">
42
- <span>Show navigation on top</span>
52
+ <span>Page navigation on top</span>
43
53
  </label>
44
54
  </div>
data/assets/css/main.scss CHANGED
@@ -694,6 +694,16 @@ h5 {
694
694
  display: inline-block;
695
695
  @include font-smoothing;
696
696
 
697
+ &.with-errors-inline {
698
+ @include fs-small-text;
699
+ padding: 0;
700
+ background: transparent;
701
+ color: $red-4;
702
+ position: relative;
703
+ top: -0.25rem;
704
+ margin: 0 0 1rem;
705
+ }
706
+
697
707
  li {
698
708
  list-style-type: none;
699
709
  }
@@ -758,7 +768,24 @@ h5 {
758
768
  }
759
769
  }
760
770
 
771
+ .field-hidden {
772
+ position: absolute;
773
+ width: 1px;
774
+ height: 1px;
775
+ padding: 0;
776
+ margin: -1px; // Fix for https://github.com/twbs/bootstrap/issues/25686
777
+ overflow: hidden;
778
+ clip: rect(0, 0, 0, 0);
779
+ white-space: nowrap;
780
+ border: 0;
781
+ }
782
+
761
783
  .field-address {
784
+
785
+ .form-group {
786
+ margin-bottom: 0;
787
+ }
788
+
762
789
  label {
763
790
  font-size: (15rem / 17);
764
791
  margin: 0 0 0.25rem;
@@ -135,10 +135,33 @@ $shadow: 0 1px 4px rgba(#000, 0.06);
135
135
  }
136
136
  }
137
137
 
138
+ .field-annotation {
139
+ display: none;
140
+ background: $yellow-1;
141
+ padding: 0.75rem;
142
+ font-size: 0.875rem;
143
+ position: absolute;
144
+ top: 2.5rem;
145
+ left: 0;
146
+ box-shadow: 0 3px 0 $slate-blue;
147
+ border: 1px solid $slate-blue;
148
+ z-index: 20;
149
+ border-radius: 2px;
150
+
151
+ p {
152
+ margin: 0 0 0.25rem;
153
+
154
+ &:last-child {
155
+ margin-bottom: 0;
156
+ }
157
+ }
158
+ }
159
+
160
+
138
161
  // Settings body classes
139
162
 
140
163
  .all-pages {
141
- background: #ddd;
164
+ background: $grey-4;
142
165
 
143
166
  .pagination,
144
167
  .sfgov-alpha-banner,
@@ -154,13 +177,12 @@ $shadow: 0 1px 4px rgba(#000, 0.06);
154
177
  background: #fff;
155
178
  box-shadow: $shadow;
156
179
  padding: $padding;
157
- margin-bottom: 2rem;
180
+ margin: 0.5rem 0.5rem 1.5rem;
158
181
  }
159
182
 
160
183
  div[data-group] {
161
184
  display: none;
162
185
  }
163
-
164
186
  }
165
187
 
166
188
  .all-conditionals {
@@ -169,6 +191,28 @@ $shadow: 0 1px 4px rgba(#000, 0.06);
169
191
  }
170
192
  }
171
193
 
194
+ .all-annotations {
195
+ .form-group,
196
+ .field-address {
197
+ position: relative;
198
+ }
199
+ .field-annotation {
200
+ display: block;
201
+ }
202
+ }
203
+
204
+ .show-hidden .field-hidden {
205
+ position: static;
206
+ width: inherit;
207
+ height: inherit;
208
+ padding: inherit;
209
+ margin: inherit;
210
+ overflow: visible;
211
+ clip: unset;
212
+ white-space: inherit;
213
+ border: inherit;
214
+ }
215
+
172
216
  .nav-on-top {
173
217
  display: none;
174
218
  .top-nav & {
data/assets/js/script.js CHANGED
@@ -33,6 +33,8 @@ $(document).ready(function(){
33
33
 
34
34
  settingInit('all-pages');
35
35
  settingInit('all-conditionals');
36
+ settingInit('all-annotations');
37
+ settingInit('show-hidden');
36
38
  settingInit('top-nav');
37
39
 
38
40
  // Show / hide settings modal
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: form-jekyll
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh Rubenoff
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-30 00:00:00.000000000 Z
11
+ date: 2019-10-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -66,10 +66,12 @@ extensions: []
66
66
  extra_rdoc_files: []
67
67
  files:
68
68
  - README.md
69
+ - _includes/elements/annotation.html
69
70
  - _includes/elements/helptext.html
70
71
  - _includes/elements/label.html
71
72
  - _includes/fields/address.html
72
73
  - _includes/fields/checkbox.html
74
+ - _includes/fields/date.html
73
75
  - _includes/fields/email.html
74
76
  - _includes/fields/file.html
75
77
  - _includes/fields/group.html