Sha256: 918065782f6633500d4cd3edb496f25da2d2d5e7bfd6dfba5f3f01a7ee475a4b

Contents?: true

Size: 908 Bytes

Versions: 30

Compression:

Stored size: 908 Bytes

Contents

(function() {

  Luca.components.Template = Luca.View.extend({
    initialize: function(options) {
      this.options = options != null ? options : {};
      Luca.View.prototype.initialize.apply(this, arguments);
      if (!(this.template || this.markup)) {
        throw "Templates must specify which template / markup to use";
      }
      if (_.isString(this.templateContainer)) {
        return this.templateContainer = eval("(window || global)." + this.templateContainer);
      }
    },
    templateContainer: "Luca.templates",
    beforeRender: function() {
      if (_.isUndefined(this.templateContainer)) this.templateContainer = JST;
      return this.$el.html(this.markup || this.templateContainer[this.template](this.options));
    },
    render: function() {
      return $(this.container).append(this.$el);
    }
  });

  Luca.register("template", "Luca.components.Template");

}).call(this);

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
luca-0.9.76 vendor/assets/luca-ui/components/template.js
luca-0.9.7 vendor/assets/luca-ui/components/template.js
luca-0.9.65 vendor/assets/luca-ui/components/template.js
luca-0.9.6 vendor/assets/luca-ui/components/template.js
luca-0.9.42 vendor/assets/luca-ui/components/template.js
luca-0.9.4 vendor/assets/luca-ui/components/template.js
luca-0.9.2 vendor/assets/luca-ui/components/template.js
luca-0.9.1 vendor/assets/luca-ui/components/template.js
luca-0.9.0 vendor/assets/luca-ui/components/template.js
luca-0.8.599 vendor/assets/luca-ui/components/template.js
luca-0.8.59 vendor/assets/luca-ui/components/template.js
luca-0.8.3 vendor/assets/luca-ui/components/template.js
luca-0.8.2 vendor/assets/luca-ui/components/template.js
luca-0.8.06 vendor/assets/luca-ui/components/template.js
luca-0.8 vendor/assets/luca-ui/components/template.js
luca-0.7.92 vendor/assets/luca-ui/components/template.js
luca-0.7.91 vendor/assets/luca-ui/components/template.js
luca-0.7.9 vendor/assets/luca-ui/components/template.js
luca-0.7.8 vendor/assets/luca-ui/components/template.js
luca-0.7.7 vendor/assets/luca-ui/components/template.js