nytimes / backbone.stickit

Backbone data binding, model binding plugin. The real logic-less templates.
MIT License
1.64k stars 176 forks source link

Consider Marionette uiBindings #298

Closed misantronic closed 8 years ago

misantronic commented 8 years ago

uiBindings are currently not supported so I added a few lines of code to make it work. Parsing of the @ui-sytax is taken from the original Marionette source

akre54 commented 8 years ago

Closing for the same reasons as #295.

misantronic commented 8 years ago

Alright.

If anyone is interested in supporting Marionette.bindings use:

var addBindingFn = Backbone.View.prototype.addBinding;

_.extend(Backbone.View.prototype, {
    addBinding: function (optionalModel, selector, binding) {
        if(_.isString(selector) && selector.charAt(0) === '@' && this.ui) {
            selector = this.ui[selector.substr(4)].selector;
        }

        return addBindingFn.call(this, optionalModel, selector, binding);
    }
});
akre54 commented 8 years ago

Awesome. Thanks for that.