Skip to content

Commit 0124e06

Browse files
author
Refael Ackermann
committed
One step forward, two steps back
Conflicts: assets/css/forms.css example/models/tests.js forms/forms.js lib/forms/widgets.js templates.js views/document.jade
1 parent 9bee3a6 commit 0124e06

File tree

6 files changed

+1619
-265
lines changed

6 files changed

+1619
-265
lines changed

assets/css/forms.css

Lines changed: 56 additions & 120 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,36 @@
1-
.container { width: 1200px; }
2-
.field input, .field textarea { width: 400px; }
3-
.field textarea { height: 100px; }
4-
.nf_fieldset input[type="checkbox"], input[type="radio"] {
1+
input, .form-control { width: 300px; }
2+
input.form-control[type="checkbox"], input.form-control[type="radio"] {
53
width: 1em;
64
}
7-
.nf_fieldset select { min-width: 314px; }
8-
.nf_fieldset input[type="file"] {
5+
select.form-control { min-width: 314px; }
6+
input.form-control[type="file"] {
97
width: 200px;
108
margin-right: 15px;
119
}
12-
.nf_fieldset textarea {
10+
textarea.form-control {
1311
width: 400px;
1412
height: 200px;
1513
}
16-
.nf_fieldset input[type="file"] + input[type=checkbox] {
14+
input[type="file"] + input[type=checkbox] {
1715
margin: 0 10px;
1816
}
1917

20-
.nf_fieldset p.error {
18+
p.error {
2119
width: 100%;
2220
margin: 0 auto 10px auto;
2321
}
2422

25-
.field input, .field select, .field textarea {
26-
margin: 2px 0 10px;
27-
}
28-
29-
30-
3123
/*
3224
clearfix
3325
*/
3426
.field:before,
3527
.field:after {
36-
content: "";
37-
display: table;
28+
content:"";
29+
display:table;
3830
}
39-
.field:after { clear: both; }
40-
.field { zoom: 1; }
41-
/* For IE 6/7 (trigger hasLayout) */
31+
.field:after { clear:both; }
32+
.field { zoom:1; } /* For IE 6/7 (trigger hasLayout) */
33+
4234

4335
/*
4436
field
@@ -48,12 +40,10 @@
4840
}
4941
.field .field_label {
5042
float: left;
51-
width: 100px;
52-
min-height: 30px;
53-
padding: 5px 15px 0 0;
43+
width: 150px; min-height: 30px;
44+
padding: 5px 30px 0 0;
5445
text-align: right;
5546
overflow: hidden;
56-
margin-top: -4px;
5747
}
5848
.field span.error {
5949
/*float: right;*/
@@ -66,18 +56,22 @@
6656
border-radius: 4px;
6757
}
6858

59+
6960
/*
7061
widgets
7162
*/
7263
.nf_widget {
73-
margin: 0 0 10px 115px;
64+
margin: 0 0 10px 180px;
7465
}
7566
.nf_add {
7667
margin-bottom: 10px;
7768
}
7869
.select2-container {
7970
min-width: 314px;
8071
}
72+
.nf_datepicker {
73+
width: 273px;
74+
}
8175
.input-append {
8276
float: left;
8377
}
@@ -90,30 +84,26 @@
9084
top: 35px; left: 20px;
9185
}
9286

87+
88+
9389
/*
9490
fieldset
9591
*/
9692

9793
.nf_fieldset, .nf_listfield_container {
9894
clear: both;
99-
margin: 0 0 15px 115px;
100-
padding: 20px 20px 5px;
101-
-webkit-transition: box-shadow .2s, border .2s;
95+
margin: 0 0 15px 180px;
96+
padding: 20px 15px 5px;
97+
-webkit-transition: box-shadow 200ms, border 200ms;
10298
position: relative;
10399
border: 1px solid #ddd;
104100
border-radius: 3px;
105101
box-shadow: #eee 0 0 5px 0;
106-
min-width: 585px;
107-
}
108-
.nf_listfield_container {
109-
min-height: 30px;
110-
background: white;
111102
}
112103

113104
.nf_fieldset {
114105
box-sizing: border-box;
115106
background: white;
116-
min-height: 30px;
117107
}
118108

119109
.nf_fieldset > div, .nf_listfield_container > div {
@@ -125,51 +115,52 @@
125115
.nf_fieldset > h2,
126116
.nf_listfield_container.closed,
127117
.nf_listfield_container > i,
128-
.nf_listfield_container > label {
118+
.nf_listfield_container > label
119+
{
129120
cursor: pointer;
130121
}
131122
.nf_fieldset.closed:hover,
132-
.nf_listfield_container.closed:hover {
123+
.nf_listfield_container.closed:hover{
133124
box-shadow: #bbb 0 0 6px 0;
134125
}
135-
.nf_fieldset > h2,
136-
.nf_listfield_container > label {
126+
.nf_fieldset > h2,.nf_listfield_container > label {
137127
font-size: 20px;
138128
text-align: right;
139129
width: 150px;
140130
position: absolute;
141-
margin: -21px 0 0 -145px;
142-
white-space: nowrap;
131+
margin: -21px 0 0 -180px;
132+
word-break: break-all;
143133
line-height: 1.5em;
144134
}
145-
.nf_fieldset > h2 {
146-
margin: -20px 0 0 -185px;
147-
}
148-
149135
.nf_fieldset .field {
150-
/*overflow: hidden;*/
136+
overflow: hidden;
151137
}
152-
.nf_fieldset > i, .nf_listfield_container > i {
138+
.nf_fieldset > i,.nf_listfield_container > i {
153139
position: absolute; top: 5px; left: 5px;
154140
}
141+
.nf_fieldset .nf_fieldset .nf_fieldset input,
142+
.nf_fieldset .nf_fieldset .nf_fieldset textarea,
143+
.nf_fieldset .nf_fieldset .nf_fieldset select {
144+
width: 150px;
145+
}
146+
147+
155148

156149
/*
157150
list field
158151
*/
159152
.nf_listfield_container > .field_label {
160153
font-size: 20px;
161154
font-weight: bold;
162-
-moz-user-select: none;
163-
-webkit-user-select: none;
164-
user-select: none;
165-
margin-top: -25px;
166-
margin-left: -135px;
155+
}
156+
.nf_listfield_container > span.error {
157+
display: none;
167158
}
168159
.nf_hidden_template {
169160
display: none;
170161
}
171162
.nf_listfield {
172-
/*margin-top: 4px;*/
163+
margin-top:4px;
173164
}
174165
.nf_listfield ul {
175166
margin: 0;
@@ -178,7 +169,7 @@
178169
display: block;
179170
list-style: none;
180171
margin-bottom: 10px;
181-
padding: 10px 10px 0;
172+
padding: 25px 15px 0 5px;
182173
border: 1px solid #ddd;
183174
background: #F7F7F9;
184175
border-radius: 2px;
@@ -204,25 +195,25 @@
204195
right: 20px;
205196
cursor: move;
206197
}
207-
.nf_listfield_container > .list_summary {
208-
position: static;
209-
font-size: 14px;
210-
margin: -5px 0 0 10px;
211-
text-align: left;
212-
display: inline-block;
198+
.nf_listfield_container > .list_summary{
199+
right: 18px;
200+
top: 20px;
201+
display:none;
213202
}
214-
.nf_listfield_container.closed > .list_summary {
215-
/*height: 30px;*/
203+
.nf_listfield_container.closed > .list_summary{
204+
display:block;
216205
}
217206
/*
218207
Auto Complete
219208
*/
220209
.ui-combobox {
221210
}
211+
222212
.ui-combobox input {
223213
float: left;
224214
padding: 5px;
225215
}
216+
226217
.ui-combobox a {
227218
float: left;
228219
height: 30px;
@@ -239,64 +230,9 @@
239230
margin-bottom: 9px;
240231
}
241232

242-
.subCollection {
233+
.subCollection{
243234
font-size: 20px;
244-
line-height: 30px;
245-
float: left;
246-
clear: left;
247-
}
248-
249-
250-
.field input.file-clear {
251-
width: 1em;
252-
}
253-
254-
.nf_listfield .list_summary {
255-
display: inline;
256-
margin: 1em;
257-
}
258-
259-
.nf_listfield_container.closed {
260-
min-width: 372px;
261-
width: 372px;
262-
min-height: 6px;
263-
}
264-
265-
/* indicates a link to a new window */
266-
a[target='_blank'] {
267-
color: forestgreen;
268-
}
269-
270-
#filters ul.nav-list {
271-
padding: 0;
272-
}
273-
274-
275-
#filters input.literal {
276-
width:140px;
277-
}
278-
279-
.file-link {
280-
margin: 0 5px;
281-
}
282-
283-
.thumb-picker {
284-
border: 1px solid #ddd;
285-
border-radius: 2px;
286-
box-shadow: #eee 0 0 2px 0;
287-
}
288-
289-
290-
.th-medium {
291-
width: 100px;
292-
}
293-
294-
.th-slim {
295-
width: 85px;
296-
text-align: center;
297-
}
298-
299-
.th-superslim {
300-
width: 60px;
301-
text-align: center;
235+
line-height:30px;
236+
float:left;
237+
clear:left;
302238
}

example/models/tests.js

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
var mongoose = require('mongoose'),
2+
Schema = mongoose['Schema'],
3+
ObjectId = Schema.Types.ObjectId;
4+
fWidgets = require('../../forms/widgets');
5+
6+
var s = new Schema({
7+
list: [
8+
{
9+
name: { type: String, required: true },
10+
list: [
11+
{
12+
name: String
13+
}
14+
]
15+
}
16+
],
17+
list_o_list: {
18+
inner_list: [String]
19+
},
20+
ref: { type: ObjectId, ref: 'pages', required: true },
21+
// second_ref: { type: ObjectId, ref: 'users', limit: 500, query: '/__value__/i.test(this.email)', required: true },
22+
string: { type: String, required: true },
23+
date: { type: Date, required: true },
24+
date2: { type: Date, required: true, widget:fWidgets.DateTimeWidget },
25+
time: { type: Schema.Types.Time },
26+
enum: { type: String, enum: ['1', '2', '3'], required: true },
27+
rich_text: { type: Schema.Types.Html, required: true },
28+
text: { type: Schema.Types.Text, required: true },
29+
image: { type: Schema.Types.Picture, required: true },
30+
map: { type: Schema.Types.GeoPoint, required: true },
31+
num: { type: Schema.Types.Integer, required: true },
32+
order: { type: Number, editable: false },
33+
bool: { type: Boolean, 'default': true },
34+
object: {
35+
object: {
36+
object: {
37+
string: { type: String, required: true }
38+
}
39+
}
40+
},
41+
mixed: Schema.Types.Mixed,
42+
spilon_steps: [
43+
{
44+
rewards: {
45+
xp: {type: Schema.Types.Integer, 'default': 0},
46+
cash: {min: {type: Schema.Types.Integer, min: 0, 'default': 0}, max: {type: Schema.Types.Integer, min: 0, 'default': 0}},
47+
tokens: {min: {type: Schema.Types.Integer, min: 0, 'default': 0}, max: {type: Schema.Types.Integer, min: 0, 'default': 0}},
48+
morale: {min: {type: Schema.Types.Integer, min: 0, 'default': 0}, max: {type: Schema.Types.Integer, min: 0, 'default': 0}},
49+
reputation: {min: {type: Schema.Types.Integer, min: 0, 'default': 0}, max: {type: Schema.Types.Integer, min: 0, 'default': 0}},
50+
intimidation: {min: {type: Schema.Types.Integer, min: 0, 'default': 0}, max: {type: Schema.Types.Integer, min: 0, 'default': 0}},
51+
members: {min: {type: Schema.Types.Integer, min: 0, 'default': 0}, max: {type: Schema.Types.Integer, min: 0, 'default': 0}}
52+
},
53+
loot: {
54+
items: [
55+
{item_id: {type: Schema.ObjectId, ref: 'pages', required: true},
56+
amount: {type: Schema.Types.Integer, min: 0, 'default': 0},
57+
percent: {type: Schema.Types.Integer, min: 0, max: 100, 'default': 0},
58+
is_mandatory: {type: Boolean, 'default': false}}
59+
]
60+
},
61+
action_word: {type: String}
62+
}
63+
]
64+
});
65+
66+
module.exports = mongoose.model('tests', s);
67+
module.exports.formage = {
68+
filters: ['ref'],
69+
list: ['string', 'date', 'image']
70+
};

0 commit comments

Comments
 (0)