formagic 0.3.3 → 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1232cfe4348b90ec411f702c7047b5ef9293b73e
4
- data.tar.gz: f4e4defe3db6b66b51c71bfd65c70627b9bf1139
3
+ metadata.gz: aa7cb7f17971ebb1b61ef50c143718be75dea339
4
+ data.tar.gz: 8a5d957fe67c1fe2814755ead538a0bb1a6cd45f
5
5
  SHA512:
6
- metadata.gz: 62ec94089f8b9f6d48c0e91b8314a8aacd1c147b5e1a4d0335dd2e6fc59f7739059e791106d021454c33313c4891a8685c450ed3071a237e30efaa358be6c879
7
- data.tar.gz: 170fc20d96fa30268a7c82599ccdefbf65b58012c2e38fa12821be074d2b15a690abc99eb243a879cc54e6ef3a0076b86b0faaae13d3894eb06ccd3af0e79023
6
+ metadata.gz: 8d2a1265776cf8ce993c42de3922bd28970d247a95bbe9bf4279261a49284ab77778eed58a945f1cb20257fdc18135f5372ed51b4820afab62aadd9c525657fc
7
+ data.tar.gz: 46f52e276d4bb925dad2169e0d47098a19d16c9624743d948701750e9f651ec6a4df797c5ff1cdeee214029d5273d1b777f504f0a14a042a8784161d97750206
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- formagic (0.3.3)
4
+ formagic (0.3.4)
5
5
  bourbon (>= 3.2)
6
6
  normalize-rails (>= 3.0)
7
7
 
@@ -83,6 +83,15 @@ class @Form
83
83
  _generate_inputs_group: (klassName, groupConfig) ->
84
84
  $group =$ """<div class='group #{ klassName }' />"""
85
85
 
86
+ if groupConfig.groupClass
87
+ $group.addClass groupConfig.groupClass
88
+
89
+ if groupConfig.title
90
+ $title =$ "<span class='group-title'>#{ groupConfig.title }</span>"
91
+ $header =$ """<header class='group-header'></header>"""
92
+ $header.append $title
93
+ $group.append $header
94
+
86
95
  if groupConfig.inputs
87
96
  @_build_schema(groupConfig.inputs, $group)
88
97
 
@@ -122,9 +131,14 @@ class @Form
122
131
  inputName = if @config.namePrefix then "#{ @config.namePrefix }[#{ name }]" else "[#{ name }]"
123
132
 
124
133
  # add prefix for nested form inputs
125
- if inputConfig.type == 'form' || inputConfig.type == 'documents' || inputConfig.type == 'document'
134
+ if inputConfig.type == 'form' ||
135
+ inputConfig.type == 'documents' ||
136
+ inputConfig.type == 'document'
126
137
  inputConfig.namePrefix = inputName.replace("[#{ name }]", "[#{ name }_attributes]")
127
138
 
139
+ else if inputConfig.type == 'hash'
140
+ inputConfig.namePrefix = inputName
141
+
128
142
  else
129
143
  inputConfig.namePrefix = @config.namePrefix
130
144
 
@@ -163,7 +177,10 @@ class @Form
163
177
 
164
178
  addNestedForms = (form) ->
165
179
  for name, input of form.inputs
166
- if input.config.type == 'form' || input.config.type == 'documents' || input.config.type == 'document'
180
+ if input.config.type == 'form' ||
181
+ input.config.type == 'documents' ||
182
+ input.config.type == 'document' ||
183
+ input.config.type == 'hash'
167
184
  forms = forms.concat(input.forms)
168
185
  addNestedForms(form) for form in input.forms
169
186
  addNestedForms(@)
@@ -14,6 +14,9 @@
14
14
  #
15
15
  # All items should be unique for now.
16
16
  #
17
+ # Config options:
18
+ # ignoreArrayWithEmptyString - do not show element when value is [""]
19
+ #
17
20
  # Dependencies:
18
21
  #= require formagic/inputs/list_reorder
19
22
  #
@@ -61,6 +64,10 @@ class @InputArray extends InputString
61
64
  _render_items: ->
62
65
  @$items.html('')
63
66
 
67
+ if @config.ignoreArrayWithEmptyString
68
+ if @value.length == 1 && @value[0] == ""
69
+ return
70
+
64
71
  for v in @value
65
72
  @_render_item(v)
66
73
 
@@ -0,0 +1,17 @@
1
+ # -----------------------------------------------------------------------------
2
+ # Author: Alexander Kravets <alex@slatestudio.com>,
3
+ # Slate Studio (http://www.slatestudio.com)
4
+ # -----------------------------------------------------------------------------
5
+
6
+ # -----------------------------------------------------------------------------
7
+ # INPUT HASH
8
+ # -----------------------------------------------------------------------------
9
+ # TODO: add description
10
+ # -----------------------------------------------------------------------------
11
+
12
+ class @InputHash extends InputDocument
13
+
14
+ _create_el: ->
15
+ @$el =$ "<div class='form-input input-hash input-#{ @config.klassName }'>"
16
+
17
+ chr.formInputs['hash'] = InputHash
@@ -19,6 +19,7 @@
19
19
  #= require ./formagic/inputs/time
