formagic 0.2.6 → 0.2.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (30) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +9 -1
  3. data/app/assets/javascripts/formagic/form.coffee +1 -1
  4. data/app/assets/javascripts/formagic/inputs/checkbox.coffee +1 -1
  5. data/app/assets/javascripts/formagic/inputs/document.coffee +1 -1
  6. data/app/assets/javascripts/formagic/inputs/documents.coffee +1 -1
  7. data/app/assets/javascripts/formagic/inputs/file.coffee +1 -1
  8. data/app/assets/javascripts/formagic/inputs/select.coffee +1 -1
  9. data/app/assets/javascripts/formagic/inputs/string.coffee +2 -3
  10. data/app/assets/stylesheets/formagic/checkbox.scss +14 -6
  11. data/app/assets/stylesheets/formagic/color.scss +10 -8
  12. data/app/assets/stylesheets/formagic/date.scss +38 -17
  13. data/app/assets/stylesheets/formagic/file.scss +62 -21
  14. data/app/assets/stylesheets/formagic/form.scss +70 -24
  15. data/app/assets/stylesheets/formagic/group.scss +20 -10
  16. data/app/assets/stylesheets/formagic/image.scss +14 -13
  17. data/app/assets/stylesheets/formagic/list.scss +71 -27
  18. data/app/assets/stylesheets/formagic/nested-form.scss +73 -18
  19. data/app/assets/stylesheets/formagic/redactor-character.scss +42 -18
  20. data/app/assets/stylesheets/formagic/select.scss +113 -3
  21. data/app/assets/stylesheets/formagic/string.scss +22 -9
  22. data/app/assets/stylesheets/formagic/switch.scss +52 -48
  23. data/app/assets/stylesheets/formagic/text.scss +8 -5
  24. data/app/assets/stylesheets/formagic.scss +64 -3
  25. data/formagic.gemspec +3 -0
  26. data/lib/formagic/version.rb +1 -1
  27. data/lib/formagic.rb +3 -0
  28. metadata +30 -4
  29. data/app/assets/stylesheets/formagic/label.scss +0 -27
  30. data/app/assets/stylesheets/formagic/select2.scss +0 -113
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b8a459d8ffe30f2007d2e6cc0aa170aff335a9c2
4
- data.tar.gz: 906ba6688a0bd46e76ae089812336d35783f73c0
3
+ metadata.gz: 036c8cda2c3d45ac5416ec7dc3814badd8059221
4
+ data.tar.gz: c0a7916829a12c07645d139f35691c73d98cb4b4
5
5
  SHA512:
6
- metadata.gz: 4b2efadf0def205ad9f43c6c76229c8df0937e21cc2eb51d493e174e6e17b86e9dbac1ec7e5648f8c4fed0483c1a22ccf85cb69cd407a2b2115e81ca3286060a
7
- data.tar.gz: 58dd3656525fd1fd488bbf9f173703e9207e50230c1121ae89c5733dd49e3c4db02bf4bb928f11f4e660e6f366c5e8ea79a69396baeb6a4dc810f95a776e8328
6
+ metadata.gz: 2e582b43b830297cc975e26c5275e045a473e2264ae2d8dfb1db98591121575963914a533830069d90e0c5383310806f24a8cec8862b8583fc09d83c44993b26
7
+ data.tar.gz: 6de3953d65e323fb31129519d29fa44aa2707e664bfbef2366e8258b4e6136c37787de21a961088626e5c914c6482a6a10366b47930783dc88220a9c423d06e6
data/Gemfile.lock CHANGED
@@ -1,12 +1,20 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- formagic (0.2.6)
4
+ formagic (0.2.8)
5
+ bourbon (>= 3.2)
6
+ normalize-rails (>= 3.0)
5
7
 
6
8
  GEM
7
9
  remote: http://rubygems.org/
8
10
  specs:
11
+ bourbon (4.2.4)
12
+ sass (~> 3.4)
13
+ thor (~> 0.19)
14
+ normalize-rails (3.0.3)
9
15
  rake (10.4.2)
16
+ sass (3.4.18)
17
+ thor (0.19.1)
10
18
 
11
19
  PLATFORMS
12
20
  ruby
@@ -113,7 +113,7 @@ class @Form
113
113
 
