Sha256: e6019da761b6562590d288d0b6097d9a3925b74ffaa4feec55dc20d3f7cbee1f

Contents?: true

Size: 781 Bytes

Versions: 6

Compression:

Stored size: 781 Bytes

Contents

// Create a composer for a given field on the model.
//
// Example:
//
//     {{#composer field="ingredients"}}
//       <input type="text"
//              name="name"
//              placeholder="Name (e.g. Cheese)..."
//              value="{{name}}">
//       <input type="text"
//              name="amount"
//              placeholder="Amount (e.g. 10kg)..."
//              value="{{amount}}">
//     {{/composer}}
//
Handlebars.registerHelper('composer', function(options) {
  var view = new slices.ComposerView({
    id         : slices.fieldId(this, options.hash.field),
    value      : this[options.hash.field],
    fields     : options.fn,
    addLabel   : options.hash.addLabel,
    autoAttach : true
  });

  return new Handlebars.SafeString(view.placeholder());
});

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
slices-1.0.5 app/assets/javascripts/slices/app/helpers/composer.js
slices-1.0.4 app/assets/javascripts/slices/app/helpers/composer.js
slices-1.0.3 app/assets/javascripts/slices/app/helpers/composer.js
slices-1.0.2 app/assets/javascripts/slices/app/helpers/composer.js
slices-1.0.1 app/assets/javascripts/slices/app/helpers/composer.js
slices-1.0.0 app/assets/javascripts/slices/app/helpers/composer.js