Giter Club home page Giter Club logo

ember-chloroform's Introduction

Ember-chloroform

Live Demo

Easy forms for EmberJS apps. Validations included. (Ember 2.x)

Features

  • uses ember-cp-validations for implementing validations support.
  • contextual components for input fields including submit buttons
  • Label for input can passed as label property (optional). If label is not passed, it is inferred from valuePath property.

Installation

This is an ember-cli addon, so all you need is an ember install.

ember install ember-chloroform

Compatible with Ember 2.x

Usage

  • Template:

    {{#chloro-form model=model action='submit' as |f|}}
        {{f.input valuePath='username' placeholder='your username' label='Username'}}
        {{f.input valuePath='password' type='password' placeholder='password goes here'}}
        {{f.submit value="Login" class='button'}}
    {{/chloro-form}}
    • model is required. It's value is equal to the object on which the form fields are defined. For example, if username and password are defined on the template's controller, then model = this.
    • label property is optional.
  • Controller/Component:

    • Declare Validations (optional):

      import { validator, buildValidations } from 'ember-cp-validations';
      
      
      const Validations = buildValidations({
        username: validator('presence', true),
        password: validator('presence', true)
      });
      
      export default Ember.Controller.extend(Validations, {});
      
      //or if using in a Component's template
      export default Ember.Component.extend(Validations, {});
    • Handle the action declared in the template:

      ...
      export default Ember.Controller.extend(Validations, {
        ...
        
        actions: {
          submit () {
            //handle here
          }
        }
      });

Running

Running Tests

  • npm test (Runs ember try:testall to test your addon against multiple Ember versions)
  • ember test
  • ember test --server

Building

  • ember build

For more information on using ember-cli, visit http://ember-cli.com/.

ember-chloroform's People

Contributors

lokeshj avatar ember-tomster avatar

Stargazers

Sean Goresht avatar

Watchers

James Cloos avatar  avatar  avatar

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.