ratchet_design 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/images/ratchet/favicon.ico +0 -0
- data/app/assets/images/ratchet/safari-pinned-tab.svg +1 -0
- data/app/assets/javascripts/ratchet/core.js +2 -0
- data/app/assets/javascripts/ratchet/enhancement/_swap.js +71 -64
- data/app/assets/javascripts/ratchet/enhancement/lightbox.js +256 -0
- data/app/assets/javascripts/ratchet/enhancement/loader.js +4 -4
- data/app/assets/javascripts/ratchet/shim/classlist.js +1 -1
- data/app/assets/javascripts/ratchet/shim/scope.js +94 -0
- data/app/assets/stylesheets/ratchet/_core.scss +2 -1
- data/app/assets/stylesheets/ratchet/base/_button.scss +1 -1
- data/app/assets/stylesheets/ratchet/base/_form.scss +58 -38
- data/app/assets/stylesheets/ratchet/base/_text.scss +8 -8
- data/app/assets/stylesheets/ratchet/enhancement/_lightbox.scss +93 -0
- data/app/assets/stylesheets/ratchet/enhancement/_loader.scss +1 -1
- data/app/assets/stylesheets/ratchet/enhancement/_tooltip.scss +6 -1
- data/app/assets/stylesheets/ratchet/utility/_global.scss +1 -2
- data/app/helpers/ratchet/application_helper.rb +5 -0
- data/app/helpers/ratchet/form_helper.rb +140 -0
- data/app/views/layouts/ratchet/default.html.slim +2 -1
- data/app/views/shared/ratchet/_footer.html.slim +1 -1
- data/lib/ratchet_design/version.rb +1 -1
- data/lib/ratchet_design.rb +1 -0
- data/public/assets/ratchet/core-0.1.8.js +107 -0
- data/public/assets/ratchet/core-0.1.8.js.gz +0 -0
- data/public/assets/ratchet/core-0.1.8.map.json +1 -0
- data/public/assets/ratchet/{fonts-woff-0.1.7.css → fonts-woff-0.1.8.css} +0 -0
- data/public/assets/ratchet/{fonts-woff-0.1.7.css.gz → fonts-woff-0.1.8.css.gz} +0 -0
- data/public/assets/ratchet/{fonts-woff2-0.1.7.css → fonts-woff2-0.1.8.css} +0 -0
- data/public/assets/ratchet/{fonts-woff2-0.1.7.css.gz → fonts-woff2-0.1.8.css.gz} +0 -0
- metadata +42 -10
- data/app/assets/javascripts/ratchet/enhancement/_lightbox.js +0 -93
- data/public/assets/ratchet/core-0.1.7.js +0 -105
- data/public/assets/ratchet/core-0.1.7.js.gz +0 -0
- data/public/assets/ratchet/core-0.1.7.map.json +0 -1
@@ -6,18 +6,25 @@
|
|
6
6
|
* i. Utility
|
7
7
|
* ------------------------------------- */
|
8
8
|
|
9
|
+
// Universal text-based input variable
|
10
|
+
$text-inputs: 'textarea, input[type=url], input[type=tel], input[type=text], input[type=email], input[type=number], input[type=password]';
|
11
|
+
|
9
12
|
// Nested labels
|
10
|
-
@mixin nested-label($size: normal) {
|
13
|
+
@mixin nested-label($size: normal, $spacing: on) {
|
11
14
|
|
12
15
|
// Scoped variables
|
13
16
|
$font-size: if($size == large, 17px, 16px);
|
14
|
-
$margin: if($size == large, 19px, 25px);
|
15
17
|
$padding-y: if($size == large, 12px, 9px);
|
16
18
|
$padding-x: if($size == large, 14px, 12px);
|
19
|
+
$margin: if($size == large, 19px, 25px);
|
17
20
|
$distance: if($size == large, -24px, -22px);
|
18
21
|
$scale: if($size == large, .824, .875);
|
19
22
|
$height: if($size == large, 56px, 50px);
|
20
23
|
|
24
|
+
@if $spacing != on {
|
25
|
+
$margin: 0;
|
26
|
+
}
|
27
|
+
|
21
28
|
// Active state
|
22
29
|
%active {
|
23
30
|
z-index: 2;
|
@@ -32,9 +39,9 @@
|
|
32
39
|
|
33
40
|
// Input labels
|
34
41
|
label {
|
35
|
-
display: flex;
|
36
|
-
width: 100%;
|
37
42
|
padding: 0;
|
43
|
+
clear: both;
|
44
|
+
flex: 1 0 auto;
|
38
45
|
background: $white;
|
39
46
|
font-size: $font-size;
|
40
47
|
margin-bottom: $margin;
|
@@ -42,8 +49,8 @@
|
|
42
49
|
|
43
50
|
// Default active color
|
44
51
|
:not(.valid):not(.invalid) > {
|
45
|
-
|
46
|
-
|
52
|
+
textarea,
|
53
|
+
#{$text-inputs} {
|
47
54
|
&:focus + span,
|
48
55
|
&:active + span {
|
49
56
|
color: darken($aluminum, 10);
|
@@ -53,8 +60,8 @@
|
|
53
60
|
|
54
61
|
// Validated label
|
55
62
|
.valid > {
|
56
|
-
|
57
|
-
|
63
|
+
textarea,
|
64
|
+
#{$text-inputs} {
|
58
65
|
|
59
66
|
// Active state
|
60
67
|
+ span {
|
@@ -69,15 +76,15 @@
|
|
69
76
|
|
70
77
|
// Required active color
|
71
78
|
&:required + span {
|
72
|
-
color: $
|
79
|
+
color: $apple;
|
73
80
|
}
|
74
81
|
}
|
75
82
|
}
|
76
83
|
|
77
84
|
// Invalidated label
|
78
85
|
.invalid > {
|
79
|
-
|
80
|
-
|
86
|
+
textarea,
|
87
|
+
#{$text-inputs} {
|
81
88
|
|
82
89
|
// Active state
|
83
90
|
+ span {
|
@@ -99,6 +106,7 @@
|
|
99
106
|
|
100
107
|
// Select-specific styles
|
101
108
|
select {
|
109
|
+
margin: 0;
|
102
110
|
font-size: $font-size;
|
103
111
|
line-height: inherit;
|
104
112
|
height: $height;
|
@@ -106,18 +114,13 @@
|
|
106
114
|
}
|
107
115
|
|
108
116
|
// Inputs
|
109
|
-
|
110
|
-
|
111
|
-
background: transparent;
|
112
|
-
}
|
113
|
-
|
114
|
-
input,
|
115
|
-
select,
|
116
|
-
textarea {
|
117
|
+
textarea,
|
118
|
+
#{$text-inputs} {
|
117
119
|
z-index: 1;
|
118
120
|
margin: 0;
|
119
121
|
font-size: $font-size;
|
120
122
|
line-height: inherit;
|
123
|
+
background: transparent;
|
121
124
|
padding: $padding-y $padding-x;
|
122
125
|
|
123
126
|
// Faux-placeholder labels
|
@@ -154,8 +157,25 @@
|
|
154
157
|
}
|
155
158
|
}
|
156
159
|
|
160
|
+
// Inline forms
|
161
|
+
@mixin inline-form($size: normal, $gutter: 10px) {
|
162
|
+
@include nested-label($size, off);
|
163
|
+
@include grid;
|
164
|
+
|
165
|
+
// Remove top spacing from submit button
|
166
|
+
> [type=submit] {
|
167
|
+
margin-top: 0;
|
168
|
+
}
|
169
|
+
|
170
|
+
// Leave right margin off last element
|
171
|
+
> :not(:last-child) {
|
172
|
+
margin-right: $gutter;
|
173
|
+
}
|
174
|
+
|
175
|
+
}
|
176
|
+
|
157
177
|
%success-btn {
|
158
|
-
@include button($color: $
|
178
|
+
@include button($color: $apple);
|
159
179
|
}
|
160
180
|
|
161
181
|
/* ===================================== *
|
@@ -304,9 +324,15 @@ select {
|
|
304
324
|
// Radios & checkboxes
|
305
325
|
input[type=radio],
|
306
326
|
input[type=checkbox] {
|
307
|
-
|
327
|
+
position: absolute;
|
328
|
+
opacity: 0;
|
308
329
|
|
309
|
-
+
|
330
|
+
&:focus + .tick-label,
|
331
|
+
&:active + .tick-label {
|
332
|
+
box-shadow: 0 0 0 1px $aluminum inset;
|
333
|
+
}
|
334
|
+
|
335
|
+
+ .tick-label {
|
310
336
|
width: 20px;
|
311
337
|
height: 20px;
|
312
338
|
margin: 0 8px 0 0;
|
@@ -327,11 +353,11 @@ input[type=checkbox] {
|
|
327
353
|
// Radios
|
328
354
|
input[type=radio] {
|
329
355
|
|
330
|
-
+
|
356
|
+
+ .tick-label {
|
331
357
|
border-radius: 50%;
|
332
358
|
}
|
333
359
|
|
334
|
-
&:checked +
|
360
|
+
&:checked + .tick-label {
|
335
361
|
box-shadow: 0 0 0 8px $cerulean inset;
|
336
362
|
}
|
337
363
|
}
|
@@ -339,7 +365,7 @@ input[type=radio] {
|
|
339
365
|
// Checkboxes
|
340
366
|
input[type=checkbox] {
|
341
367
|
|
342
|
-
+
|
368
|
+
+ .tick-label {
|
343
369
|
border-radius: $radius;
|
344
370
|
position: relative;
|
345
371
|
|
@@ -358,11 +384,11 @@ input[type=checkbox] {
|
|
358
384
|
}
|
359
385
|
}
|
360
386
|
|
361
|
-
&:checked +
|
387
|
+
&:checked + .tick-label {
|
362
388
|
box-shadow: 0 0 0 10px $cerulean inset;
|
363
389
|
}
|
364
390
|
|
365
|
-
&:checked +
|
391
|
+
&:checked + .tick-label:before {
|
366
392
|
transform: scale(.5) rotate(-45deg);
|
367
393
|
}
|
368
394
|
}
|
@@ -514,13 +540,7 @@ button[type=submit] {
|
|
514
540
|
* ------------------------------------- */
|
515
541
|
|
516
542
|
// Apply validation styles to inputs & textareas
|
517
|
-
textarea,
|
518
|
-
input[type=url],
|
519
|
-
input[type=tel],
|
520
|
-
input[type=text],
|
521
|
-
input[type=email],
|
522
|
-
input[type=number],
|
523
|
-
input[type=password] {
|
543
|
+
textarea, #{$text-inputs} {
|
524
544
|
|
525
545
|
// Strip default styling
|
526
546
|
&:invalid {
|
@@ -531,13 +551,13 @@ input[type=password] {
|
|
531
551
|
// Apply valid state color to required fields & adjacent labels
|
532
552
|
&.valid:required,
|
533
553
|
.valid &:required {
|
534
|
-
color: $
|
554
|
+
color: $apple;
|
535
555
|
}
|
536
556
|
|
537
557
|
// Apply valid state to required fields
|
538
558
|
&.valid:required,
|
539
559
|
.valid &:required {
|
540
|
-
border-color: $
|
560
|
+
border-color: $apple;
|
541
561
|
}
|
542
562
|
|
543
563
|
// Apply invalid state color to required fields & adjacent labels
|
@@ -555,7 +575,7 @@ input[type=password] {
|
|
555
575
|
// Apply valid state to Chrome’s autofilled fields
|
556
576
|
&.valid:required:-webkit-autofill,
|
557
577
|
.valid &:required:-webkit-autofill {
|
558
|
-
-webkit-text-fill-color: $
|
578
|
+
-webkit-text-fill-color: $apple;
|
559
579
|
}
|
560
580
|
|
561
581
|
// Apply invalid state to Chrome’s autofilled fields
|
@@ -616,4 +636,4 @@ input[type=password] {
|
|
616
636
|
border-color: transparent transparent $punch transparent;
|
617
637
|
}
|
618
638
|
}
|
619
|
-
}
|
639
|
+
}
|
@@ -328,7 +328,7 @@ code,
|
|
328
328
|
kbd,
|
329
329
|
samp {
|
330
330
|
font-family: $mono-font;
|
331
|
-
color: $aluminum;
|
331
|
+
// color: $aluminum;
|
332
332
|
direction: ltr;
|
333
333
|
text-align: left;
|
334
334
|
tab-size: 2;
|
@@ -365,8 +365,8 @@ pre {
|
|
365
365
|
* xi. Syntax highlighting
|
366
366
|
* ------------------------------------- */
|
367
367
|
|
368
|
-
pre[class*=
|
369
|
-
code[class*=
|
368
|
+
pre[class*=lang-],
|
369
|
+
code[class*=lang-] {
|
370
370
|
color: $aluminum;
|
371
371
|
}
|
372
372
|
|
@@ -374,7 +374,7 @@ code[class*=language-] {
|
|
374
374
|
.cm-keyword { color: $bahama; }
|
375
375
|
.cm-atom { color: $lightning; }
|
376
376
|
.cm-number { color: $rose; }
|
377
|
-
.cm-def { color: $
|
377
|
+
.cm-def { color: $apple; }
|
378
378
|
.cm-variable { color: $flush; }
|
379
379
|
.cm-variable-2 { color: $orchid; }
|
380
380
|
.cm-variable-3 { color: $flush; }
|
@@ -382,7 +382,7 @@ code[class*=language-] {
|
|
382
382
|
.cm-operator { color: $nobel; }
|
383
383
|
.cm-comment { color: $nobel; }
|
384
384
|
.cm-string { color: $cerulean; }
|
385
|
-
.cm-string-2 { color: $
|
385
|
+
.cm-string-2 { color: $apple; }
|
386
386
|
.cm-meta { color: $nobel; }
|
387
387
|
.cm-error { color: $punch; }
|
388
388
|
.cm-qualifier { color: $nobel; }
|
@@ -391,7 +391,7 @@ code[class*=language-] {
|
|
391
391
|
.cm-tag { color: $bahama; }
|
392
392
|
.cm-attribute { color: $flush; }
|
393
393
|
.cm-header { color: $cerulean; }
|
394
|
-
.cm-quote { color: $
|
394
|
+
.cm-quote { color: $apple; }
|
395
395
|
.cm-hr { color: $nobel; }
|
396
396
|
.cm-link { color: $orchid; }
|
397
397
|
.cm-qualifier.cm-attribute { color: $flush; }
|
@@ -399,11 +399,11 @@ code[class*=language-] {
|
|
399
399
|
}
|
400
400
|
|
401
401
|
.static-code {
|
402
|
-
.cm-variable { color: $
|
402
|
+
.cm-variable { color: $apple; }
|
403
403
|
}
|
404
404
|
|
405
405
|
.cm-negative { color: $rose; }
|
406
|
-
.cm-positive { color: $
|
406
|
+
.cm-positive { color: $apple; }
|
407
407
|
.cm-header,
|
408
408
|
.cm-strong { }
|
409
409
|
.cm-em { }
|
@@ -0,0 +1,93 @@
|
|
1
|
+
/* ========================================================================== *
|
2
|
+
* Lightbox module
|
3
|
+
* -------------------------------------------------------------------------- */
|
4
|
+
|
5
|
+
/* ===================================== *
|
6
|
+
* a. Common
|
7
|
+
* ------------------------------------- */
|
8
|
+
|
9
|
+
// Main lightbox element
|
10
|
+
.lightbox {
|
11
|
+
@extend %hidden;
|
12
|
+
display: flex;
|
13
|
+
width: 100%;
|
14
|
+
height: 100%;
|
15
|
+
margin: 0;
|
16
|
+
align-items: center;
|
17
|
+
justify-content: center;
|
18
|
+
background: rgba(0, 0, 0, .9);
|
19
|
+
visibility: hidden; // Hidden by default
|
20
|
+
cursor: pointer;
|
21
|
+
|
22
|
+
// Container figure
|
23
|
+
figure {
|
24
|
+
position: relative;
|
25
|
+
margin: 0;
|
26
|
+
}
|
27
|
+
|
28
|
+
// Main image
|
29
|
+
img {
|
30
|
+
max-width: 90vw;
|
31
|
+
max-height: 90vh;
|
32
|
+
cursor: default;
|
33
|
+
visibility: hidden; // Hidden by default
|
34
|
+
|
35
|
+
// Make visible once loaded
|
36
|
+
&.loaded,
|
37
|
+
&.loaded + button {
|
38
|
+
visibility: visible;
|
39
|
+
}
|
40
|
+
}
|
41
|
+
|
42
|
+
// Close button
|
43
|
+
button {
|
44
|
+
position: absolute;
|
45
|
+
margin: 10px 0 0 10px;
|
46
|
+
width: 20px;
|
47
|
+
height: 20px;
|
48
|
+
appearance: none;
|
49
|
+
outline: none;
|
50
|
+
border: 0;
|
51
|
+
visibility: hidden; // Hidden by default
|
52
|
+
background: url("data:image/svg+xml,%3Csvg viewBox='0 0 30 30' xmlns='http://www.w3.org/2000/svg' fill='#FFF'%3E%3Cpath d='M2.663.005c.176.021.349.045.519.095.316.091.613.249.868.455l.184.166 10.765 10.765 10.768-10.768.187-.164c.262-.21.559-.368.882-.46.279-.079.567-.106.856-.089.228.014.456.065.671.143.257.094.498.23.712.401.578.467.922 1.186.925 1.928.001.239-.033.478-.1.707-.093.316-.249.611-.456.867l-.165.184-10.766 10.765 10.768 10.768.165.187c.224.279.388.599.477.947.078.308.097.631.055.946-.041.301-.136.593-.282.859-.113.208-.256.399-.424.566-.152.153-.324.285-.511.393-.584.337-1.296.423-1.945.235-.316-.092-.612-.25-.868-.456l-.183-.166-10.766-10.765-10.768 10.768-.186.165c-.28.224-.599.388-.947.477-.316.08-.646.098-.968.052-.293-.042-.578-.137-.838-.279-.242-.132-.462-.306-.648-.511-.16-.177-.294-.377-.398-.592-.307-.636-.328-1.387-.054-2.039.091-.218.214-.422.362-.606l.166-.183 10.765-10.766-10.765-10.765-.111-.119c-.208-.245-.372-.521-.476-.826-.204-.594-.172-1.259.087-1.832.098-.217.229-.42.385-.601.174-.201.381-.374.61-.51.279-.166.594-.278.916-.323l.353-.025.179.006z'/%3E%3C/svg%3E") 0 0 / 16px 16px no-repeat;
|
53
|
+
}
|
54
|
+
}
|
55
|
+
|
56
|
+
// Active state
|
57
|
+
.lightbox-active {
|
58
|
+
|
59
|
+
// Prevent scrolling
|
60
|
+
overflow: hidden;
|
61
|
+
|
62
|
+
// Reposition lightbox
|
63
|
+
.lightbox {
|
64
|
+
position: fixed;
|
65
|
+
left: 0;
|
66
|
+
top: 0;
|
67
|
+
z-index: 13;
|
68
|
+
visibility: visible; // Shown while active
|
69
|
+
}
|
70
|
+
|
71
|
+
// Default loader state
|
72
|
+
.loader {
|
73
|
+
z-index: 14;
|
74
|
+
}
|
75
|
+
|
76
|
+
// Loader failure state
|
77
|
+
.loader.failure {
|
78
|
+
&:before {
|
79
|
+
border-color: transparent;
|
80
|
+
background: rgba($white, .2)
|
81
|
+
}
|
82
|
+
|
83
|
+
&:after {
|
84
|
+
content: '';
|
85
|
+
background: url("data:image/svg+xml,%3Csvg viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='#FFF' d='M30.51 6.423l5.099-5.099.202-.16c.146-.09.313-.145.485-.16l.129-.004.128.011.126.026c.125.034.243.089.349.163.106.074.198.166.272.272.2.285.254.655.145.984-.041.123-.103.238-.183.339l-.086.096-35.284 35.285-.202.159c-.183.113-.398.171-.614.165-.347-.01-.676-.188-.876-.472l-.122-.227c-.047-.12-.074-.248-.078-.377-.003-.129.016-.258.056-.381.041-.122.103-.237.183-.339l.086-.096 3.989-3.989c-.337-.385-.538-.887-.538-1.424v-22.611c0-1.219.998-2.161 2.161-2.161h24.573zm3.857 26.933h-24.573l1.774-1.773h22.799c.222 0 .388-.166.333-.388v-1.884l-.166-.222-6.429-6.429c-.111-.11-.332-.11-.499 0l-2.937 2.439c-.831.72-2.106.665-2.882-.111l-1.832-1.792 1.295-1.295 1.867 1.812c.111.111.333.111.499 0l2.937-2.383c.832-.72 2.106-.665 2.882.111l5.32 5.32v-18.177l-.031-.158 1.267-1.266c.337.384.538.886.538 1.424v22.611c0 1.219-.998 2.161-2.162 2.161zm-17.556-13.234l-2.561-2.505c-.11-.111-.332-.111-.498 0l-8.202 7.703v5.875l.03.157 11.231-11.23zm1.284-1.284l10.642-10.642h-22.8c-.166 0-.332.166-.332.388v14.243l6.927-6.54c.832-.776 2.162-.776 2.993.056l2.57 2.495zm-8.089-8.465c1.101 0 1.995.894 1.995 1.996 0 1.101-.894 1.995-1.995 1.995s-1.995-.894-1.995-1.995c0-1.102.894-1.996 1.995-1.996z' /%3E%3C/svg%3E") 50% 50% / 28px 28px no-repeat;
|
86
|
+
}
|
87
|
+
}
|
88
|
+
}
|
89
|
+
|
90
|
+
// Inactive anchor links
|
91
|
+
a[data-open-lightbox='inactive'] {
|
92
|
+
cursor: default;
|
93
|
+
}
|
@@ -34,6 +34,7 @@
|
|
34
34
|
content: attr(data-tooltip);
|
35
35
|
color: $white;
|
36
36
|
font-size: 14px;
|
37
|
+
font-weight: 300;
|
37
38
|
line-height: 20px;
|
38
39
|
padding: 10px 12px;
|
39
40
|
max-width: 100vw;
|
@@ -129,7 +130,11 @@ article > p:first-of-type > [data-tooltip] {
|
|
129
130
|
}
|
130
131
|
|
131
132
|
.tooltip-offset {
|
132
|
-
@include tooltip($offset:
|
133
|
+
@include tooltip($offset: 10px);
|
134
|
+
}
|
135
|
+
|
136
|
+
.tooltip-width {
|
137
|
+
@include tooltip($width: 220px);
|
133
138
|
}
|
134
139
|
|
135
140
|
// [data-tooltip] {
|
@@ -19,7 +19,7 @@ $white: #FFFFFF; // White
|
|
19
19
|
// Active colors
|
20
20
|
$bahama: #006690; // Navy
|
21
21
|
$cerulean: #0FA7DB; // Blue
|
22
|
-
$
|
22
|
+
$apple: #3FBE3E; // Green
|
23
23
|
$lightning: #FCB827; // Yellow
|
24
24
|
$flush: #FF7C00; // Orange
|
25
25
|
$punch: #DD3340; // Red
|
@@ -154,7 +154,6 @@ $content-padding: vr(2); // 30px
|
|
154
154
|
@for $i from first($level) through last($level) {
|
155
155
|
#{repeat-string('> *', $i) + ','} {
|
156
156
|
@extend %properties;
|
157
|
-
opacity: 50% !important;
|
158
157
|
}
|
159
158
|
}
|
160
159
|
}
|
@@ -0,0 +1,140 @@
|
|
1
|
+
module Ratchet
|
2
|
+
module FormHelper
|
3
|
+
|
4
|
+
INPUT_OPTIONS = {
|
5
|
+
email: {
|
6
|
+
type: "email",
|
7
|
+
placeholder: "Email address",
|
8
|
+
pattern: "[^@]+@[^@]+\\.[a-zA-Z]{2,}",
|
9
|
+
data: { message: "Please enter a valid email address." }
|
10
|
+
},
|
11
|
+
|
12
|
+
password: {
|
13
|
+
type: "password",
|
14
|
+
placeholder: "Password"
|
15
|
+
},
|
16
|
+
|
17
|
+
text: {
|
18
|
+
type: "text"
|
19
|
+
},
|
20
|
+
|
21
|
+
card_number: {
|
22
|
+
type: "text",
|
23
|
+
required: true,
|
24
|
+
pattern: "[0-9 -]{13,20}",
|
25
|
+
placeholder: "Credit Card Number",
|
26
|
+
data: {
|
27
|
+
stripe: "number",
|
28
|
+
message: "Please enter a valid credit card number."
|
29
|
+
}
|
30
|
+
},
|
31
|
+
|
32
|
+
card_month: {
|
33
|
+
type: "text",
|
34
|
+
required: true,
|
35
|
+
pattern: "0[1-9]|1[012]",
|
36
|
+
placeholder: "MM",
|
37
|
+
data: {
|
38
|
+
stripe: "exp_month",
|
39
|
+
message: "Please enter a valid expiration month."
|
40
|
+
}
|
41
|
+
},
|
42
|
+
|
43
|
+
card_year: {
|
44
|
+
type: "text",
|
45
|
+
required: true,
|
46
|
+
pattern: "[0-9]{4}",
|
47
|
+
placeholder: "YYYY",
|
48
|
+
data: {
|
49
|
+
stripe: "exp_year",
|
50
|
+
message: "Please enter a valid expiration year."
|
51
|
+
}
|
52
|
+
},
|
53
|
+
|
54
|
+
card_cvc: {
|
55
|
+
type: "text",
|
56
|
+
required: true,
|
57
|
+
pattern: "[0-9]{3,4}",
|
58
|
+
data: {
|
59
|
+
stripe: "cvc",
|
60
|
+
message: "Please enter a valid security code."
|
61
|
+
}
|
62
|
+
},
|
63
|
+
|
64
|
+
select_country: {
|
65
|
+
country_options: {
|
66
|
+
include_blank: "Select a country",
|
67
|
+
priority_countries: ["US", "GB", "CA"],
|
68
|
+
},
|
69
|
+
|
70
|
+
html_options: {}
|
71
|
+
}
|
72
|
+
}
|
73
|
+
|
74
|
+
# Country select
|
75
|
+
def select_country_tag(name, options = {}, country_options = {})
|
76
|
+
country_options.reverse_merge! INPUT_OPTIONS[:select_country][:country_options]
|
77
|
+
|
78
|
+
options = INPUT_OPTIONS[:select_country][:html_options].deep_merge options
|
79
|
+
|
80
|
+
content_tag(:label) do
|
81
|
+
country_select :user, :country, country_options, options
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
# Email inputs
|
86
|
+
def email_input_tag(name, value = nil, options = {})
|
87
|
+
base_input_tag(name, value, options, :email)
|
88
|
+
end
|
89
|
+
|
90
|
+
# Passowrd inputs
|
91
|
+
def password_input_tag(name, value = nil, options = {})
|
92
|
+
base_input_tag(name, value, options, :password)
|
93
|
+
end
|
94
|
+
|
95
|
+
def text_input_tag(name, value = nil, options = {})
|
96
|
+
base_input_tag(name, value, options, :text)
|
97
|
+
end
|
98
|
+
|
99
|
+
def card_number_tag(name, value=nil, options={})
|
100
|
+
base_input_tag(name, value, options, :card_number)
|
101
|
+
end
|
102
|
+
|
103
|
+
def card_month_tag(name, value=nil, options={})
|
104
|
+
base_input_tag(name, value, options, :card_month)
|
105
|
+
end
|
106
|
+
|
107
|
+
def card_year_tag(name, value=nil, options={})
|
108
|
+
base_input_tag(name, value, options, :card_year)
|
109
|
+
end
|
110
|
+
|
111
|
+
def card_cvc_tag(name, value=nil, options={})
|
112
|
+
base_input_tag(name, value, options, :card_cvc)
|
113
|
+
end
|
114
|
+
|
115
|
+
private
|
116
|
+
|
117
|
+
def base_input_tag(name, value, options, type)
|
118
|
+
if value.is_a? Hash
|
119
|
+
options = value
|
120
|
+
value = nil
|
121
|
+
end
|
122
|
+
|
123
|
+
options = (INPUT_OPTIONS[type]||{}).deep_merge options
|
124
|
+
|
125
|
+
label = options.delete(:label)
|
126
|
+
tag = text_field_tag(name, value, options)
|
127
|
+
|
128
|
+
if label
|
129
|
+
options[:placeholder] = label
|
130
|
+
|
131
|
+
content_tag(:label) do
|
132
|
+
tag + content_tag(:span) { label }
|
133
|
+
end
|
134
|
+
else
|
135
|
+
tag
|
136
|
+
end
|
137
|
+
|
138
|
+
end
|
139
|
+
end
|
140
|
+
end
|
@@ -1,2 +1,2 @@
|
|
1
1
|
footer role="contentinfo"
|
2
|
-
p © #{Time.now.year}
|
2
|
+
p © #{Time.now.year} #{Site.name}
|