GithubHelp home page GithubHelp logo

emerson / ember-form-master-2000 Goto Github PK

View Code? Open in Web Editor NEW
40.0 40.0 18.0 2.59 MB

A simple form builder for Ember built as an Ember-CLI addon.

License: MIT License

JavaScript 84.67% HTML 3.33% Handlebars 12.00%

ember-form-master-2000's People

Contributors

blimmer avatar clekstro avatar ember-tomster avatar emerson avatar g-cassie avatar jelhan avatar lookininward avatar louim avatar michaelnguyen2021 avatar rachel-armstrong avatar srsgores avatar utilityboy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

ember-form-master-2000's Issues

Documentation/support for 422 field level validation errors

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

Feature request: i18n translation of error messages

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

IE8 compatibility

Hi,

for: null,

in fm-form is breaking IE8 compatibility. Please can you refactor?

Thank you!

Difficult to integration test components that use an fm-form

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.

Support for HTML in labels.

It would be very convenient to support HTML in labels. My use case is displaying an icon for a tooltip next to the label.

Problem with 422 Error Support

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?

Data-Test attributes don't work

      {{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.

Standard HTML attributes

Is there any support for standard html attributes such as disabled or readonly or standard input types such as number or email?

Ember 2.0 Helpers

in

  • addon/helpers/*.js

export default Ember.Handlebars.makeBoundHelper(isNotHelper);
=>>
export default Ember.Helper.helper(isNotHelper);

(error makeboundhelper deprecated)

Using form master with dockyard/ember-validations

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:

  • The new template starts out with validation failed. How do I start with a non-validated object that updates per field as I go along?
  • Thehas-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. :)

What changed in 3.0.0?

Hi!

We're on 2.1.4 of this addon, and I was curious what breaking changes were introduced in 3.0.0?

Build error- undefined is not a function

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 ^__^

Append widget classes to defaults

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?

Publish 0.2.0

Now that 1.13 is live, it would be nice to take advantage of the deprecation fixes in master.

Success State

Are you planning to add support for a success class and a success callback?

Provide a class or id on a field to easily identify in test

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.

Infer field type from model attribute

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:

{{fm-field value=firstName}}

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.