emerson / ember-form-master-2000 Goto Github PK
View Code? Open in Web Editor NEWA simple form builder for Ember built as an Ember-CLI addon.
License: MIT License
A simple form builder for Ember built as an Ember-CLI addon.
License: MIT License
We need to figure out a way to handle multilingual labels and general internationalization
We need the for
attribute on every label, corresponding to the id
of the input
element.
Not observable on the dummy app, and should be there.
Ember Canary
Ember Data beta 15
I retrieve errors back from the server in what seems to be the recommended way:
res.status(422).send({
"errors": {
"field_one": ["error 1", "error 2"],
"field_two": ["error 1"],
"serviceNotification": ["A problem with serviceNotification"]
}
});
... along with an implementation for RESTAdapter.ajaxError
from http://alexspeller.com/server-side-validations-with-ember-data-and-ds-errors/ which populates the records errors object. In inspector for the record that's put, $E.get('errors.content') returns an array of 4 error objects with an attribute and message for each.
My template has something like:
{{fm-checkbox label=(t 'some_translation') checked=model.myModel.theField errors=model.myModel.errors.theField.message}}
This example doesn't work, but model.myModel.errors.theField does (however it displays [object Object] as the error). In the example above there would be two errors for one of the fields, held as two separate objects in the errors.content.
Not sure if you have a different implementation for errors or I'm just addressing it incorrectly within the template?
I'll reference emberjs/data#2028 because it has related information.
Also http://emberjs.jsbin.com/sidarufuco/1/edit?html,css,js,output as an example that shows multiple errors.
Hope that's enough information!
Thanks
Add support for check boxes
Hi,
Please could you consider adding client side translation of field level error messages from a 422 response from the server.
{{t errors.message}} should work but not if multiple errors without loops etc, so it would ideally be done within the template of ember-form-master-2000, possibly an overridable function that can define any translation mechanism.
I'll admit I could probably just write a custom template to override this, but then that's a maintenance annoyance!
Thanks
Hi,
for: null,
in fm-form is breaking IE8 compatibility. Please can you refactor?
Thank you!
{{fm-select}}
does not update when content changes. I'm not sure why. The helper used should update when passed in parameters changes. You find failing tests to demonstrate the issue here: jelhan@054f320
Would appreciate any help to debug.
With the new component integration tests, it's easier to give a component access to a container for testing. However, the current way the initializer is set up, it requires an application
to be present, which isn't available in a unit test.
I think this could be solved by using an instance-initializer and calling register
and injection
on the instance
that gets passed through. For instance, check out how ember-i18n does this.
The thing that I'm not sure about is how you could make this backwards compatible for pre 1.12 Ember apps.
It would be very convenient to support HTML in labels. My use case is displaying an icon for a tooltip next to the label.
unfortunately, in case of an array of errors on a single field (which is what ember-data does all the time), only "[object Object]" is shown as an error.
Any ideas?
Version 0.2.2 at the moment.
{{fm-field
widget='input'
label='This is a label'
placeholder='This is a placeholder'
class='myInput'
value=form.name.value
errors=form.error.value
data-test-input='name'
}}
No matter which position I place the data-test attribute, and no matter which syntax I use for it, it is never rendered in the DOM when actually running the tests.
Add support for radio buttons
Is there any support for standard html attributes such as disabled
or readonly
or standard input types such as number
or email
?
in
export default Ember.Handlebars.makeBoundHelper(isNotHelper);
=>>
export default Ember.Helper.helper(isNotHelper);
(error makeboundhelper deprecated)
Find a graceful way to add WYSIWYG suppport
Hi there!
I'm new to Ember and trying to get up and running with EFM2000 and ember-validations. I've gotten it to work up to a point, but I'm not sure where to go from here. At the moment, my validations work in the front end, which is great. The two problems I have are:
has-error
class never gets removed, even if validation passes. I had a look and the errors object it's looking at is empty. Why could it be that the class doesn't get removed?My code is as follows:
//app/controllers/clients/new.js
import Ember from 'ember';
import EmberValidations from 'ember-validations';
export default Ember.Controller.extend(EmberValidations.Mixin, {
validations: {
clientName: {
presence: true,
length: { minimum: 5 }
},
clientEmail: {
presence: true,
length: { minimum: 5 }
}
},
actions: {
saveClient: function(){
var newClient = this.store.createRecord('client', {
clientName: this.get('clientName'),
clientEmail: this.get('clientEmail')
});
newClient.save();
this.setProperties({
clientName: '',
clientEmail: ''
});
}
}
});
//app/templates/clients/new.hbs
{{#fm-form action='saveClient'}}
{{fm-field type='text' value=clientName label='Client Name' errors=controller.errors.clientName}}
{{fm-field type='text' value=clientEmail label='Client Email' errors=controller.errors.clientEmail}}
{{fm-submit value='Save Client'}}
{{/fm-form}}
//app/templates/models/client.js
import DS from 'ember-data';
export default DS.Model.extend({
clientName: DS.attr('string'),
clientEmail: DS.attr('string')
});
As said, I'm super new to Ember so please tell me if I'm being stupid. :)
Hi!
We're on 2.1.4 of this addon, and I was curious what breaking changes were introduced in 3.0.0?
Create an initializer and documentation that works with the foundation CSS framework
I'm still pretty new to using ember.
Package.json: "ember-form-master-2000": "^0.2.0"
Running into this error on the server:
modules/ember-form-master-2000/templates/components/fm-form.hbs
app/templates/register.hbs:
<section class="register">
{{#fm-form action='register'}}
<h1>Sign Up</h1>
{{fm-field type='text' value=model.email errors=model.errors.email label="Email Address"}}
{{fm-field type='password' value=model.password errors=model.errors.password label="Password"}}
{{fm-field type='password' value=model.passwordConfirmation errors=model.errors.password_confirmation label="Confirm Password"}}
{{#fm-submit value="Sign Up"}}
{{link-to 'Log In' 'login'}}
{{/fm-submit}}
{{/fm-form}}
</section>
My inspector is running this issue, but I don't know if it's related:
[Report Only] Refused to apply inline style because it violates the following Content Security Policy directive: "style-src 'self'". Either the 'unsafe-inline' keyword, a hash ('sha256-Eaamrrh0b5a_naRsV_zg7s6-kGvexMXZQARWP6ukkg4='), or a nonce ('nonce-...') is required to enable inline execution.
on line 11 and again on 15 showing
<span style="color: #888">(in <code>/Users/kalyco/Documents/foundation-ember/tmp/tree_merger-tmp_dest_dir-0L4RXMpu.tmp</code>)</span>
</p>
and
<pre style="color: #888">TypeError: undefined is not a function
respectively.
Any help would be appreciated. I imagine it's something simple that I'm overlooking.
Thanks ^__^
Given an fm-submit
with default class of btn btn-primary
it would be nice to be able to do the following:
{{fm-submit value='Submit' class='float-right'}}
and have it generate
<button type="submit" value="Submit" class="btn primary float-right">
Is there a way to do this through some other means?
Now that 1.13 is live, it would be nice to take advantage of the deprecation fixes in master.
Are you planning to add support for a success class and a success callback?
Right now, it's difficult to confirm the presence of certain states on form groups. For instance, consider an email field with an error. Today, we get this:
<div id="ember486" class="ember-view form-group has-error">
<label for="Email-Address" class="control-label">Email Address</label>
<input id="Email-Address" class="ember-view ember-text-field form-control has-error" type="text">
<span id="ember566" class="ember-view help-block">can't be blank</span>
</div>
Its hard to confirm the presence of the help-block
with other inputs in the same form, because the outer form-group
has no identifiable information on it. This requires a selector like this to ensure it's the help-block
associated with the email-address
input:
$('input#Email-Address ~.help-block')
It would be much easier if the outer form-group
had an identifiable class
or id
to select. Then it would just be something like:
$('.form-group#email .help-block')
...or...
$('.form-group.email .help-block')
without using the more uncommonly used sibling selector.
This should be implemented on all components, including checkbox
since, today, they're not uniquely identifiable.
But that brings me to another problem #8, and problems with the API in general. I would prefer a more "magic" API, wherein no type
is required, and can be derived by the modelType
or the DS.attr()
call in the model. Perhaps this is already the case (have not had the chance to verify). If this is the case, then I would like something like this:
Currently, my needs are such that I would expect to be able to customize the output to be something like this:
<section class="form-field">
<div class="form-label">
<label for="first-name" class="form-field-label">First Name</label>
</div>
<div class="form-controls>
<input type="text" id="first-name" placeholder="First Name" autofocus required />
</div>
</section>
Notice how autofocus
and required
are specified based on the model
declaration. I would expect to be do something along the lines of ember validations, where the validation can be specified on each model.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.