File: property.coffee

Defined in: template

Method Summary

Method Details

? Gunther.Template.prototype.attribute(name, value) Source

Public

Properties and Attributes

Set an attribute

Uses jQuery's attr() method

Parameters:

  • (String) nameString name of the attribute to add
  • (String) valueString value for the attribute

? Gunther.Template.prototype.boundAttribute(args...) Source

Add a DOM attribute which is "bound" to a model's attribute

Parameters:

  • (String) nameString name of the attribute to add
  • model{Backbone.Model} to bind on
  • (String) propertyString or Array of properties to bind on
  • generator(optional) method that generates the value after a change

? Gunther.Template.prototype.property(name, value) Source

Set a property

note: this differs from attributes, as per jQuery's API. Use this for properties like checked on a checkbox

Parameters:

  • (String) nameString name of the property to add
  • (String) valueString value for the attribute

? Gunther.Template.prototype.boundProperty(args...) Source

Add a property which is "bound"

Pass it the property's name, the model, the property, and optionally a value generating function

Parameters:

  • (String) nameString name of the property to add
  • model{Backbone.Model} to bind on
  • (String) propertyString or Array of properties to bind on
  • generator(optional) method that generates the value after a change

? Gunther.Template.prototype.css(name, value) Source

Set a style property

This method accepts both an object of the form cssKey: value or a single name/value pair

Parameters:

  • namename of the CSS property
  • valuevalue of the CSS property

? Gunther.Template.prototype.boundCss(args...) Source

Bind a CSS property to a model's property or properties

Parameters:

  • (String) nameString name of the CSS property
  • model{Backbone.Model} to bind on
  • (String) propertyString or Array of properties to bind on
  • generator(optional) method that generates the value after a change

? Gunther.Template.prototype.toggleClass(className, model, property, toggle) Source

Toggle an element's class based on a property (or set of properties)

Parameters:

  • (String) classNameString name of the class to toggle
  • model{Backbone.Model} to bind on
  • (String) propertyString or Array of properties to bind on
  • togglemethod that decides whether the class should be included or not, should return a Boolean