backgrid-moment-cell
Advanced tools
Comparing version 0.3.6 to 0.3.7
@@ -180,7 +180,13 @@ /* | ||
var formatterDefaultKeys = _.keys(formatterDefaults); | ||
var instanceAttrs = _.pick(this, formatterDefaultKeys); | ||
var classAttrs = _.pick(this, formatterDefaultKeys); | ||
var formatterOptions = _.pick(options, formatterDefaultKeys); | ||
_.extend(this.formatter, formatterDefaults, instanceAttrs, formatterOptions); | ||
// Priority of the options for the formatter, from highest to lowerest | ||
// 1. MomentCell instance options | ||
// 2. MomentCell class attributes | ||
// 3. MomentFormatter defaults | ||
// this.formatter will have been instantiated now | ||
_.extend(this.formatter, formatterDefaults, classAttrs, formatterOptions); | ||
this.editor = this.editor.extend({ | ||
@@ -187,0 +193,0 @@ attributes: _.extend({}, this.editor.prototype.attributes || this.editor.attributes || {}, { |
@@ -89,2 +89,8 @@ /* | ||
*/ | ||
initialize:function(b){f.__super__.initialize.apply(this,arguments);var c=d.prototype.defaults,e=a.keys(c),g=a.pick(this,e),h=a.pick(b,e);a.extend(this.formatter,c,g,h),this.editor=this.editor.extend({attributes:a.extend({},this.editor.prototype.attributes||this.editor.attributes||{},{placeholder:this.formatter.displayFormat})})}});a.extend(f.prototype,d.prototype.defaults)}); | ||
initialize:function(b){f.__super__.initialize.apply(this,arguments);var c=d.prototype.defaults,e=a.keys(c),g=a.pick(this,e),h=a.pick(b,e); | ||
// Priority of the options for the formatter, from highest to lowerest | ||
// 1. MomentCell instance options | ||
// 2. MomentCell class attributes | ||
// 3. MomentFormatter defaults | ||
// this.formatter will have been instantiated now | ||
a.extend(this.formatter,c,g,h),this.editor=this.editor.extend({attributes:a.extend({},this.editor.prototype.attributes||this.editor.attributes||{},{placeholder:this.formatter.displayFormat})})}});a.extend(f.prototype,d.prototype.defaults)}); |
{ | ||
"name": "backgrid-moment-cell", | ||
"version": "0.3.6", | ||
"version": "0.3.7", | ||
"description": "Backgrid.js datetime cell type formatted via moment.js.", | ||
@@ -41,9 +41,9 @@ "main": "backgrid-moment-cell.js", | ||
"karma-jasmine-html-reporter": "^0.2.0", | ||
"karma-safari-launcher": "^0.1.1", | ||
"underscore": "^1.8.3" | ||
"karma-safari-launcher": "^0.1.1" | ||
}, | ||
"dependencies": { | ||
"backgrid": "~0.3.7", | ||
"moment": "^2.12.0" | ||
"moment": "^2.12.0", | ||
"underscore": "^1.8.3" | ||
} | ||
} |
@@ -215,2 +215,29 @@ /* | ||
it("will accept formatter options set on the cell class", function () { | ||
cell = new (Backgrid.Extension.MomentCell.extend({ | ||
displayLang: 'zh_HK' | ||
}))({ | ||
column: { | ||
name: "birthday", | ||
cell: "moment" | ||
}, | ||
model: book | ||
}); | ||
expect(cell.formatter.displayLang).toBe('zh_HK'); | ||
}); | ||
it("will accept formatter options given to the cell constructor", function () { | ||
cell = new Backgrid.Extension.MomentCell({ | ||
column: { | ||
name: "birthday", | ||
cell: "moment" | ||
}, | ||
model: book, | ||
displayLang: 'zh_HK' | ||
}); | ||
expect(cell.formatter.displayLang).toBe('zh_HK'); | ||
}); | ||
it("applies a moment-cell class to the cell", function () { | ||
@@ -217,0 +244,0 @@ expect(cell.render().$el.hasClass("moment-cell")).toBe(true); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2907352
17
2380
3
+ Addedunderscore@^1.8.3