formagic 0.3.3 → 0.3.4
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 +4 -4
- data/Gemfile.lock +1 -1
- data/app/assets/javascripts/formagic/form.coffee +19 -2
- data/app/assets/javascripts/formagic/inputs/array.coffee +7 -0
- data/app/assets/javascripts/formagic/inputs/hash.coffee +17 -0
- data/app/assets/javascripts/formagic.coffee +1 -0
- data/app/assets/stylesheets/formagic/array.scss +2 -1
- data/app/assets/stylesheets/formagic/form.scss +1 -1
- data/app/assets/stylesheets/formagic/group.scss +19 -1
- data/app/assets/stylesheets/formagic/nested-form.scss +1 -0
- data/app/assets/stylesheets/formagic.scss +10 -6
- data/lib/formagic/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aa7cb7f17971ebb1b61ef50c143718be75dea339
|
4
|
+
data.tar.gz: 8a5d957fe67c1fe2814755ead538a0bb1a6cd45f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8d2a1265776cf8ce993c42de3922bd28970d247a95bbe9bf4279261a49284ab77778eed58a945f1cb20257fdc18135f5372ed51b4820afab62aadd9c525657fc
|
7
|
+
data.tar.gz: 46f52e276d4bb925dad2169e0d47098a19d16c9624743d948701750e9f651ec6a4df797c5ff1cdeee214029d5273d1b777f504f0a14a042a8784161d97750206
|
data/Gemfile.lock
CHANGED
@@ -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' ||
|
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' ||
|
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
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
.input-array {
|
4
4
|
input {
|
5
|
-
padding-left:
|
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
|
}
|
@@ -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
|
|
@@ -5,12 +5,16 @@ input[type="text"]:disabled {
|
|
5
5
|
background: initial;
|
6
6
|
}
|
7
7
|
|
8
|
-
$
|
9
|
-
$
|
10
|
-
|
11
|
-
$formagic-
|
12
|
-
$formagic-
|
13
|
-
$formagic-
|
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; }
|
data/lib/formagic/version.rb
CHANGED
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.
|
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-
|
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
|