ember-easyForm-rails 1.0.0.beta.2

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 3c3dfdae932dcbfb1cf191b184999f83d2d3ab1a
4
+ data.tar.gz: 2f07a0390bbe6c7a44da45cf735c4e47089fd627
5
+ SHA512:
6
+ metadata.gz: edd5a5b8259000078ac9cffe55c73a9d569de4901a093a0f53d42f275ac29354911f7e572e4fcd6282659ebe5bc42d825ab6ff3e09488e6ecbfbc444b00d733f
7
+ data.tar.gz: e42aa4944d3a331e11310ebe5c4f5308cb2b276ceafaecc903376319e784cd24336a7c3c7b8a02c2f6e9908482ffd53e5be0b285dd8f2fef13080dd2f8d2ce6b
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 frederik dudzik
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,25 @@
1
+ # Ember-EasyForm-Rails
2
+
3
+ This is Ember-EasyForm for the rails asset pipeline
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'ember-easyForm-rails'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install ember-easyForm-rails
18
+
19
+ ## Contributing
20
+
21
+ 1. Fork it ( http://github.com/doodzik/ember-easyForm-rails/fork )
22
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
23
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
24
+ 4. Push to the branch (`git push origin my-new-feature`)
25
+ 5. Create new Pull Request
@@ -0,0 +1,8 @@
1
+ require "ember-easyForm-rails/version"
2
+
3
+ module Ember_EasyForm
4
+ module Rails
5
+ class Engine < ::Rails::Engine
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,7 @@
1
+ module Ember
2
+ module EasyForm
3
+ module Rails
4
+ VERSION = "1.0.0.beta.2"
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,751 @@
1
+ // ==========================================================================
2
+ // Project: Ember EasyForm
3
+ // Copyright: Copyright 2013 DockYard, LLC. and contributors.
4
+ // License: Licensed under MIT license (see license.js)
5
+ // ==========================================================================
6
+
7
+
8
+ // Version: 1.0.0.beta.1
9
+
10
+ (function() {
11
+ Ember.EasyForm = Ember.Namespace.create({
12
+ VERSION: '1.0.0.beta.1'
13
+ });
14
+
15
+ })();
16
+
17
+
18
+
19
+ (function() {
20
+ Ember.EasyForm.Config = Ember.Namespace.create({
21
+ _wrappers: {
22
+ 'default': {
23
+ formClass: '',
24
+ fieldErrorClass: 'fieldWithErrors',
25
+ inputClass: 'input',
26
+ errorClass: 'error',
27
+ hintClass: 'hint',
28
+ labelClass: '',
29
+ inputTemplate: 'easyForm/input',
30
+ errorTemplate: 'easyForm/error',
31
+ labelTemplate: 'easyForm/label',
32
+ hintTemplate: 'easyForm/hint'
33
+ }
34
+ },
35
+ modulePrefix: 'appkit',
36
+ _inputTypes: {},
37
+ _templates: {},
38
+ registerWrapper: function(name, wrapper) {
39
+ this._wrappers[name] = Ember.$.extend({}, this._wrappers['default'], wrapper);
40
+ },
41
+ getWrapper: function(name) {
42
+ var wrapper = this._wrappers[name];
43
+ Ember.assert("The wrapper '" + name + "' was not registered.", wrapper);
44
+ return wrapper;
45
+ },
46
+ registerInputType: function(name, type){
47
+ this._inputTypes[name] = type;
48
+ },
49
+ getInputType: function(name) {
50
+ return this._inputTypes[name];
51
+ },
52
+ registerTemplate: function(name, template) {
53
+ this._templates[name] = template;
54
+ },
55
+ getTemplate: function(name) {
56
+ if (typeof requirejs !== 'undefined' && typeof requirejs._eak_seen !== 'undefined' && requirejs._eak_seen[name]) {
57
+ return require(this.modulePrefix + '/templates/' + name, null, null, true);
58
+ } else {
59
+ return Ember.TEMPLATES[name] || this._templates[name];
60
+ }
61
+ }
62
+ });
63
+
64
+ })();
65
+
66
+
67
+
68
+ (function() {
69
+ Ember.Handlebars.registerHelper('error-field', function(property, options) {
70
+ options = Ember.EasyForm.processOptions(property, options);
71
+
72
+ if (options.hash.propertyBinding) {
73
+ options.hash.property = Ember.Handlebars.get(this, options.hash.propertyBinding, options);
74
+ }
75
+ return Ember.Handlebars.helpers.view.call(this, Ember.EasyForm.Error, options);
76
+ });
77
+
78
+ })();
79
+
80
+
81
+
82
+ (function() {
83
+ Ember.Handlebars.registerHelper('form-for', function(object, options) {
84
+ options.data.keywords.formForModelPath = object;
85
+ return Ember.Handlebars.helpers.view.call(this, Ember.EasyForm.Form, options);
86
+ });
87
+
88
+ })();
89
+
90
+
91
+
92
+ (function() {
93
+ Ember.Handlebars.registerHelper('hint-field', function(property, options) {
94
+ options = Ember.EasyForm.processOptions(property, options);
95
+
96
+ if (options.hash.text || options.hash.textBinding) {
97
+ return Ember.Handlebars.helpers.view.call(this, Ember.EasyForm.Hint, options);
98
+ }
99
+ });
100
+
101
+ })();
102
+
103
+
104
+
105
+ (function() {
106
+ Ember.Handlebars.helpers['ember-input'] = Ember.Handlebars.helpers['input'];
107
+
108
+ Ember.Handlebars.registerHelper('input', function(property, options) {
109
+ if (arguments.length === 1) {
110
+ return Ember.Handlebars.helpers['ember-input'].call(this, arguments[0]);
111
+ }
112
+
113
+ options = Ember.EasyForm.processOptions(property, options);
114
+ options.hash.isBlock = !!(options.fn);
115
+ return Ember.Handlebars.helpers.view.call(this, Ember.EasyForm.Input, options);
116
+ });
117
+
118
+ })();
119
+
120
+
121
+
122
+ (function() {
123
+ var get = Ember.get,
124
+ set = Ember.set;
125
+
126
+ Ember.Handlebars.registerHelper('input-field', function(property, options) {
127
+ options = Ember.EasyForm.processOptions(property, options);
128
+
129
+ if (options.hash.propertyBinding) {
130
+ options.hash.property = Ember.Handlebars.get(this, options.hash.propertyBinding, options);
131
+ }
132
+
133
+ if (options.hash.inputOptionsBinding) {
134
+ options.hash.inputOptions = Ember.Handlebars.get(this, options.hash.inputOptionsBinding, options);
135
+ }
136
+
137
+ var modelPath = Ember.Handlebars.get(this, 'formForModelPath', options);
138
+ options.hash.modelPath = modelPath;
139
+
140
+ property = options.hash.property;
141
+
142
+ var modelPropertyPath = function(property) {
143
+ if(!property) { return null; }
144
+
145
+ var startsWithKeyword = !!options.data.keywords[property.split('.')[0]];
146
+
147
+ if (startsWithKeyword) {
148
+ return property;
149
+ }
150
+
151
+ if (modelPath) {
152
+ return modelPath + '.' + property;
153
+ } else {
154
+ return property;
155
+ }
156
+ };
157
+
158
+ options.hash.valueBinding = modelPropertyPath(property);
159
+
160
+ var context = this,
161
+ propertyType = function(property) {
162
+ var constructor = (get(context, 'content') || context).constructor;
163
+
164
+ if (constructor.proto) {
165
+ return Ember.meta(constructor.proto(), false).descs[property];
166
+ } else {
167
+ return null;
168
+ }
169
+ };
170
+
171
+ options.hash.viewName = 'input-field-'+options.data.view.elementId;
172
+
173
+ if (options.hash.inputOptions) {
174
+ var inputOptions = options.hash.inputOptions, optionName;
175
+ for (optionName in inputOptions) {
176
+ if (inputOptions.hasOwnProperty(optionName)) {
177
+ options.hash[optionName] = inputOptions[optionName];
178
+ }
179
+ }
180
+ delete options.hash.inputOptions;
181
+ }
182
+
183
+ if (options.hash.as === 'text') {
184
+ return Ember.Handlebars.helpers.view.call(context, Ember.EasyForm.TextArea, options);
185
+ } else if (options.hash.as === 'select') {
186
+ delete(options.hash.valueBinding);
187
+
188
+ options.hash.contentBinding = modelPropertyPath(options.hash.collection);
189
+ options.hash.selectionBinding = modelPropertyPath(options.hash.selection);
190
+ options.hash.valueBinding = modelPropertyPath(options.hash.value);
191
+
192
+ if (Ember.isNone(options.hash.selectionBinding) && Ember.isNone(options.hash.valueBinding)) {
193
+ options.hash.selectionBinding = modelPropertyPath(property);
194
+ }
195
+
196
+ return Ember.Handlebars.helpers.view.call(context, Ember.EasyForm.Select, options);
197
+ } else if (options.hash.as === 'checkbox') {
198
+ if (Ember.isNone(options.hash.checkedBinding)) {
199
+ options.hash.checkedBinding = modelPropertyPath(property);
200
+ }
201
+
202
+ return Ember.Handlebars.helpers.view.call(context, Ember.EasyForm.Checkbox, options);
203
+ } else {
204
+ if (!options.hash.as) {
205
+ if (property.match(/password/)) {
206
+ options.hash.type = 'password';
207
+ } else if (property.match(/email/)) {
208
+ options.hash.type = 'email';
209
+ } else if (property.match(/url/)) {
210
+ options.hash.type = 'url';
211
+ } else if (property.match(/color/)) {
212
+ options.hash.type = 'color';
213
+ } else if (property.match(/^tel/)) {
214
+ options.hash.type = 'tel';
215
+ } else if (property.match(/search/)) {
216
+ options.hash.type = 'search';
217
+ } else {
218
+ if (propertyType(property) === 'number' || typeof(get(context,property)) === 'number') {
219
+ options.hash.type = 'number';
220
+ } else if (propertyType(property) === 'date' || (!Ember.isNone(get(context,property)) && get(context,property).constructor === Date)) {
221
+ options.hash.type = 'date';
222
+ } else if (propertyType(property) === 'boolean' || (!Ember.isNone(context.get(property)) && get(context,property).constructor === Boolean)) {
223
+ options.hash.checkedBinding = property;
224
+ return Ember.Handlebars.helpers.view.call(context, Ember.EasyForm.Checkbox, options);
225
+ }
226
+ }
227
+ } else {
228
+ var inputType = Ember.EasyForm.Config.getInputType(options.hash.as);
229
+ if (inputType) {
230
+ return Ember.Handlebars.helpers.view.call(context, inputType, options);
231
+ }
232
+
233
+ options.hash.type = options.hash.as;
234
+ }
235
+ return Ember.Handlebars.helpers.view.call(context, Ember.EasyForm.TextField, options);
236
+ }
237
+ });
238
+
239
+ })();
240
+
241
+
242
+
243
+ (function() {
244
+ Ember.Handlebars.registerHelper('label-field', function(property, options) {
245
+ options = Ember.EasyForm.processOptions(property, options);
246
+ options.hash.viewName = 'label-field-'+options.data.view.elementId;
247
+ return Ember.Handlebars.helpers.view.call(this, Ember.EasyForm.Label, options);
248
+ });
249
+
250
+ })();
251
+
252
+
253
+
254
+ (function() {
255
+ Ember.Handlebars.registerHelper('submit', function(value, options) {
256
+ if (typeof(value) === 'object') {
257
+ options = value;
258
+ value = undefined;
259
+ }
260
+ options.hash.context = this;
261
+ options.hash.value = value || 'Submit';
262
+ return (options.hash.as === 'button') ?
263
+ Ember.Handlebars.helpers.view.call(this, Ember.EasyForm.Button, options)
264
+ :
265
+ Ember.Handlebars.helpers.view.call(this, Ember.EasyForm.Submit, options);
266
+ });
267
+
268
+ })();
269
+
270
+
271
+
272
+ (function() {
273
+
274
+ })();
275
+
276
+
277
+
278
+ (function() {
279
+ Ember.EasyForm.BaseView = Ember.View.extend({
280
+ wrapper: function() {
281
+ var wrapperView = this.nearestWithProperty('wrapper');
282
+ if (wrapperView) {
283
+ return wrapperView.get('wrapper');
284
+ } else {
285
+ return 'default';
286
+ }
287
+ }.property(),
288
+ wrapperConfig: function() {
289
+ return Ember.EasyForm.Config.getWrapper(this.get('wrapper'));
290
+ }.property('wrapper'),
291
+ templateForName: function(name) {
292
+ return Ember.EasyForm.Config.getTemplate(name);
293
+ },
294
+ formForModel: function(){
295
+ var formForModelPath = this.get('templateData.keywords.formForModelPath');
296
+
297
+ if (formForModelPath === 'context' || formForModelPath === 'controller' || formForModelPath === 'this') {
298
+ return this.get('context');
299
+ } else if (formForModelPath) {
300
+ return this.get('context.' + formForModelPath);
301
+ } else {
302
+ return this.get('context');
303
+ }
304
+ }.property()
305
+ });
306
+
307
+ })();
308
+
309
+
310
+
311
+ (function() {
312
+ Ember.EasyForm.Checkbox = Ember.Checkbox.extend();
313
+
314
+ })();
315
+
316
+
317
+
318
+ (function() {
319
+ Ember.EasyForm.Error = Ember.EasyForm.BaseView.extend({
320
+ tagName: 'span',
321
+ classNameBindings: ['wrapperConfig.errorClass'],
322
+ init: function() {
323
+ this._super();
324
+ Ember.Binding.from('formForModel.errors.' + this.property).to('errors').connect(this);
325
+ },
326
+ templateName: Ember.computed.oneWay('wrapperConfig.errorTemplate'),
327
+ errorText: Ember.computed.oneWay('errors.firstObject')
328
+ });
329
+
330
+ })();
331
+
332
+
333
+
334
+ (function() {
335
+ Ember.EasyForm.Form = Ember.EasyForm.BaseView.extend({
336
+ tagName: 'form',
337
+ attributeBindings: ['novalidate'],
338
+ classNameBindings: ['wrapperConfig.formClass'],
339
+ novalidate: 'novalidate',
340
+ wrapper: 'default',
341
+ init: function() {
342
+ this._super();
343
+ this.action = this.action || 'submit';
344
+ },
345
+ submit: function(event) {
346
+ var _this = this,
347
+ promise;
348
+
349
+ if (event) {
350
+ event.preventDefault();
351
+ }
352
+
353
+ if (Ember.isNone(this.get('formForModel.validate'))) {
354
+ this.get('controller').send(this.action);
355
+ } else {
356
+ if (!Ember.isNone(this.get('formForModel').validate)) {
357
+ promise = this.get('formForModel').validate();
358
+ } else {
359
+ promise = this.get('formForModel.content').validate();
360
+ }
361
+ promise.then(function() {
362
+ if (_this.get('formForModel.isValid')) {
363
+ _this.get('controller').send(_this.action);
364
+ }
365
+ });
366
+ }
367
+ }
368
+ });
369
+
370
+ })();
371
+
372
+
373
+
374
+ (function() {
375
+ Ember.EasyForm.Hint = Ember.EasyForm.BaseView.extend({
376
+ tagName: 'span',
377
+ classNameBindings: ['wrapperConfig.hintClass'],
378
+ templateName: Ember.computed.oneWay('wrapperConfig.hintTemplate'),
379
+ hintText: Ember.computed.oneWay('text')
380
+ });
381
+
382
+ })();
383
+
384
+
385
+
386
+ (function() {
387
+ Ember.EasyForm.Input = Ember.EasyForm.BaseView.extend({
388
+ init: function() {
389
+ this._super();
390
+ this.classNameBindings.push('showError:' + this.get('wrapperConfig.fieldErrorClass'));
391
+ Ember.defineProperty(this, 'showError', Ember.computed.and('canShowValidationError', 'formForModel.errors.' + this.property + '.firstObject'));
392
+ if (!this.isBlock) {
393
+ this.set('templateName', this.get('wrapperConfig.inputTemplate'));
394
+ }
395
+ },
396
+ setupValidationDependencies: function() {
397
+ var keys = this.get('formForModel._dependentValidationKeys'), key;
398
+ if (keys) {
399
+ for(key in keys) {
400
+ if (keys[key].contains(this.property)) {
401
+ this._keysForValidationDependencies.pushObject(key);
402
+ }
403
+ }
404
+ }
405
+ }.on('init'),
406
+ _keysForValidationDependencies: Ember.A(),
407
+ dependentValidationKeyCanTrigger: false,
408
+ tagName: 'div',
409
+ classNames: ['string'],
410
+ classNameBindings: ['wrapperConfig.inputClass'],
411
+ didInsertElement: function() {
412
+ var name = 'label-field-'+this.elementId,
413
+ label = this.get(name);
414
+ if (!label) { return; }
415
+ this.set(name+'.for', this.get('input-field-'+this.elementId+'.elementId'));
416
+ },
417
+ concatenatedProperties: ['inputOptions', 'bindableInputOptions'],
418
+ inputOptions: ['as', 'collection', 'optionValuePath', 'optionLabelPath', 'selection', 'value', 'multiple', 'name'],
419
+ bindableInputOptions: ['placeholder', 'prompt'],
420
+ defaultOptions: {
421
+ name: function(){
422
+ if (this.property) {
423
+ return this.property;
424
+ }
425
+ }
426
+ },
427
+ inputOptionsValues: function() {
428
+ var options = {}, i, key, keyBinding, value, inputOptions = this.inputOptions, bindableInputOptions = this.bindableInputOptions, defaultOptions = this.defaultOptions;
429
+ for (i = 0; i < inputOptions.length; i++) {
430
+ key = inputOptions[i];
431
+ if (this[key]) {
432
+ if (typeof(this[key]) === 'boolean') {
433
+ this[key] = key;
434
+ }
435
+
436
+ options[key] = this[key];
437
+ }
438
+ }
439
+ for (i = 0; i < bindableInputOptions.length; i++) {
440
+ key = bindableInputOptions[i];
441
+ keyBinding = key + 'Binding';
442
+ if (this[key] || this[keyBinding]) {
443
+ options[keyBinding] = 'view.' + key;
444
+ }
445
+ }
446
+
447
+ for (key in defaultOptions) {
448
+ if (!defaultOptions.hasOwnProperty(key)) { continue; }
449
+ if (options[key]) { continue; }
450
+
451
+ if (value = defaultOptions[key].apply(this)) {
452
+ options[key] = value;
453
+ }
454
+ }
455
+
456
+ return options;
457
+ }.property(),
458
+ focusOut: function() {
459
+ this.set('hasFocusedOut', true);
460
+ this.showValidationError();
461
+ },
462
+ showValidationError: function() {
463
+ if (this.get('hasFocusedOut')) {
464
+ if (Ember.isEmpty(this.get('formForModel.errors.' + this.property))) {
465
+ this.set('canShowValidationError', false);
466
+ } else {
467
+ this.set('canShowValidationError', true);
468
+ }
469
+ }
470
+ },
471
+ input: function() {
472
+ this._keysForValidationDependencies.forEach(function(key) {
473
+ this.get('parentView.childViews').forEach(function(view) {
474
+ if (view.property === key) {
475
+ view.showValidationError();
476
+ }
477
+ }, this);
478
+ }, this);
479
+ }
480
+ });
481
+
482
+ })();
483
+
484
+
485
+
486
+ (function() {
487
+ Ember.EasyForm.Label = Ember.EasyForm.BaseView.extend({
488
+ tagName: 'label',
489
+ attributeBindings: ['for'],
490
+ classNameBindings: ['wrapperConfig.labelClass'],
491
+ labelText: function() {
492
+ return this.get('text') || Ember.EasyForm.humanize(this.get('property'));
493
+ }.property('text', 'property'),
494
+ templateName: Ember.computed.oneWay('wrapperConfig.labelTemplate')
495
+ });
496
+
497
+ })();
498
+
499
+
500
+
501
+ (function() {
502
+ Ember.EasyForm.Select = Ember.Select.extend();
503
+
504
+ })();
505
+
506
+
507
+
508
+ (function() {
509
+ Ember.EasyForm.Submit = Ember.EasyForm.BaseView.extend({
510
+ tagName: 'input',
511
+ attributeBindings: ['type', 'value', 'disabled'],
512
+ type: 'submit',
513
+ disabled: function() {
514
+ return !this.get('formForModel.isValid');
515
+ }.property('formForModel.isValid'),
516
+ init: function() {
517
+ this._super();
518
+ this.set('value', this.value);
519
+ }
520
+ });
521
+
522
+ })();
523
+
524
+
525
+
526
+ (function() {
527
+ Ember.EasyForm.Button = Ember.EasyForm.BaseView.extend({
528
+ tagName: 'button',
529
+ template: Ember.Handlebars.template(function anonymous(Handlebars,depth0,helpers,partials,data) {
530
+ this.compilerInfo = [4,'>= 1.0.0'];
531
+ helpers = this.merge(helpers, Ember.Handlebars.helpers); data = data || {};
532
+ var hashTypes, hashContexts, escapeExpression=this.escapeExpression;
533
+
534
+
535
+ hashTypes = {};
536
+ hashContexts = {};
537
+ data.buffer.push(escapeExpression(helpers._triageMustache.call(depth0, "text", {hash:{},contexts:[depth0],types:["ID"],hashContexts:hashContexts,hashTypes:hashTypes,data:data})));
538
+
539
+ }),
540
+ attributeBindings: ['type', 'disabled'],
541
+ type: 'submit',
542
+ disabled: function() {
543
+ return !this.get('formForModel.isValid');
544
+ }.property('formForModel.isValid'),
545
+ init: function() {
546
+ this._super();
547
+ this.set('formForModel.text', this.value);
548
+ }
549
+ });
550
+
551
+ })();
552
+
553
+
554
+
555
+ (function() {
556
+ Ember.EasyForm.TextArea = Ember.TextArea.extend();
557
+
558
+ })();
559
+
560
+
561
+
562
+ (function() {
563
+ Ember.EasyForm.TextField = Ember.TextField.extend();
564
+
565
+ })();
566
+
567
+
568
+
569
+ (function() {
570
+
571
+ })();
572
+
573
+
574
+
575
+ (function() {
576
+ Ember.EasyForm.Config.registerTemplate('easyForm/error', Ember.Handlebars.template(function anonymous(Handlebars,depth0,helpers,partials,data) {
577
+ this.compilerInfo = [4,'>= 1.0.0'];
578
+ helpers = this.merge(helpers, Ember.Handlebars.helpers); data = data || {};
579
+ var hashTypes, hashContexts, escapeExpression=this.escapeExpression;
580
+
581
+
582
+ hashTypes = {};
583
+ hashContexts = {};
584
+ data.buffer.push(escapeExpression(helpers._triageMustache.call(depth0, "view.errorText", {hash:{},contexts:[depth0],types:["ID"],hashContexts:hashContexts,hashTypes:hashTypes,data:data})));
585
+
586
+ }));
587
+
588
+ })();
589
+
590
+
591
+
592
+ (function() {
593
+ Ember.EasyForm.Config.registerTemplate('easyForm/hint', Ember.Handlebars.template(function anonymous(Handlebars,depth0,helpers,partials,data) {
594
+ this.compilerInfo = [4,'>= 1.0.0'];
595
+ helpers = this.merge(helpers, Ember.Handlebars.helpers); data = data || {};
596
+ var hashTypes, hashContexts, escapeExpression=this.escapeExpression;
597
+
598
+
599
+ hashTypes = {};
600
+ hashContexts = {};
601
+ data.buffer.push(escapeExpression(helpers._triageMustache.call(depth0, "view.hintText", {hash:{},contexts:[depth0],types:["ID"],hashContexts:hashContexts,hashTypes:hashTypes,data:data})));
602
+
603
+ }));
604
+
605
+ })();
606
+
607
+
608
+
609
+ (function() {
610
+ Ember.EasyForm.Config.registerTemplate('easyForm/input', Ember.Handlebars.template(function anonymous(Handlebars,depth0,helpers,partials,data) {
611
+ this.compilerInfo = [4,'>= 1.0.0'];
612
+ helpers = this.merge(helpers, Ember.Handlebars.helpers); data = data || {};
613
+ var buffer = '', stack1, hashContexts, hashTypes, options, helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
614
+
615
+
616
+ hashContexts = {'propertyBinding': depth0,'textBinding': depth0};
617
+ hashTypes = {'propertyBinding': "STRING",'textBinding': "STRING"};
618
+ options = {hash:{
619
+ 'propertyBinding': ("view.property"),
620
+ 'textBinding': ("view.label")
621
+ },contexts:[],types:[],hashContexts:hashContexts,hashTypes:hashTypes,data:data};
622
+ data.buffer.push(escapeExpression(((stack1 = helpers['label-field'] || depth0['label-field']),stack1 ? stack1.call(depth0, options) : helperMissing.call(depth0, "label-field", options))));
623
+ hashTypes = {};
624
+ hashContexts = {};
625
+ options = {hash:{},contexts:[depth0],types:["STRING"],hashContexts:hashContexts,hashTypes:hashTypes,data:data};
626
+ data.buffer.push(escapeExpression(((stack1 = helpers.partial || depth0.partial),stack1 ? stack1.call(depth0, "easyForm/inputControls", options) : helperMissing.call(depth0, "partial", "easyForm/inputControls", options))));
627
+ return buffer;
628
+
629
+ }));
630
+
631
+ })();
632
+
633
+
634
+
635
+ (function() {
636
+ Ember.EasyForm.Config.registerTemplate('easyForm/inputControls', Ember.Handlebars.template(function anonymous(Handlebars,depth0,helpers,partials,data) {
637
+ this.compilerInfo = [4,'>= 1.0.0'];
638
+ helpers = this.merge(helpers, Ember.Handlebars.helpers); data = data || {};
639
+ var buffer = '', stack1, stack2, hashContexts, hashTypes, options, helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, self=this;
640
+
641
+ function program1(depth0,data) {
642
+
643
+ var stack1, hashContexts, hashTypes, options;
644
+ hashContexts = {'propertyBinding': depth0};
645
+ hashTypes = {'propertyBinding': "STRING"};
646
+ options = {hash:{
647
+ 'propertyBinding': ("view.property")
648
+ },contexts:[],types:[],hashContexts:hashContexts,hashTypes:hashTypes,data:data};
649
+ data.buffer.push(escapeExpression(((stack1 = helpers['error-field'] || depth0['error-field']),stack1 ? stack1.call(depth0, options) : helperMissing.call(depth0, "error-field", options))));
650
+ }
651
+
652
+ function program3(depth0,data) {
653
+
654
+ var stack1, hashContexts, hashTypes, options;
655
+ hashContexts = {'propertyBinding': depth0,'textBinding': depth0};
656
+ hashTypes = {'propertyBinding': "STRING",'textBinding': "STRING"};
657
+ options = {hash:{
658
+ 'propertyBinding': ("view.property"),
659
+ 'textBinding': ("view.hint")
660
+ },contexts:[],types:[],hashContexts:hashContexts,hashTypes:hashTypes,data:data};
661
+ data.buffer.push(escapeExpression(((stack1 = helpers['hint-field'] || depth0['hint-field']),stack1 ? stack1.call(depth0, options) : helperMissing.call(depth0, "hint-field", options))));
662
+ }
663
+
664
+ hashContexts = {'propertyBinding': depth0,'inputOptionsBinding': depth0};
665
+ hashTypes = {'propertyBinding': "STRING",'inputOptionsBinding': "STRING"};
666
+ options = {hash:{
667
+ 'propertyBinding': ("view.property"),
668
+ 'inputOptionsBinding': ("view.inputOptionsValues")
669
+ },contexts:[],types:[],hashContexts:hashContexts,hashTypes:hashTypes,data:data};
670
+ data.buffer.push(escapeExpression(((stack1 = helpers['input-field'] || depth0['input-field']),stack1 ? stack1.call(depth0, options) : helperMissing.call(depth0, "input-field", options))));
671
+ hashTypes = {};
672
+ hashContexts = {};
673
+ stack2 = helpers['if'].call(depth0, "view.showError", {hash:{},inverse:self.noop,fn:self.program(1, program1, data),contexts:[depth0],types:["ID"],hashContexts:hashContexts,hashTypes:hashTypes,data:data});
674
+ if(stack2 || stack2 === 0) { data.buffer.push(stack2); }
675
+ hashTypes = {};
676
+ hashContexts = {};
677
+ stack2 = helpers['if'].call(depth0, "view.hint", {hash:{},inverse:self.noop,fn:self.program(3, program3, data),contexts:[depth0],types:["ID"],hashContexts:hashContexts,hashTypes:hashTypes,data:data});
678
+ if(stack2 || stack2 === 0) { data.buffer.push(stack2); }
679
+ return buffer;
680
+
681
+ }));
682
+
683
+ })();
684
+
685
+
686
+
687
+ (function() {
688
+ Ember.EasyForm.Config.registerTemplate('easyForm/label', Ember.Handlebars.template(function anonymous(Handlebars,depth0,helpers,partials,data) {
689
+ this.compilerInfo = [4,'>= 1.0.0'];
690
+ helpers = this.merge(helpers, Ember.Handlebars.helpers); data = data || {};
691
+ var hashTypes, hashContexts, escapeExpression=this.escapeExpression;
692
+
693
+
694
+ hashTypes = {};
695
+ hashContexts = {};
696
+ data.buffer.push(escapeExpression(helpers._triageMustache.call(depth0, "view.labelText", {hash:{},contexts:[depth0],types:["ID"],hashContexts:hashContexts,hashTypes:hashTypes,data:data})));
697
+
698
+ }));
699
+
700
+ })();
701
+
702
+
703
+
704
+ (function() {
705
+
706
+ })();
707
+
708
+
709
+
710
+ (function() {
711
+ Ember.EasyForm.humanize = function(string) {
712
+ return string.underscore().split('_').join(' ').capitalize();
713
+ };
714
+
715
+ Ember.EasyForm.eachTranslatedAttribute = function(object, fn) {
716
+ var isTranslatedAttribute = /(.+)Translation$/,
717
+ isTranslatedAttributeMatch;
718
+
719
+ for (var key in object) {
720
+ isTranslatedAttributeMatch = key.match(isTranslatedAttribute);
721
+ if (isTranslatedAttributeMatch) {
722
+ fn.call(object, isTranslatedAttributeMatch[1], Ember.I18n.t(object[key]));
723
+ }
724
+ }
725
+ };
726
+
727
+ Ember.EasyForm.processOptions = function(property, options) {
728
+ if (options) {
729
+ if (Ember.I18n) {
730
+ var eachTranslatedAttribute = Ember.I18n.eachTranslatedAttribute || Ember.EasyForm.eachTranslatedAttribute;
731
+ eachTranslatedAttribute(options.hash, function (attribute, translation) {
732
+ options.hash[attribute] = translation;
733
+ delete options.hash[attribute + 'Translation'];
734
+ });
735
+ }
736
+ options.hash.property = property;
737
+ } else {
738
+ options = property;
739
+ }
740
+
741
+ return options;
742
+ };
743
+
744
+ })();
745
+
746
+
747
+
748
+ (function() {
749
+
750
+ })();
751
+
metadata ADDED
@@ -0,0 +1,91 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ember-easyForm-rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0.beta.2
5
+ platform: ruby
6
+ authors:
7
+ - frederik dudzik
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-03-15 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.5'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.5'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: railties
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>'
46
+ - !ruby/object:Gem::Version
47
+ version: '3.1'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>'
53
+ - !ruby/object:Gem::Version
54
+ version: '3.1'
55
+ description:
56
+ email:
57
+ - 4004blog@gmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - lib/ember-easyForm-rails/version.rb
63
+ - lib/ember-easyForm-rails.rb
64
+ - vendor/assets/javascripts/ember-easyForm.js
65
+ - LICENSE.txt
66
+ - README.md
67
+ homepage: https://github.com/doodzik/ember-easyForm-rails
68
+ licenses:
69
+ - MIT
70
+ metadata: {}
71
+ post_install_message:
72
+ rdoc_options: []
73
+ require_paths:
74
+ - lib
75
+ required_ruby_version: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - '>='
78
+ - !ruby/object:Gem::Version
79
+ version: '0'
80
+ required_rubygems_version: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - '>'
83
+ - !ruby/object:Gem::Version
84
+ version: 1.3.1
85
+ requirements: []
86
+ rubyforge_project:
87
+ rubygems_version: 2.1.3
88
+ signing_key:
89
+ specification_version: 4
90
+ summary: ember-easyForm for the rails asset pipeline
91
+ test_files: []