20
20
  #= require ./formagic/inputs/url
21
21
  #= require ./formagic/inputs/array
22
+ #= require ./formagic/inputs/hash
22
23
 
23
24
  ## OPTIONAL
24
25
  # require ./formagic/inputs/redactor
@@ -2,7 +2,7 @@
2
2
 
3
3
  .input-array {
4
4
  input {
5
- padding-left: 2.5em;
5
+ padding-left: 1em;
6
6
  margin-top: .25em;
7
7
  }
8
8
 
@@ -33,6 +33,7 @@
33
33
  @include reorder-icon-base();
34
34
  margin-left: -20px;
35
35
  width: 20px;
36
+ color: $formagic-secondary-color;
36
37
  &:hover { color: $formagic-positive-color; }
37
38
  }
38
39
  }
@@ -32,7 +32,7 @@
32
32
 
33
33
  // Required
34
34
  .input-required .label:before {
35
- @include position(absolute, null null null .38em);
35
+ @include position(absolute, null null null .45em);
36
36
  content : '*';
37
37
  color : $formagic-assertive-color;
38
38
  }
@@ -1,11 +1,29 @@
1
1
  /* Group (for inputs) ------------------------------------- */
2
+ .group-panel {
3
+ box-shadow: 0 0 1px rgba(0,0,0,0.15);
4
+ background-color: $white-color;
5
+ margin: 1.5em 0 0;
6
+ }
7
+
8
+ .group-header {
9
+ padding: .75em 1em;
10
+ border-bottom: 1px solid $formagic-border-color;
11
+ }
12
+
13
+ .group-title {
14
+ text-transform: uppercase;
15
+ letter-spacing: 1px;
16
+ font-size: .75em;
17
+ font-weight: $light;
18
+ line-height: 1.5em;
19
+ color: $formagic-label-color;
20
+ }
2
21
 
3
22
  .group .form-input:last-child {
4
23
  @include bottom-border($formagic-border-color);
5
24
  }
6
25
 
7
26
  /* Expandable Group --------------------------------------- */
8
-
9
27
  .group-edit {
10
28
  @include position(absolute, null .5em null null);
11
29
 
@@ -28,6 +28,7 @@
28
28
  margin-right: -30px;
29
29
  line-height: 40px;
30
30
  width: 30px;
31
+ color: $formagic-secondary-color;
31
32
 
32
33
  &:hover {
33
34
  color: $formagic-positive-color;
@@ -5,12 +5,16 @@ input[type="text"]:disabled {
5
5
  background: initial;
6
6
  }
7
7
 
8
- $formagic-base-color : #333 !default;
9
- $formagic-positive-color : rgb( 74,135,238) !default;
10
- $formagic-assertive-color : rgb(239, 78, 58) !default;
11
- $formagic-label-color : lighten($formagic-base-color, 25%);
12
- $formagic-placeholder-color : rgb(210,210,210) !default;
13
- $formagic-border-color : #eee !default;
8
+ $light: 300 !default;
9
+ $white-color: #fff !default;
10
+
11
+ $formagic-base-color: #2e2e2e !default;
12
+ $formagic-secondary-color: rgba($formagic-base-color, .4) !default;
13
+ $formagic-positive-color: #4a87ee !default;
14
+ $formagic-assertive-color: #e32e2e !default;
15
+ $formagic-label-color: lighten($formagic-base-color, 25%);
16
+ $formagic-placeholder-color: rgb(210,210,210) !default;
17
+ $formagic-border-color: #f1f1f1 !default;
14
18
 
15
19
  @mixin custom-scrollbar($color, $bg-color, $radius) {
16
20
  &::-webkit-scrollbar { width: 6px; background-color: $bg-color; }
@@ -1,3 +1,3 @@
1
1
  module Formagic
2
- VERSION = "0.3.3"
2
+ VERSION = "0.3.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: formagic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Kravets
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-11-26 00:00:00.000000000 Z
11
+ date: 2015-11-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bourbon
@@ -100,6 +100,7 @@ files:
100
100
  - app/assets/javascripts/formagic/inputs/documents.coffee
101
101
  - app/assets/javascripts/formagic/inputs/documents_reorder.coffee
102
102
  - app/assets/javascripts/formagic/inputs/file.coffee
103
+ - app/assets/javascripts/formagic/inputs/hash.coffee
103
104
  - app/assets/javascripts/formagic/inputs/hidden.coffee
104
105
  - app/assets/javascripts/formagic/inputs/html.coffee
105
106
  - app/assets/javascripts/formagic/inputs/image.coffee