Added a lot of functionality; Fixed a large number of bugs; Removed Bootstrap from the mix and replaced it with SimpleGrid and some choice bits from the bootstrap system; Pricing, Sales, and Product management all now function at basic levels.

This commit is contained in:
Wynne Crisman
2017-01-17 22:31:43 -08:00
parent b757595cd6
commit 55337521f6
49 changed files with 16017 additions and 1547 deletions

View File

@@ -0,0 +1,48 @@
// https://tc39.github.io/ecma262/#sec-array.prototype.includes
if (!Array.prototype.includes) {
Object.defineProperty(Array.prototype, 'includes', {
value: function(searchElement, fromIndex) {
// 1. Let O be ? ToObject(this value).
if (this == null) {
throw new TypeError('"this" is null or not defined');
}
var o = Object(this);
// 2. Let len be ? ToLength(? Get(O, "length")).
var len = o.length >>> 0;
// 3. If len is 0, return false.
if (len === 0) {
return false;
}
// 4. Let n be ? ToInteger(fromIndex).
// (If fromIndex is undefined, this step produces the value 0.)
var n = fromIndex | 0;
// 5. If n ≥ 0, then
// a. Let k be n.
// 6. Else n < 0,
// a. Let k be len + n.
// b. If k < 0, let k be 0.
var k = Math.max(n >= 0 ? n : len - Math.abs(n), 0);
// 7. Repeat, while k < len
while (k < len) {
// a. Let elementK be the result of ? Get(O, ! ToString(k)).
// b. If SameValueZero(searchElement, elementK) is true, return true.
// c. Increase k by 1.
// NOTE: === provides the correct "SameValueZero" comparison needed here.
if (o[k] === searchElement) {
return true;
}
k++;
}
// 8. Return false
return false;
}
});
}

View File

@@ -0,0 +1,19 @@
/**
* Get the parent template instance.
* @param {Number} [levels] How many levels to go up. Default is 1
* @returns {Blaze.TemplateInstance}
*/
Blaze.TemplateInstance.prototype.parentTemplate = function(levels) {
let view = this.view;
levels = (typeof levels === "undefined") ? 1 : levels;
while(view) {
//if(view.name.substring(0, 9) === "Template." && !(levels--)) {
if(view.template && !(levels--)) {
//return view.templateInstance();
return view.templateInstance();
}
view = view.parentView;
}
};

View File

@@ -0,0 +1,9 @@
//
// Add a method to get a timezone adjusted date for an input field that is a date picker.
// Use $('input[name="date"]').val(new Date().toDateInputValue()) to set the date of the input field.
//
Date.prototype.toDateInputValue = (function() {
let local = new Date(this);
local.setMinutes(this.getMinutes() - this.getTimezoneOffset());
return local.toJSON().slice(0,10);
});

View File

@@ -0,0 +1,3 @@
RegExp.escape = function(s) {
return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
};