114
114
  inputConfig.label ?= name.titleize()
115
115
  inputConfig.type ?= 'string'
116
- inputConfig.klass ?= 'stacked'
116
+ inputConfig.klass ?= 'form-input'
117
117
  inputConfig.klassName = name
118
118
 
119
119
  inputClass = chr.formInputs[inputConfig.type]
@@ -22,7 +22,7 @@ class @InputCheckbox extends InputString
22
22
  # PRIVATE ===============================================
23
23
 
24
24
  _create_el: ->
25
- @$el =$ "<label for='#{ @name }' class='input-#{ @config.type } input-#{ @config.klass } input-#{ @config.klassName }'>"
25
+ @$el =$ "<label for='#{ @name }' class='form-input input-#{ @config.type } input-#{ @config.klassName }'>"
26
26
 
27
27
 
28
28
  _safe_value: ->
@@ -44,7 +44,7 @@ class @InputDocument
44
44
  # PRIVATE ===============================================
45
45
 
46
46
  _create_el: ->
47
- @$el =$ "<div class='input-stacked nested-forms input-#{ @config.klassName }'>"
47
+ @$el =$ "<div class='form-input nested-forms input-#{ @config.klassName }'>"
48
48
 
49
49
 
50
50
  _add_label: ->
@@ -50,7 +50,7 @@ class @InputForm
50
50
  # PRIVATE ===============================================
51
51
 
52
52
  _create_el: ->
53
- @$el =$ "<div class='input-stacked nested-forms input-#{ @config.klassName }'>"
53
+ @$el =$ "<div class='form-input nested-forms input-#{ @config.klassName }'>"
54
54
 
55
55
 
56
56
  _add_label: ->
@@ -28,7 +28,7 @@ class @InputFile extends InputString
28
28
  # PRIVATE ===============================================
29
29
 
30
30
  _create_el: ->
31
- @$el =$ "<div class='input-#{ @config.type } input-#{ @config.klass } input-#{ @config.klassName }'>"
31
+ @$el =$ "<div class='form-input input-#{ @config.type } input-#{ @config.klassName }'>"
32
32
 
33
33
 
34
34
  _add_input: ->
@@ -15,7 +15,7 @@ class @InputSelect extends InputString
15
15
  # PRIVATE ===============================================
16
16
 
17
17
  _create_el: ->
18
- @$el =$ "<div class='input-#{ @config.type } input-#{ @config.klass } input-#{ @config.klassName }'>"
18
+ @$el =$ "<div class='form-input input-#{ @config.type } input-#{ @config.klassName }'>"
19
19
 
20
20
 
21
21
  _add_input: ->
@@ -46,7 +46,7 @@ class @InputString
46
46
 
47
47
 
48
48
  _create_el: ->
49
- @$el =$ "<label for='#{ @name }' class='input-#{ @config.type } input-#{ @config.klass } input-#{ @config.klassName }'>"
49
+ @$el =$ "<label for='#{ @name }' class='#{ @config.klass } input-#{ @config.type } input-#{ @config.klassName }'>"
50
50
 
51
51
 
52
52
  _add_label: ->
@@ -85,8 +85,7 @@ class @InputString
85
85
 
86
86
 
87
87
  _add_placeholder: ->
88
- if @config.klass in [ 'placeholder', 'stacked' ]
89
- @$input.attr 'placeholder', @config.label
88
+ @$input.attr 'placeholder', @config.type
90
89
 
91
90
  if @config.placeholder
92
91
  @$input.attr 'placeholder', @config.placeholder
@@ -1,8 +1,16 @@
1
- // checkbox
1
+ /* Checkbox Input ----------------------------------------- */
2
2
 
3
- .form {
4
- .input-checkbox { padding: .8em 1em 1em;
5
- input { display: inline; width: auto; margin-right: .5em; }
6
- .label { display: inline; cursor: pointer; }
3
+ .input-checkbox {
4
+ padding : .8em 1em 1em;
5
+
6
+ input {
7
+ margin-right : .5em;
8
+ display : inline;
9
+ width : auto;
10
+ }
11
+
12
+ .label {
13
+ display : inline;
14
+ cursor : pointer;
7
15
  }
8
- }
16
+ }
@@ -1,12 +1,14 @@
1
- // color
1
+ /* Color Input -------------------------------------------- */
2
2
 
3
- .form {
4
- .input-color {
5
- position: relative; padding-left: 4.75em;
3
+ .input-color {
4
+ @include position(relative);
5
+ padding-left : 4.75em;
6
6
 
7
- .preview {
8
- @include position(absolute, .65em null null 1em);
9
- width: 50px; height: 50px; border-radius: 4px; background-color: #eee;
10
- }
7
+ .preview {
8
+ @include position(absolute, .65em null null 1em);
9
+ background-color : #eee;
10
+ border-radius : 4px;
11
+ width : 50px;
12
+ height : 50px;
11
13
  }
12
14
  }
@@ -1,16 +1,33 @@
1
- // date
1
+ // Date Input ---------------------------------------------
2
2
 
3
3
  @import "vendor/datedropper";
4
4
 
5
- .form .input-stacked input.input-datetime-date {
6
- @include position(absolute); width: 7em; opacity: .0; cursor: pointer;
5
+ .form-input input.input-datetime-date {
6
+ @include position(absolute);
7
+ opacity : .0;
8
+ cursor : pointer;
9
+ width : 7em;
7
10
  }
8
11
 
9
- .form .input-stacked input.input-datetime-time { width: auto; display: inline-block; }
12
+ .form-input input.input-datetime-time {
13
+ display : inline-block;
14
+ width : auto;
15
+ }
16
+
17
+ .input-date-label {
18
+ min-width : 7em;
19
+ display : inline-block;
20
+ cursor : pointer;
21
+ }
22
+
23
+ .input-date-label .placeholder {
24
+ color : $formagic-placeholder-color;
25
+ }
10
26
 
11
- .input-date-label { display: inline-block; min-width: 7em; cursor: pointer; }
12
- .input-date-label .placeholder { color: $lightColor; }
13
- .input-timedate-at { color: $stableColor; margin: 0 .25em; }
27
+ .input-timedate-at {
28
+ color : $formagic-base-color;
29
+ margin : 0 .25em;
30
+ }
14
31
 
15
32
  .dd_ .dd_sw_ .dd_nav_.dd_prev_ { background-image: image-url('datedropper/prev.png'); }
16
33
  .dd_ .dd_sw_ .dd_nav_.dd_next_ { background-image: image-url('datedropper/next.png'); }
@@ -18,21 +35,25 @@
18
35
 
19
36
  .dd_ { border: 0; }
20
37
  .dd_:after {
21
- top: -6px!important;
22
- border-left: 1px solid $contrastColor!important;
23
- border-top: 1px solid $contrastColor !important;
38
+ border-left : 1px solid darken($formagic-border-color, 5%)!important;
39
+ border-top : 1px solid darken($formagic-border-color, 5%)!important;
40
+ top : -6px!important;
24
41
  }
25
42
 
26
43
  .dd_ .dd_m_ { font-size: 16px; }
27
- .dd_ .dd_d_ { font-size: 38px; border-color: $neutralColor; }
28
- .dd_ .dd_d_ .dd_sl_ ul li em { color: $stableColor!important; font-size: 13px; bottom: 4px; }
29
- .dd_ .dd_d_ .dd_sl_ ul li.dd_sunday { color: $assertiveColor!important; }
30
- .dd_ .dd_sw_ .dd_sl_ li:hover { background-color: $neutralColor; }
44
+ .dd_ .dd_d_ { font-size: 38px; border-color: $formagic-border-color; }
45
+ .dd_ .dd_d_ .dd_sl_ ul li em { color: lighten($formagic-base-color, 40%)!important; font-size: 13px; bottom: 4px; }
46
+ .dd_ .dd_d_ .dd_sl_ ul li.dd_sunday { color: $formagic-assertive-color!important; }
47
+ .dd_ .dd_sw_ .dd_sl_ li:hover { background-color: $formagic-border-color; }
31
48
 
32
49
  .dd_ .dd_m_ {
33
- border-top-left-radius: 4px!important;
34
- border-top-right-radius: 4px!important;
50
+ border-top-right-radius : 4px!important;
51
+ border-top-left-radius : 4px!important;
35
52
  }
36
53
 
37
54
  .dd_r_ { display: none; }
38
- .dd_ .dd_submit { background-color: $positiveColor!important; }
55
+ .dd_ .dd_submit { background-color: $formagic-positive-color!important; }
56
+
57
+
58
+
59
+
@@ -1,36 +1,77 @@
1
- // file
1
+ /* File Input --------------------------------------------- */
2
2
 
3
- .form {
3
+ .input-file {
4
+ min-height : 102px;
4
5
 
5
- // calculated based on image thumbnail size
6
+ a {
7
+ @include ellipsis;
8
+ color : $formagic-positive-color;
6
9
 
7
- .input-file { min-height: 102px;
10
+ &:hover {
11
+ text-decoration : underline;
12
+ }
13
+ }
8
14
 
9
- a { color: $positiveColor; @include truncate; }
10
- a:hover { text-decoration: underline; }
15
+ input[type=file] {
16
+ margin-top : .5em;
17
+ margin-left : 1.75em;
18
+ }
11
19
 
12
- input[type=file] { margin-top: .5em; margin-left: 1.75em; }
13
- input[type=checkbox] { display: inline; width: auto; margin-right: .5em; margin-left: 1em; }
14
- label { display: inline; font-size: .8em; }
20
+ input[type=checkbox] {
21
+ margin-right : .5em;
22
+ margin-left : 1em;
23
+ display : inline;
24
+ width : auto;
25
+ }
15
26
 
16
- &.empty {
17
- img, a, label, input[type=checkbox] { @include hide; }
18
- input[type=file] { margin-top: .2em; }
19
- }
27
+ label {
28
+ font-size : .8em;
29
+ display : inline;
20
30
  }
21
31
 
22
- .input-file-clear {
23
- display: inline-block; width: 1.5em; height: 1.5em; background-color: rgba(0,0,0,.05);
24
- @include position(absolute); border-radius: 1em; margin-top: -22px;
25
- &:before { content: '\00d7'; color: $stableColor; line-height: 1.35em; @include position(absolute, null 7px null null); }
26
- &:hover { background-color: $positiveColor; &:before { color: $white; } }
32
+ &.empty {
33
+ img, a, label, input[type=checkbox] {
34
+ display : none;
35
+ }
36
+
37
+ input[type=file] {
38
+ margin-top : .2em;
39
+ }
27
40
  }
28
41
 
29
- .input-file.input-disabled {
42
+ &.input-disabled {
30
43
  min-height : inherit;
31
- input,
32
- label {
44
+
45
+ input, label {
33
46
  display : none;
34
47
  }
35
48
  }
36
49
  }
50
+
51
+ .input-file-clear {
52
+ @include position(absolute);
53
+
54
+ background-color : rgba(0,0,0,.05);
55
+ border-radius : 1em;
56
+ margin-top : -22px;
57
+ display : inline-block;
58
+ width : 1.5em;
59
+ height : 1.5em;
60
+
61
+ &:before {
62
+ @include position(absolute, null 7px null null);
63
+ line-height : 1.35em;
64
+ content : '\00d7';
65
+ color : $formagic-base-color;
66
+ }
67
+
68
+ &:hover {
69
+ background-color: $formagic-positive-color;
70
+
71
+ &:before { color: white; }
72
+ }
73
+ }
74
+
75
+
76
+
77
+
@@ -1,41 +1,87 @@
1
- // form ::: generic components
1
+ // Form (generic components) ------------------------------ */
2
2
 
3
- .form {
3
+ // General
4
+ .form-input {
5
+ @include position(relative);
6
+ @include bottom-border($formagic-border-color);
4
7
 
5
- // General
8
+ padding : .5em 1em .9em;
9
+ display : block;
6
10
 
7
- .input-stacked {
8
- @include position(relative); padding: .5em 1em .9em;
9
- @include bottom-border($neutralColor); &:last-child { @include no-bottom-border; }
11
+ &:last-child { @include no-bottom-border; }
10
12
 
11
- textarea, input { width: 100%; @include no-outline; @include placeholder { color: $lightColor; } }
13
+ textarea, input {
14
+ @include no-outline;
15
+ @include placeholder { color: $formagic-placeholder-color; }
16
+ width : 100%;
17
+ }
12
18
 
13
- .label { display: block; line-height: 1.8; color: $stableColor; }
19
+ .label {
20
+ line-height : 1.8;
21
+ display : block;
22
+ color : $formagic-label-color;
14
23
  }
24
+ }
15
25
 
16
- // Validation error
26
+ // Validation error
27
+ .error-message {
28
+ margin-left : .5em;
29
+ font-size : .8em;
30
+ color : $formagic-assertive-color;
31
+ }
17
32
 
18
- .error-message { color: $assertiveColor; font-size: .8em; margin-left: .5em; }
33
+ // Required
34
+ .input-required .label:before {
35
+ @include position(absolute, null null null .38em);
36
+ content : '*';
37
+ color : $formagic-assertive-color;
38
+ }
19
39
 
20
- // Required
40
+ // Disabled
41
+ .input-disabled {
42
+ textarea, input {
43
+ color : lighten($formagic-base-color, 50%);
44
+ }
45
+ }
21
46
 
22
- .input-required .label:before { content: '*'; color: $assertiveColor; @include position(absolute, null null null .38em); }
47
+ // Character counter
48
+ .input-character-counter {
49
+ margin-left : .5em;
50
+ font-size : .8em;
23
51
 
24
- // Disabled
52
+ &.exceeds {
53
+ color : $formagic-assertive-color;
54
+ }
55
+ }
25
56
 
26
- .input-disabled { textarea, input { color: lighten($black, 20%); } }
57
+ // Information box
58
+ .form-information {
59
+ background : $formagic-border-color;
60
+ text-align : center;
61
+ margin : 1em 1em 0;
62
+ padding : 1em;
63
+ }
27
64
 
28
- // Character counter
65
+ // Input Actions used to the right from label
66
+ .input-actions {
67
+ font-size : .8em;
68
+ float : right;
69
+
70
+ a {
71
+ border-radius : 4px;
72
+ padding : .25em .75em;
73
+ margin : 0 0 0 .75em;
74
+ border : 1px solid $formagic-positive-color;
75
+ color : $formagic-positive-color;
76
+ }
77
+
78
+ a:hover {
79
+ background-color : $formagic-positive-color;
80
+ border-color : $formagic-positive-color;
81
+ color : white;
82
+ }
83
+ }
29
84
 
30
- .input-character-counter { font-size: .8em; margin-left: .5em; &.exceeds { color: $assertiveColor; } }
31
85
 
32
- // Information box
33
86
 
34
- .form-information {
35
- margin : 1em 1em 0;
36
- padding : 1em;
37
- background : $neutralColor;
38
- text-align : center;
39
- }
40
87
 
41
- }
@@ -1,22 +1,32 @@
1
- // group
1
+ /* Group (for inputs) ------------------------------------- */
2
2
 
3
- .form {
4
- .group .input-stacked:last-child { @include bottom-border($neutralColor); }
3
+ .group .form-input:last-child {
4
+ @include bottom-border($formagic-border-color);
5
5
  }
6
6
 
7
- // expandable group
7
+ /* Expandable Group --------------------------------------- */
8
8
 
9
- .group-edit { color: $stableColor; font-size: .9em; @include position(absolute, null .5em null null); text-transform: lowercase; margin-top: -1.5em;
10
- &:hover { color: $positiveColor; }
9
+ .group-edit {
10
+ @include position(absolute, null .5em null null);
11
+
12
+ color : $formagic-label-color;
13
+ font-size : .9em;
14
+ text-transform : lowercase;
15
+ margin-top : -1.5em;
16
+
17
+ &:hover {
18
+ color : $formagic-positive-color;
19
+ }
11
20
  }
12
21
 
13
22
  .group-edit:before {
14
- content: '-';
15
- display: block; width: 1em; height: 1em;
16
23
  @include position(absolute, null null null -.75em);
24
+
25
+ content : '-';
26
+ display : block;
27
+ width : 1em;
28
+ height : 1em;
17
29
  }
18
30
 
19
31
  .group-edit.hidden:before { content: '+'; }
20
32
  .group-edit.hidden + .group { display: none; }
21
-
22
-
@@ -1,23 +1,24 @@
1
- // image ::: based on file
1
+ /* Image Input (based on file) ---------------------------- */
2
2
 
3
- .form {
3
+ .input-image {
4
+ @extend .input-file;
4
5
 
5
- .input-image { @extend .input-file; }
6
+ &:not(.empty) {
7
+ @include position(relative);
8
+ padding-left : 6.5em;
6
9
 
7
- .input-image:not(.empty) {
8
- padding-left: 6.5em;
9
- position: relative;
10
10
  img {
11
- position: absolute;
12
- border-radius: 4px;
13
- left: 1em;
14
- top: .8em;
15
- width: 4.7em;
11
+ @include position(absolute, .8em null null 1em);
12
+ border-radius : 4px;
13
+ width : 4.7em;
16
14
  }
17
15
  }
18
16
 
19
- .input-image.input-disabled {
17
+ &.input-disabled {
20
18
  min-height : 102px;
21
19
  }
22
-
23
20
  }
21
+
22
+
23
+
24
+
@@ -1,39 +1,83 @@
1
- // list :: supports reordering + typeahead
1
+ // List (supports reordering + typeahead) ----------------- */
2
2
 
3
- .form {
3
+ .input-list {
4
+ input {
5
+ padding-left : 2em;
6
+ margin-top : .1em;
7
+ }
8
+
9
+ ul {
10
+ line-height : 1.5;
11
+ list-style : none;
12
+ padding : 0;
13
+ margin : 0 0 0 2em;
14
+
15
+ li {
16
+ @include position(relative);
17
+ @include user-select(none);
18
+
19
+ a {
20
+ font-size : .75em;
21
+ color : $formagic-assertive-color;
22
+ }
23
+ }
24
+ }
4
25
 
5
- .input-list {
6
- input { padding-left: 2em; margin-top: .1em; }
7
- ul { line-height: 1.5; margin: 0 0 0 2em; list-style: none; padding: 0; }
8
- ul li { @include user-select(none); position: relative; }
9
- ul li a { color: $assertiveColor; font-size: .75em; }
26
+ .slip-reordering {
27
+ color : $formagic-positive-color;
28
+ }
10
29
 
11
- .slip-reordering { color: $positiveColor; }
30
+ .icon-reorder {
31
+ height : 25px;
32
+ width : 25px;
33
+ left : -1.75em;
12
34
 
13
- .icon-reorder {
14
- width: 25px;
15
- height: 25px;
16
- left: -1.75em;
17
- &:before { left: 0; top: 9px; }
18
- &:after { left: 0; top: 14px; }
35
+ &:before {
36
+ left : 0;
37
+ top : 9px;
19
38
  }
20
39
 
21
- .twitter-typeahead { width: 100%; }
22
- .twitter-typeahead:after {
23
- content: '+';
24
- display: block;
25
- width: 40px;
26
- height: 24px;
27
- position: absolute; left: 12px; top: -3px;
28
- font-size: 22px;
29
- color: $contrastColor;
40
+ &:after {
41
+ left : 0;
42
+ top : 14px;
30
43
  }
44
+ }
31
45
 
32
- .tt-suggestions { padding: .1em .5em; margin: 0 0 0 1.55em; background: rgba(255,255,255, .95); }
33
- .tt-suggestion { cursor: pointer; opacity: .5;
34
- p { line-height: 1.5; margin: 0; }
35
- &.tt-cursor { opacity: 1; }
46
+ .twitter-typeahead {
47
+ width: 100%;
48
+
49
+ &:after {
50
+ @include position(absolute, -3px null null 12px);
51
+ font-size : 22px;
52
+ content : '+';
53
+ display : block;
54
+ height : 24px;
55
+ width : 40px;
56
+ color : darken($formagic-border-color, 5%);
36
57
  }
37
58
  }
38
59
 
60
+ .tt-suggestions {
61
+ background : rgba(255,255,255, .95);
62
+ padding : .1em .5em;
63
+ margin : 0 0 0 1.55em;
64
+ }
65
+
66
+ .tt-suggestion {
67
+ opacity : .5;
68
+ cursor : pointer;
69
+
70
+ p {
71
+ line-height : 1.5;
72
+ margin : 0;
73
+ }
74
+
75
+ &.tt-cursor {
76
+ opacity : 1;
77
+ }
78
+ }
39
79
  }
80
+
81
+
82
+
83
+