settings application
.env db params+global settings in admin model ECVI plugin module
This commit is contained in:
41
staticfiles/material/js/custom-elements.min.js
vendored
Normal file
41
staticfiles/material/js/custom-elements.min.js
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
(function(){
|
||||
'use strict';var aa=new Set("annotation-xml color-profile font-face font-face-src font-face-uri font-face-format font-face-name missing-glyph".split(" "));function g(b){var a=aa.has(b);b=/^[a-z][.0-9_a-z]*-[\-.0-9_a-z]*$/.test(b);return!a&&b}function l(b){var a=b.isConnected;if(void 0!==a)return a;for(;b&&!(b.__CE_isImportDocument||b instanceof Document);)b=b.parentNode||(window.ShadowRoot&&b instanceof ShadowRoot?b.host:void 0);return!(!b||!(b.__CE_isImportDocument||b instanceof Document))}
|
||||
function p(b,a){for(;a&&a!==b&&!a.nextSibling;)a=a.parentNode;return a&&a!==b?a.nextSibling:null}
|
||||
function q(b,a,d){d=void 0===d?new Set:d;for(var c=b;c;){if(c.nodeType===Node.ELEMENT_NODE){var e=c;a(e);var f=e.localName;if("link"===f&&"import"===e.getAttribute("rel")){c=e.import;if(c instanceof Node&&!d.has(c))for(d.add(c),c=c.firstChild;c;c=c.nextSibling)q(c,a,d);c=p(b,e);continue}else if("template"===f){c=p(b,e);continue}if(e=e.__CE_shadowRoot)for(e=e.firstChild;e;e=e.nextSibling)q(e,a,d)}c=c.firstChild?c.firstChild:p(b,c)}}function t(b,a,d){b[a]=d};function u(){this.a=new Map;this.f=new Map;this.c=[];this.b=!1}function ba(b,a,d){b.a.set(a,d);b.f.set(d.constructorFunction,d)}function v(b,a){b.b=!0;b.c.push(a)}function w(b,a){b.b&&q(a,function(a){return x(b,a)})}function x(b,a){if(b.b&&!a.__CE_patched){a.__CE_patched=!0;for(var d=0;d<b.c.length;d++)b.c[d](a)}}function y(b,a){var d=[];q(a,function(a){return d.push(a)});for(a=0;a<d.length;a++){var c=d[a];1===c.__CE_state?b.connectedCallback(c):z(b,c)}}
|
||||
function A(b,a){var d=[];q(a,function(a){return d.push(a)});for(a=0;a<d.length;a++){var c=d[a];1===c.__CE_state&&b.disconnectedCallback(c)}}
|
||||
function B(b,a,d){d=void 0===d?{}:d;var c=d.u||new Set,e=d.h||function(a){return z(b,a)},f=[];q(a,function(a){if("link"===a.localName&&"import"===a.getAttribute("rel")){var d=a.import;d instanceof Node&&(d.__CE_isImportDocument=!0,d.__CE_hasRegistry=!0);d&&"complete"===d.readyState?d.__CE_documentLoadHandled=!0:a.addEventListener("load",function(){var d=a.import;if(!d.__CE_documentLoadHandled){d.__CE_documentLoadHandled=!0;var f=new Set(c);f.delete(d);B(b,d,{u:f,h:e})}})}else f.push(a)},c);if(b.b)for(a=
|
||||
0;a<f.length;a++)x(b,f[a]);for(a=0;a<f.length;a++)e(f[a])}
|
||||
function z(b,a){if(void 0===a.__CE_state){var d=a.ownerDocument;if(d.defaultView||d.__CE_isImportDocument&&d.__CE_hasRegistry)if(d=b.a.get(a.localName)){d.constructionStack.push(a);var c=d.constructorFunction;try{try{if(new c!==a)throw Error("The custom element constructor did not produce the element being upgraded.");}finally{d.constructionStack.pop()}}catch(m){throw a.__CE_state=2,m;}a.__CE_state=1;a.__CE_definition=d;if(d.attributeChangedCallback)for(d=d.observedAttributes,c=0;c<d.length;c++){var e=
|
||||
d[c],f=a.getAttribute(e);null!==f&&b.attributeChangedCallback(a,e,null,f,null)}l(a)&&b.connectedCallback(a)}}}u.prototype.connectedCallback=function(b){var a=b.__CE_definition;a.connectedCallback&&a.connectedCallback.call(b)};u.prototype.disconnectedCallback=function(b){var a=b.__CE_definition;a.disconnectedCallback&&a.disconnectedCallback.call(b)};
|
||||
u.prototype.attributeChangedCallback=function(b,a,d,c,e){var f=b.__CE_definition;f.attributeChangedCallback&&-1<f.observedAttributes.indexOf(a)&&f.attributeChangedCallback.call(b,a,d,c,e)};function C(b){var a=document;this.c=b;this.a=a;this.b=void 0;B(this.c,this.a);"loading"===this.a.readyState&&(this.b=new MutationObserver(this.f.bind(this)),this.b.observe(this.a,{childList:!0,subtree:!0}))}function D(b){b.b&&b.b.disconnect()}C.prototype.f=function(b){var a=this.a.readyState;"interactive"!==a&&"complete"!==a||D(this);for(a=0;a<b.length;a++)for(var d=b[a].addedNodes,c=0;c<d.length;c++)B(this.c,d[c])};function ca(){var b=this;this.b=this.a=void 0;this.c=new Promise(function(a){b.b=a;b.a&&a(b.a)})}function E(b){if(b.a)throw Error("Already resolved.");b.a=void 0;b.b&&b.b(void 0)};function F(b){this.c=!1;this.a=b;this.j=new Map;this.f=function(a){return a()};this.b=!1;this.i=[];this.o=new C(b)}
|
||||
F.prototype.l=function(b,a){var d=this;if(!(a instanceof Function))throw new TypeError("Custom element constructors must be functions.");if(!g(b))throw new SyntaxError("The element name '"+b+"' is not valid.");if(this.a.a.get(b))throw Error("A custom element with name '"+b+"' has already been defined.");if(this.c)throw Error("A custom element is already being defined.");this.c=!0;try{var c=function(a){var b=e[a];if(void 0!==b&&!(b instanceof Function))throw Error("The '"+a+"' callback must be a function.");
|
||||
return b},e=a.prototype;if(!(e instanceof Object))throw new TypeError("The custom element constructor's prototype is not an object.");var f=c("connectedCallback");var m=c("disconnectedCallback");var k=c("adoptedCallback");var h=c("attributeChangedCallback");var n=a.observedAttributes||[]}catch(r){return}finally{this.c=!1}a={localName:b,constructorFunction:a,connectedCallback:f,disconnectedCallback:m,adoptedCallback:k,attributeChangedCallback:h,observedAttributes:n,constructionStack:[]};ba(this.a,
|
||||
b,a);this.i.push(a);this.b||(this.b=!0,this.f(function(){return da(d)}))};F.prototype.h=function(b){B(this.a,b)};
|
||||
function da(b){if(!1!==b.b){b.b=!1;for(var a=b.i,d=[],c=new Map,e=0;e<a.length;e++)c.set(a[e].localName,[]);B(b.a,document,{h:function(a){if(void 0===a.__CE_state){var e=a.localName,f=c.get(e);f?f.push(a):b.a.a.get(e)&&d.push(a)}}});for(e=0;e<d.length;e++)z(b.a,d[e]);for(;0<a.length;){var f=a.shift();e=f.localName;f=c.get(f.localName);for(var m=0;m<f.length;m++)z(b.a,f[m]);(e=b.j.get(e))&&E(e)}}}F.prototype.get=function(b){if(b=this.a.a.get(b))return b.constructorFunction};
|
||||
F.prototype.m=function(b){if(!g(b))return Promise.reject(new SyntaxError("'"+b+"' is not a valid custom element name."));var a=this.j.get(b);if(a)return a.c;a=new ca;this.j.set(b,a);this.a.a.get(b)&&!this.i.some(function(a){return a.localName===b})&&E(a);return a.c};F.prototype.s=function(b){D(this.o);var a=this.f;this.f=function(d){return b(function(){return a(d)})}};window.CustomElementRegistry=F;F.prototype.define=F.prototype.l;F.prototype.upgrade=F.prototype.h;F.prototype.get=F.prototype.get;
|
||||
F.prototype.whenDefined=F.prototype.m;F.prototype.polyfillWrapFlushCallback=F.prototype.s;var G=window.Document.prototype.createElement,H=window.Document.prototype.createElementNS,ea=window.Document.prototype.importNode,fa=window.Document.prototype.prepend,ha=window.Document.prototype.append,ia=window.DocumentFragment.prototype.prepend,ja=window.DocumentFragment.prototype.append,I=window.Node.prototype.cloneNode,J=window.Node.prototype.appendChild,K=window.Node.prototype.insertBefore,L=window.Node.prototype.removeChild,M=window.Node.prototype.replaceChild,N=Object.getOwnPropertyDescriptor(window.Node.prototype,
|
||||
"textContent"),O=window.Element.prototype.attachShadow,P=Object.getOwnPropertyDescriptor(window.Element.prototype,"innerHTML"),Q=window.Element.prototype.getAttribute,R=window.Element.prototype.setAttribute,S=window.Element.prototype.removeAttribute,T=window.Element.prototype.getAttributeNS,U=window.Element.prototype.setAttributeNS,ka=window.Element.prototype.removeAttributeNS,la=window.Element.prototype.insertAdjacentElement,ma=window.Element.prototype.insertAdjacentHTML,na=window.Element.prototype.prepend,
|
||||
oa=window.Element.prototype.append,V=window.Element.prototype.before,pa=window.Element.prototype.after,qa=window.Element.prototype.replaceWith,ra=window.Element.prototype.remove,sa=window.HTMLElement,W=Object.getOwnPropertyDescriptor(window.HTMLElement.prototype,"innerHTML"),ta=window.HTMLElement.prototype.insertAdjacentElement,ua=window.HTMLElement.prototype.insertAdjacentHTML;var va=new function(){};function wa(){var b=X;window.HTMLElement=function(){function a(){var a=this.constructor,c=b.f.get(a);if(!c)throw Error("The custom element being constructed was not registered with `customElements`.");var e=c.constructionStack;if(0===e.length)return e=G.call(document,c.localName),Object.setPrototypeOf(e,a.prototype),e.__CE_state=1,e.__CE_definition=c,x(b,e),e;c=e.length-1;var f=e[c];if(f===va)throw Error("The HTMLElement constructor was either called reentrantly for this constructor or called multiple times.");
|
||||
e[c]=va;Object.setPrototypeOf(f,a.prototype);x(b,f);return f}a.prototype=sa.prototype;Object.defineProperty(a.prototype,"constructor",{writable:!0,configurable:!0,enumerable:!1,value:a});return a}()};function Y(b,a,d){function c(a){return function(d){for(var e=[],c=0;c<arguments.length;++c)e[c]=arguments[c];c=[];for(var f=[],n=0;n<e.length;n++){var r=e[n];r instanceof Element&&l(r)&&f.push(r);if(r instanceof DocumentFragment)for(r=r.firstChild;r;r=r.nextSibling)c.push(r);else c.push(r)}a.apply(this,e);for(e=0;e<f.length;e++)A(b,f[e]);if(l(this))for(e=0;e<c.length;e++)f=c[e],f instanceof Element&&y(b,f)}}void 0!==d.g&&(a.prepend=c(d.g));void 0!==d.append&&(a.append=c(d.append))};function xa(){var b=X;t(Document.prototype,"createElement",function(a){if(this.__CE_hasRegistry){var d=b.a.get(a);if(d)return new d.constructorFunction}a=G.call(this,a);x(b,a);return a});t(Document.prototype,"importNode",function(a,d){a=ea.call(this,a,!!d);this.__CE_hasRegistry?B(b,a):w(b,a);return a});t(Document.prototype,"createElementNS",function(a,d){if(this.__CE_hasRegistry&&(null===a||"http://www.w3.org/1999/xhtml"===a)){var c=b.a.get(d);if(c)return new c.constructorFunction}a=H.call(this,a,
|
||||
d);x(b,a);return a});Y(b,Document.prototype,{g:fa,append:ha})};function ya(){function b(b,c){Object.defineProperty(b,"textContent",{enumerable:c.enumerable,configurable:!0,get:c.get,set:function(b){if(this.nodeType===Node.TEXT_NODE)c.set.call(this,b);else{var d=void 0;if(this.firstChild){var e=this.childNodes,k=e.length;if(0<k&&l(this)){d=Array(k);for(var h=0;h<k;h++)d[h]=e[h]}}c.set.call(this,b);if(d)for(b=0;b<d.length;b++)A(a,d[b])}}})}var a=X;t(Node.prototype,"insertBefore",function(b,c){if(b instanceof DocumentFragment){var e=Array.prototype.slice.apply(b.childNodes);
|
||||
b=K.call(this,b,c);if(l(this))for(c=0;c<e.length;c++)y(a,e[c]);return b}e=l(b);c=K.call(this,b,c);e&&A(a,b);l(this)&&y(a,b);return c});t(Node.prototype,"appendChild",function(b){if(b instanceof DocumentFragment){var c=Array.prototype.slice.apply(b.childNodes);b=J.call(this,b);if(l(this))for(var e=0;e<c.length;e++)y(a,c[e]);return b}c=l(b);e=J.call(this,b);c&&A(a,b);l(this)&&y(a,b);return e});t(Node.prototype,"cloneNode",function(b){b=I.call(this,!!b);this.ownerDocument.__CE_hasRegistry?B(a,b):w(a,
|
||||
b);return b});t(Node.prototype,"removeChild",function(b){var c=l(b),e=L.call(this,b);c&&A(a,b);return e});t(Node.prototype,"replaceChild",function(b,c){if(b instanceof DocumentFragment){var e=Array.prototype.slice.apply(b.childNodes);b=M.call(this,b,c);if(l(this))for(A(a,c),c=0;c<e.length;c++)y(a,e[c]);return b}e=l(b);var f=M.call(this,b,c),d=l(this);d&&A(a,c);e&&A(a,b);d&&y(a,b);return f});N&&N.get?b(Node.prototype,N):v(a,function(a){b(a,{enumerable:!0,configurable:!0,get:function(){for(var b=[],
|
||||
a=0;a<this.childNodes.length;a++)b.push(this.childNodes[a].textContent);return b.join("")},set:function(b){for(;this.firstChild;)L.call(this,this.firstChild);J.call(this,document.createTextNode(b))}})})};function za(b){function a(a){return function(e){for(var c=[],d=0;d<arguments.length;++d)c[d]=arguments[d];d=[];for(var k=[],h=0;h<c.length;h++){var n=c[h];n instanceof Element&&l(n)&&k.push(n);if(n instanceof DocumentFragment)for(n=n.firstChild;n;n=n.nextSibling)d.push(n);else d.push(n)}a.apply(this,c);for(c=0;c<k.length;c++)A(b,k[c]);if(l(this))for(c=0;c<d.length;c++)k=d[c],k instanceof Element&&y(b,k)}}var d=Element.prototype;void 0!==V&&(d.before=a(V));void 0!==V&&(d.after=a(pa));void 0!==qa&&
|
||||
t(d,"replaceWith",function(a){for(var c=[],d=0;d<arguments.length;++d)c[d]=arguments[d];d=[];for(var m=[],k=0;k<c.length;k++){var h=c[k];h instanceof Element&&l(h)&&m.push(h);if(h instanceof DocumentFragment)for(h=h.firstChild;h;h=h.nextSibling)d.push(h);else d.push(h)}k=l(this);qa.apply(this,c);for(c=0;c<m.length;c++)A(b,m[c]);if(k)for(A(b,this),c=0;c<d.length;c++)m=d[c],m instanceof Element&&y(b,m)});void 0!==ra&&t(d,"remove",function(){var a=l(this);ra.call(this);a&&A(b,this)})};function Aa(){function b(a,b){Object.defineProperty(a,"innerHTML",{enumerable:b.enumerable,configurable:!0,get:b.get,set:function(a){var d=this,e=void 0;l(this)&&(e=[],q(this,function(a){a!==d&&e.push(a)}));b.set.call(this,a);if(e)for(var f=0;f<e.length;f++){var m=e[f];1===m.__CE_state&&c.disconnectedCallback(m)}this.ownerDocument.__CE_hasRegistry?B(c,this):w(c,this);return a}})}function a(a,b){t(a,"insertAdjacentElement",function(a,d){var e=l(d);a=b.call(this,a,d);e&&A(c,d);l(a)&&y(c,d);return a})}
|
||||
function d(a,b){function d(a,b){for(var d=[];a!==b;a=a.nextSibling)d.push(a);for(b=0;b<d.length;b++)B(c,d[b])}t(a,"insertAdjacentHTML",function(a,c){a=a.toLowerCase();if("beforebegin"===a){var e=this.previousSibling;b.call(this,a,c);d(e||this.parentNode.firstChild,this)}else if("afterbegin"===a)e=this.firstChild,b.call(this,a,c),d(this.firstChild,e);else if("beforeend"===a)e=this.lastChild,b.call(this,a,c),d(e||this.firstChild,null);else if("afterend"===a)e=this.nextSibling,b.call(this,a,c),d(this.nextSibling,
|
||||
e);else throw new SyntaxError("The value provided ("+String(a)+") is not one of 'beforebegin', 'afterbegin', 'beforeend', or 'afterend'.");})}var c=X;O&&t(Element.prototype,"attachShadow",function(a){return this.__CE_shadowRoot=a=O.call(this,a)});P&&P.get?b(Element.prototype,P):W&&W.get?b(HTMLElement.prototype,W):v(c,function(a){b(a,{enumerable:!0,configurable:!0,get:function(){return I.call(this,!0).innerHTML},set:function(a){var b="template"===this.localName,c=b?this.content:this,d=H.call(document,
|
||||
this.namespaceURI,this.localName);for(d.innerHTML=a;0<c.childNodes.length;)L.call(c,c.childNodes[0]);for(a=b?d.content:d;0<a.childNodes.length;)J.call(c,a.childNodes[0])}})});t(Element.prototype,"setAttribute",function(a,b){if(1!==this.__CE_state)return R.call(this,a,b);var d=Q.call(this,a);R.call(this,a,b);b=Q.call(this,a);c.attributeChangedCallback(this,a,d,b,null)});t(Element.prototype,"setAttributeNS",function(a,b,d){if(1!==this.__CE_state)return U.call(this,a,b,d);var e=T.call(this,a,b);U.call(this,
|
||||
a,b,d);d=T.call(this,a,b);c.attributeChangedCallback(this,b,e,d,a)});t(Element.prototype,"removeAttribute",function(a){if(1!==this.__CE_state)return S.call(this,a);var b=Q.call(this,a);S.call(this,a);null!==b&&c.attributeChangedCallback(this,a,b,null,null)});t(Element.prototype,"removeAttributeNS",function(a,b){if(1!==this.__CE_state)return ka.call(this,a,b);var d=T.call(this,a,b);ka.call(this,a,b);var e=T.call(this,a,b);d!==e&&c.attributeChangedCallback(this,b,d,e,a)});ta?a(HTMLElement.prototype,
|
||||
ta):la?a(Element.prototype,la):console.warn("Custom Elements: `Element#insertAdjacentElement` was not patched.");ua?d(HTMLElement.prototype,ua):ma?d(Element.prototype,ma):console.warn("Custom Elements: `Element#insertAdjacentHTML` was not patched.");Y(c,Element.prototype,{g:na,append:oa});za(c)};/*
|
||||
|
||||
Copyright (c) 2016 The Polymer Project Authors. All rights reserved.
|
||||
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
||||
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
||||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
||||
Code distributed by Google as part of the polymer project is also
|
||||
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
||||
*/
|
||||
var Z=window.customElements;if(!Z||Z.forcePolyfill||"function"!=typeof Z.define||"function"!=typeof Z.get){var X=new u;wa();xa();Y(X,DocumentFragment.prototype,{g:ia,append:ja});ya();Aa();window.addEventListener("turbolinks:before-render",function(){A(X,document.body)});window.addEventListener("turbolinks:load",function(){y(X,document.body)});document.__CE_hasRegistry=!0;var customElements=new F(X);Object.defineProperty(window,"customElements",{configurable:!0,enumerable:!0,value:customElements})};
|
||||
}).call(self);
|
||||
|
||||
//# sourceMappingURL=custom-elements.min.js.map
|
||||
1
staticfiles/material/js/custom-elements.min.js.map
Normal file
1
staticfiles/material/js/custom-elements.min.js.map
Normal file
File diff suppressed because one or more lines are too long
675
staticfiles/material/js/dataTables.fixedHeader.js
Normal file
675
staticfiles/material/js/dataTables.fixedHeader.js
Normal file
@@ -0,0 +1,675 @@
|
||||
/*! FixedHeader 3.1.3-dev
|
||||
* ©2009-2016 SpryMedia Ltd - datatables.net/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @summary FixedHeader
|
||||
* @description Fix a table's header or footer, so it is always visible while
|
||||
* scrolling
|
||||
* @version 3.1.3-dev
|
||||
* @file dataTables.fixedHeader.js
|
||||
* @author SpryMedia Ltd (www.sprymedia.co.uk)
|
||||
* @contact www.sprymedia.co.uk/contact
|
||||
* @copyright Copyright 2009-2016 SpryMedia Ltd.
|
||||
*
|
||||
* This source file is free software, available under the following license:
|
||||
* MIT license - http://datatables.net/license/mit
|
||||
*
|
||||
* This source file is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details.
|
||||
*
|
||||
* For details please refer to: http://www.datatables.net
|
||||
*/
|
||||
|
||||
(function( factory ){
|
||||
if ( typeof define === 'function' && define.amd ) {
|
||||
// AMD
|
||||
define( ['jquery', 'datatables.net'], function ( $ ) {
|
||||
return factory( $, window, document );
|
||||
} );
|
||||
}
|
||||
else if ( typeof exports === 'object' ) {
|
||||
// CommonJS
|
||||
module.exports = function (root, $) {
|
||||
if ( ! root ) {
|
||||
root = window;
|
||||
}
|
||||
|
||||
if ( ! $ || ! $.fn.dataTable ) {
|
||||
$ = require('datatables.net')(root, $).$;
|
||||
}
|
||||
|
||||
return factory( $, root, root.document );
|
||||
};
|
||||
}
|
||||
else {
|
||||
// Browser
|
||||
factory( jQuery, window, document );
|
||||
}
|
||||
}(function( $, window, document, undefined ) {
|
||||
'use strict';
|
||||
var DataTable = $.fn.dataTable;
|
||||
|
||||
|
||||
var _instCounter = 0;
|
||||
|
||||
var FixedHeader = function ( dt, config ) {
|
||||
// Sanity check - you just know it will happen
|
||||
if ( ! (this instanceof FixedHeader) ) {
|
||||
throw "FixedHeader must be initialised with the 'new' keyword.";
|
||||
}
|
||||
|
||||
// Allow a boolean true for defaults
|
||||
if ( config === true ) {
|
||||
config = {};
|
||||
}
|
||||
|
||||
dt = new DataTable.Api( dt );
|
||||
|
||||
this.c = $.extend( true, {}, FixedHeader.defaults, config );
|
||||
|
||||
this.s = {
|
||||
dt: dt,
|
||||
position: {
|
||||
theadTop: 0,
|
||||
tbodyTop: 0,
|
||||
tfootTop: 0,
|
||||
tfootBottom: 0,
|
||||
width: 0,
|
||||
left: 0,
|
||||
tfootHeight: 0,
|
||||
theadHeight: 0,
|
||||
windowHeight: $(window).height(),
|
||||
visible: true
|
||||
},
|
||||
headerMode: null,
|
||||
footerMode: null,
|
||||
autoWidth: dt.settings()[0].oFeatures.bAutoWidth,
|
||||
namespace: '.dtfc'+(_instCounter++),
|
||||
scrollLeft: {
|
||||
header: -1,
|
||||
footer: -1
|
||||
},
|
||||
enable: true
|
||||
};
|
||||
|
||||
this.dom = {
|
||||
floatingHeader: null,
|
||||
thead: $(dt.table().header()),
|
||||
tbody: $(dt.table().body()),
|
||||
tfoot: $(dt.table().footer()),
|
||||
header: {
|
||||
host: null,
|
||||
floating: null,
|
||||
placeholder: null
|
||||
},
|
||||
footer: {
|
||||
host: null,
|
||||
floating: null,
|
||||
placeholder: null
|
||||
}
|
||||
};
|
||||
|
||||
this.dom.header.host = this.dom.thead.parent();
|
||||
this.dom.footer.host = this.dom.tfoot.parent();
|
||||
|
||||
var dtSettings = dt.settings()[0];
|
||||
if ( dtSettings._fixedHeader ) {
|
||||
throw "FixedHeader already initialised on table "+dtSettings.nTable.id;
|
||||
}
|
||||
|
||||
dtSettings._fixedHeader = this;
|
||||
|
||||
this._constructor();
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Variable: FixedHeader
|
||||
* Purpose: Prototype for FixedHeader
|
||||
* Scope: global
|
||||
*/
|
||||
$.extend( FixedHeader.prototype, {
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* API methods
|
||||
*/
|
||||
|
||||
/**
|
||||
* Enable / disable the fixed elements
|
||||
*
|
||||
* @param {boolean} enable `true` to enable, `false` to disable
|
||||
*/
|
||||
enable: function ( enable )
|
||||
{
|
||||
this.s.enable = enable;
|
||||
|
||||
if ( this.c.header ) {
|
||||
this._modeChange( 'in-place', 'header', true );
|
||||
}
|
||||
|
||||
if ( this.c.footer && this.dom.tfoot.length ) {
|
||||
this._modeChange( 'in-place', 'footer', true );
|
||||
}
|
||||
|
||||
this.update();
|
||||
},
|
||||
|
||||
/**
|
||||
* Set header offset
|
||||
*
|
||||
* @param {int} new value for headerOffset
|
||||
*/
|
||||
headerOffset: function ( offset )
|
||||
{
|
||||
if ( offset !== undefined ) {
|
||||
this.c.headerOffset = offset;
|
||||
this.update();
|
||||
}
|
||||
|
||||
return this.c.headerOffset;
|
||||
},
|
||||
|
||||
/**
|
||||
* Set footer offset
|
||||
*
|
||||
* @param {int} new value for footerOffset
|
||||
*/
|
||||
footerOffset: function ( offset )
|
||||
{
|
||||
if ( offset !== undefined ) {
|
||||
this.c.footerOffset = offset;
|
||||
this.update();
|
||||
}
|
||||
|
||||
return this.c.footerOffset;
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Recalculate the position of the fixed elements and force them into place
|
||||
*/
|
||||
update: function ()
|
||||
{
|
||||
this._positions();
|
||||
this._scroll( true );
|
||||
},
|
||||
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Constructor
|
||||
*/
|
||||
|
||||
/**
|
||||
* FixedHeader constructor - adding the required event listeners and
|
||||
* simple initialisation
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
_constructor: function ()
|
||||
{
|
||||
var that = this;
|
||||
var dt = this.s.dt;
|
||||
|
||||
$(window)
|
||||
.on( 'scroll'+this.s.namespace, function () {
|
||||
that._scroll();
|
||||
} )
|
||||
.on( 'resize'+this.s.namespace, function () {
|
||||
that.s.position.windowHeight = $(window).height();
|
||||
that.update();
|
||||
} );
|
||||
|
||||
var autoHeader = $('.fh-fixedHeader');
|
||||
if ( ! this.c.headerOffset && autoHeader.length ) {
|
||||
this.c.headerOffset = autoHeader.outerHeight();
|
||||
}
|
||||
|
||||
var autoFooter = $('.fh-fixedFooter');
|
||||
if ( ! this.c.footerOffset && autoFooter.length ) {
|
||||
this.c.footerOffset = autoFooter.outerHeight();
|
||||
}
|
||||
|
||||
dt.on( 'column-reorder.dt.dtfc column-visibility.dt.dtfc draw.dt.dtfc column-sizing.dt.dtfc', function () {
|
||||
that.update();
|
||||
} );
|
||||
|
||||
dt.on( 'destroy.dtfc', function () {
|
||||
dt.off( '.dtfc' );
|
||||
$(window).off( that.s.namespace );
|
||||
} );
|
||||
|
||||
this._positions();
|
||||
this._scroll();
|
||||
},
|
||||
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Private methods
|
||||
*/
|
||||
|
||||
/**
|
||||
* Clone a fixed item to act as a place holder for the original element
|
||||
* which is moved into a clone of the table element, and moved around the
|
||||
* document to give the fixed effect.
|
||||
*
|
||||
* @param {string} item 'header' or 'footer'
|
||||
* @param {boolean} force Force the clone to happen, or allow automatic
|
||||
* decision (reuse existing if available)
|
||||
* @private
|
||||
*/
|
||||
_clone: function ( item, force )
|
||||
{
|
||||
var dt = this.s.dt;
|
||||
var itemDom = this.dom[ item ];
|
||||
var itemElement = item === 'header' ?
|
||||
this.dom.thead :
|
||||
this.dom.tfoot;
|
||||
|
||||
if ( ! force && itemDom.floating ) {
|
||||
// existing floating element - reuse it
|
||||
itemDom.floating.removeClass( 'fixedHeader-floating fixedHeader-locked' );
|
||||
}
|
||||
else {
|
||||
if ( itemDom.floating ) {
|
||||
itemDom.placeholder.remove();
|
||||
this._unsize( item );
|
||||
itemDom.floating.children().detach();
|
||||
itemDom.floating.remove();
|
||||
}
|
||||
|
||||
itemDom.floating = $( dt.table().node().cloneNode( false ) )
|
||||
.css( 'table-layout', 'fixed' )
|
||||
.removeAttr( 'id' )
|
||||
.append( itemElement )
|
||||
.appendTo( 'body' );
|
||||
|
||||
// Insert a fake thead/tfoot into the DataTable to stop it jumping around
|
||||
var clonedElement = itemElement.clone( false )
|
||||
clonedElement.find("*[id]").attr('id',function(i,id){ return id+"_cloned"; });
|
||||
clonedElement.find("*[for]").attr('for',function(i,id){ return id+"_cloned"; });
|
||||
itemDom.placeholder = clonedElement;
|
||||
itemDom.host.prepend( itemDom.placeholder );
|
||||
|
||||
// Clone widths
|
||||
this._matchWidths( itemDom.placeholder, itemDom.floating );
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Copy widths from the cells in one element to another. This is required
|
||||
* for the footer as the footer in the main table takes its sizes from the
|
||||
* header columns. That isn't present in the footer so to have it still
|
||||
* align correctly, the sizes need to be copied over. It is also required
|
||||
* for the header when auto width is not enabled
|
||||
*
|
||||
* @param {jQuery} from Copy widths from
|
||||
* @param {jQuery} to Copy widths to
|
||||
* @private
|
||||
*/
|
||||
_matchWidths: function ( from, to ) {
|
||||
var get = function ( name ) {
|
||||
return $(name, from)
|
||||
.map( function () {
|
||||
return $(this).outerWidth();
|
||||
} ).toArray();
|
||||
};
|
||||
|
||||
var set = function ( name, toWidths ) {
|
||||
$(name, to).each( function ( i ) {
|
||||
$(this).css( {
|
||||
width: toWidths[i],
|
||||
minWidth: toWidths[i]
|
||||
} );
|
||||
} );
|
||||
};
|
||||
|
||||
var thWidths = get( 'th' );
|
||||
var tdWidths = get( 'td' );
|
||||
|
||||
set( 'th', thWidths );
|
||||
set( 'td', tdWidths );
|
||||
},
|
||||
|
||||
/**
|
||||
* Remove assigned widths from the cells in an element. This is required
|
||||
* when inserting the footer back into the main table so the size is defined
|
||||
* by the header columns and also when auto width is disabled in the
|
||||
* DataTable.
|
||||
*
|
||||
* @param {string} item The `header` or `footer`
|
||||
* @private
|
||||
*/
|
||||
_unsize: function ( item ) {
|
||||
var el = this.dom[ item ].floating;
|
||||
|
||||
if ( el && (item === 'footer' || (item === 'header' && ! this.s.autoWidth)) ) {
|
||||
$('th, td', el).css( {
|
||||
width: '',
|
||||
minWidth: ''
|
||||
} );
|
||||
}
|
||||
else if ( el && item === 'header' ) {
|
||||
$('th, td', el).css( 'min-width', '' );
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Reposition the floating elements to take account of horizontal page
|
||||
* scroll
|
||||
*
|
||||
* @param {string} item The `header` or `footer`
|
||||
* @param {int} scrollLeft Document scrollLeft
|
||||
* @private
|
||||
*/
|
||||
_horizontal: function ( item, scrollLeft )
|
||||
{
|
||||
var itemDom = this.dom[ item ];
|
||||
var position = this.s.position;
|
||||
var lastScrollLeft = this.s.scrollLeft;
|
||||
|
||||
if ( itemDom.floating && lastScrollLeft[ item ] !== scrollLeft ) {
|
||||
itemDom.floating.css( 'left', position.left - scrollLeft );
|
||||
|
||||
lastScrollLeft[ item ] = scrollLeft;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Change from one display mode to another. Each fixed item can be in one
|
||||
* of:
|
||||
*
|
||||
* * `in-place` - In the main DataTable
|
||||
* * `in` - Floating over the DataTable
|
||||
* * `below` - (Header only) Fixed to the bottom of the table body
|
||||
* * `above` - (Footer only) Fixed to the top of the table body
|
||||
*
|
||||
* @param {string} mode Mode that the item should be shown in
|
||||
* @param {string} item 'header' or 'footer'
|
||||
* @param {boolean} forceChange Force a redraw of the mode, even if already
|
||||
* in that mode.
|
||||
* @private
|
||||
*/
|
||||
_modeChange: function ( mode, item, forceChange )
|
||||
{
|
||||
var dt = this.s.dt;
|
||||
var itemDom = this.dom[ item ];
|
||||
var position = this.s.position;
|
||||
|
||||
// Record focus. Browser's will cause input elements to loose focus if
|
||||
// they are inserted else where in the doc
|
||||
var tablePart = this.dom[ item==='footer' ? 'tfoot' : 'thead' ];
|
||||
var focus = $.contains( tablePart[0], document.activeElement ) ?
|
||||
document.activeElement :
|
||||
null;
|
||||
|
||||
if ( mode === 'in-place' ) {
|
||||
// Insert the header back into the table's real header
|
||||
if ( itemDom.placeholder ) {
|
||||
itemDom.placeholder.remove();
|
||||
itemDom.placeholder = null;
|
||||
}
|
||||
|
||||
this._unsize( item );
|
||||
|
||||
if ( item === 'header' ) {
|
||||
itemDom.host.prepend( this.dom.thead );
|
||||
}
|
||||
else {
|
||||
itemDom.host.append( this.dom.tfoot );
|
||||
}
|
||||
|
||||
if ( itemDom.floating ) {
|
||||
itemDom.floating.remove();
|
||||
itemDom.floating = null;
|
||||
}
|
||||
}
|
||||
else if ( mode === 'in' ) {
|
||||
// Remove the header from the read header and insert into a fixed
|
||||
// positioned floating table clone
|
||||
this._clone( item, forceChange );
|
||||
|
||||
itemDom.floating
|
||||
.addClass( 'fixedHeader-floating' )
|
||||
.css( item === 'header' ? 'top' : 'bottom', this.c[item+'Offset'] )
|
||||
.css( 'left', position.left+'px' )
|
||||
.css( 'width', position.width+'px' );
|
||||
|
||||
if ( item === 'footer' ) {
|
||||
itemDom.floating.css( 'top', '' );
|
||||
}
|
||||
}
|
||||
else if ( mode === 'below' ) { // only used for the header
|
||||
// Fix the position of the floating header at base of the table body
|
||||
this._clone( item, forceChange );
|
||||
|
||||
itemDom.floating
|
||||
.addClass( 'fixedHeader-locked' )
|
||||
.css( 'top', position.tfootTop - position.theadHeight )
|
||||
.css( 'left', position.left+'px' )
|
||||
.css( 'width', position.width+'px' );
|
||||
}
|
||||
else if ( mode === 'above' ) { // only used for the footer
|
||||
// Fix the position of the floating footer at top of the table body
|
||||
this._clone( item, forceChange );
|
||||
|
||||
itemDom.floating
|
||||
.addClass( 'fixedHeader-locked' )
|
||||
.css( 'top', position.tbodyTop )
|
||||
.css( 'left', position.left+'px' )
|
||||
.css( 'width', position.width+'px' );
|
||||
}
|
||||
|
||||
// Restore focus if it was lost
|
||||
if ( focus && focus !== document.activeElement ) {
|
||||
focus.focus();
|
||||
}
|
||||
|
||||
this.s.scrollLeft.header = -1;
|
||||
this.s.scrollLeft.footer = -1;
|
||||
this.s[item+'Mode'] = mode;
|
||||
},
|
||||
|
||||
/**
|
||||
* Cache the positional information that is required for the mode
|
||||
* calculations that FixedHeader performs.
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
_positions: function ()
|
||||
{
|
||||
var dt = this.s.dt;
|
||||
var table = dt.table();
|
||||
var position = this.s.position;
|
||||
var dom = this.dom;
|
||||
var tableNode = $(table.node());
|
||||
|
||||
// Need to use the header and footer that are in the main table,
|
||||
// regardless of if they are clones, since they hold the positions we
|
||||
// want to measure from
|
||||
var thead = tableNode.children('thead');
|
||||
var tfoot = tableNode.children('tfoot');
|
||||
var tbody = dom.tbody;
|
||||
|
||||
position.visible = tableNode.is(':visible');
|
||||
position.width = tableNode.outerWidth();
|
||||
position.left = tableNode.offset().left;
|
||||
position.theadTop = thead.offset().top;
|
||||
position.tbodyTop = tbody.offset().top;
|
||||
position.theadHeight = position.tbodyTop - position.theadTop;
|
||||
|
||||
if ( tfoot.length ) {
|
||||
position.tfootTop = tfoot.offset().top;
|
||||
position.tfootBottom = position.tfootTop + tfoot.outerHeight();
|
||||
position.tfootHeight = position.tfootBottom - position.tfootTop;
|
||||
}
|
||||
else {
|
||||
position.tfootTop = position.tbodyTop + tbody.outerHeight();
|
||||
position.tfootBottom = position.tfootTop;
|
||||
position.tfootHeight = position.tfootTop;
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Mode calculation - determine what mode the fixed items should be placed
|
||||
* into.
|
||||
*
|
||||
* @param {boolean} forceChange Force a redraw of the mode, even if already
|
||||
* in that mode.
|
||||
* @private
|
||||
*/
|
||||
_scroll: function ( forceChange )
|
||||
{
|
||||
var windowTop = $(document).scrollTop();
|
||||
var windowLeft = $(document).scrollLeft();
|
||||
var position = this.s.position;
|
||||
var headerMode, footerMode;
|
||||
|
||||
if ( ! this.s.enable ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( this.c.header ) {
|
||||
if ( ! position.visible || windowTop <= position.theadTop - this.c.headerOffset ) {
|
||||
headerMode = 'in-place';
|
||||
}
|
||||
else if ( windowTop <= position.tfootTop - position.theadHeight - this.c.headerOffset ) {
|
||||
headerMode = 'in';
|
||||
}
|
||||
else {
|
||||
headerMode = 'below';
|
||||
}
|
||||
|
||||
if ( forceChange || headerMode !== this.s.headerMode ) {
|
||||
this._modeChange( headerMode, 'header', forceChange );
|
||||
}
|
||||
|
||||
this._horizontal( 'header', windowLeft );
|
||||
}
|
||||
|
||||
if ( this.c.footer && this.dom.tfoot.length ) {
|
||||
if ( ! position.visible || windowTop + position.windowHeight >= position.tfootBottom + this.c.footerOffset ) {
|
||||
footerMode = 'in-place';
|
||||
}
|
||||
else if ( position.windowHeight + windowTop > position.tbodyTop + position.tfootHeight + this.c.footerOffset ) {
|
||||
footerMode = 'in';
|
||||
}
|
||||
else {
|
||||
footerMode = 'above';
|
||||
}
|
||||
|
||||
if ( forceChange || footerMode !== this.s.footerMode ) {
|
||||
this._modeChange( footerMode, 'footer', forceChange );
|
||||
}
|
||||
|
||||
this._horizontal( 'footer', windowLeft );
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
|
||||
/**
|
||||
* Version
|
||||
* @type {String}
|
||||
* @static
|
||||
*/
|
||||
FixedHeader.version = "3.1.3-dev";
|
||||
|
||||
/**
|
||||
* Defaults
|
||||
* @type {Object}
|
||||
* @static
|
||||
*/
|
||||
FixedHeader.defaults = {
|
||||
header: true,
|
||||
footer: false,
|
||||
headerOffset: 0,
|
||||
footerOffset: 0
|
||||
};
|
||||
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* DataTables interfaces
|
||||
*/
|
||||
|
||||
// Attach for constructor access
|
||||
$.fn.dataTable.FixedHeader = FixedHeader;
|
||||
$.fn.DataTable.FixedHeader = FixedHeader;
|
||||
|
||||
|
||||
// DataTables creation - check if the FixedHeader option has been defined on the
|
||||
// table and if so, initialise
|
||||
$(document).on( 'init.dt.dtfh', function (e, settings, json) {
|
||||
if ( e.namespace !== 'dt' ) {
|
||||
return;
|
||||
}
|
||||
|
||||
var init = settings.oInit.fixedHeader;
|
||||
var defaults = DataTable.defaults.fixedHeader;
|
||||
|
||||
if ( (init || defaults) && ! settings._fixedHeader ) {
|
||||
var opts = $.extend( {}, defaults, init );
|
||||
|
||||
if ( init !== false ) {
|
||||
new FixedHeader( settings, opts );
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
// DataTables API methods
|
||||
DataTable.Api.register( 'fixedHeader()', function () {} );
|
||||
|
||||
DataTable.Api.register( 'fixedHeader.adjust()', function () {
|
||||
return this.iterator( 'table', function ( ctx ) {
|
||||
var fh = ctx._fixedHeader;
|
||||
|
||||
if ( fh ) {
|
||||
fh.update();
|
||||
}
|
||||
} );
|
||||
} );
|
||||
|
||||
DataTable.Api.register( 'fixedHeader.enable()', function ( flag ) {
|
||||
return this.iterator( 'table', function ( ctx ) {
|
||||
var fh = ctx._fixedHeader;
|
||||
|
||||
if ( fh ) {
|
||||
fh.enable( flag !== undefined ? flag : true );
|
||||
}
|
||||
} );
|
||||
} );
|
||||
|
||||
DataTable.Api.register( 'fixedHeader.disable()', function ( ) {
|
||||
return this.iterator( 'table', function ( ctx ) {
|
||||
var fh = ctx._fixedHeader;
|
||||
|
||||
if ( fh ) {
|
||||
fh.enable( false );
|
||||
}
|
||||
} );
|
||||
} );
|
||||
|
||||
$.each( ['header', 'footer'], function ( i, el ) {
|
||||
DataTable.Api.register( 'fixedHeader.'+el+'Offset()', function ( offset ) {
|
||||
var ctx = this.context;
|
||||
|
||||
if ( offset === undefined ) {
|
||||
return ctx.length && ctx[0]._fixedHeader ?
|
||||
ctx[0]._fixedHeader[el +'Offset']() :
|
||||
undefined;
|
||||
}
|
||||
|
||||
return this.iterator( 'table', function ( ctx ) {
|
||||
var fh = ctx._fixedHeader;
|
||||
|
||||
if ( fh ) {
|
||||
fh[ el +'Offset' ]( offset );
|
||||
}
|
||||
} );
|
||||
} );
|
||||
} );
|
||||
|
||||
|
||||
return FixedHeader;
|
||||
}));
|
||||
1474
staticfiles/material/js/dataTables.responsive.js
Normal file
1474
staticfiles/material/js/dataTables.responsive.js
Normal file
File diff suppressed because it is too large
Load Diff
41
staticfiles/material/js/jquery.activeNavigation.js
Normal file
41
staticfiles/material/js/jquery.activeNavigation.js
Normal file
@@ -0,0 +1,41 @@
|
||||
(function( $ ) {
|
||||
function getUrlParameter(sParam)
|
||||
{
|
||||
var sPageURL = window.location.search.substring(1);
|
||||
var sURLVariables = sPageURL.split('&');
|
||||
for (var i = 0; i < sURLVariables.length; i++)
|
||||
{
|
||||
var sParameterName = sURLVariables[i].split('=');
|
||||
if (sParameterName[0] == sParam)
|
||||
{
|
||||
return decodeURIComponent(sParameterName[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$.fn.activeNavigation = function(selector) {
|
||||
var pathname = getUrlParameter('back') || window.location.pathname;
|
||||
|
||||
var hrefs = [];
|
||||
$(selector).find("a:not(.no-navigation)").each(function() {
|
||||
if (pathname.indexOf($(this).attr("href")) > -1)
|
||||
hrefs.push($(this));
|
||||
})
|
||||
|
||||
if (hrefs.length) {
|
||||
hrefs.sort(function(a,b){
|
||||
return b.attr("href").length - a.attr("href").length;
|
||||
})
|
||||
var href = hrefs[0];
|
||||
for(var i=1; i< hrefs.length; i++) {
|
||||
if(hrefs[i].attr('href') === href.attr('href')) {
|
||||
href = hrefs[i];
|
||||
}
|
||||
}
|
||||
$(selector).find("li").removeClass("active");
|
||||
href.parents('li').addClass('active');
|
||||
href.parent('li').closest('.collapsible-body').css('display', "block");
|
||||
href.parent('li').closest('.collapsible-body').parent('li').addClass('active');
|
||||
}
|
||||
};
|
||||
})(jQuery);
|
||||
15296
staticfiles/material/js/jquery.dataTables.js
vendored
Normal file
15296
staticfiles/material/js/jquery.dataTables.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
2911
staticfiles/material/js/jquery.datetimepicker.full.js
Normal file
2911
staticfiles/material/js/jquery.datetimepicker.full.js
Normal file
File diff suppressed because one or more lines are too long
227
staticfiles/material/js/jquery.formset.js
Normal file
227
staticfiles/material/js/jquery.formset.js
Normal file
@@ -0,0 +1,227 @@
|
||||
/**
|
||||
* Django formset helper
|
||||
* Copyright (c) 2013, Ionata Web Solutions
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
* list of conditions and the following disclaimer in the documentation and/or
|
||||
* other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
(function($) {
|
||||
"use strict";
|
||||
|
||||
var pluginName = 'formset';
|
||||
|
||||
/**
|
||||
* Wraps up a formset, allowing adding, and removing forms
|
||||
*/
|
||||
var Formset = function(el, options) {
|
||||
var _this = this;
|
||||
|
||||
//Defaults:
|
||||
this.opts = $.extend({}, Formset.defaults, options);
|
||||
|
||||
this.$formset = $(el);
|
||||
this.$emptyForm = this.$formset.find(this.opts.emptyForm);
|
||||
this.$body = this.$formset.find(this.opts.body);
|
||||
this.$add = this.$formset.find(this.opts.add);
|
||||
|
||||
this.formsetPrefix = $(el).data('formset-prefix');
|
||||
|
||||
// Bind to the `Add form` button
|
||||
this.addForm = $.proxy(this, 'addForm');
|
||||
this.$add.click(this.addForm);
|
||||
|
||||
// Bind receiver to `formAdded` and `formDeleted` events
|
||||
this.$formset.on('formAdded formDeleted', this.opts.form, $.proxy(this, 'checkMaxForms'));
|
||||
|
||||
// Set up the existing forms
|
||||
this.$forms().each(function(i, form) {
|
||||
var $form = $(form);
|
||||
_this.bindForm($(this), i);
|
||||
});
|
||||
|
||||
// Store a reference to this in the formset element
|
||||
this.$formset.data(pluginName, this);
|
||||
|
||||
var extras = ['animateForms'];
|
||||
$.each(extras, function(i, extra) {
|
||||
if ((extra in _this.opts) && (_this.opts[extra])) {
|
||||
_this[extra]();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Formset.defaults = {
|
||||
form: '[data-formset-form]',
|
||||
emptyForm: 'script[type=form-template][data-formset-empty-form]',
|
||||
body: '[data-formset-body]',
|
||||
add: '[data-formset-add]',
|
||||
deleteButton: '[data-formset-delete-button]',
|
||||
hasMaxFormsClass: 'has-max-forms',
|
||||
animateForms: false,
|
||||
newFormCallback: false
|
||||
};
|
||||
|
||||
Formset.prototype.addForm = function() {
|
||||
// Don't proceed if the number of maximum forms has been reached
|
||||
if (this.hasMaxForms()) {
|
||||
throw new Error("MAX_NUM_FORMS reached");
|
||||
}
|
||||
|
||||
var newIndex = this.totalFormCount();
|
||||
this.$managementForm('TOTAL_FORMS').val(newIndex + 1);
|
||||
|
||||
var newFormHtml = this.$emptyForm.html()
|
||||
.replace(new RegExp('__prefix__', 'g'), newIndex)
|
||||
.replace(new RegExp('<\\\\/script>', 'g'), '</script>');
|
||||
|
||||
var $newFormFragment = $($.parseHTML(newFormHtml, this.$body.document, true));
|
||||
this.$body.append($newFormFragment);
|
||||
|
||||
var $newForm = $newFormFragment.filter(this.opts.form);
|
||||
this.bindForm($newForm, newIndex);
|
||||
if(this.opts.newFormCallback) {
|
||||
this.opts.newFormCallback($newForm);
|
||||
}
|
||||
return $newForm;
|
||||
};
|
||||
|
||||
/**
|
||||
* Attach any events needed to a new form
|
||||
*/
|
||||
Formset.prototype.bindForm = function($form, index) {
|
||||
var prefix = this.formsetPrefix + '-' + index;
|
||||
$form.data(pluginName + '__formPrefix', prefix);
|
||||
|
||||
var $delete = $form.find('[name=' + prefix + '-DELETE]');
|
||||
|
||||
// Trigger `formAdded` / `formDeleted` events when delete checkbox value changes
|
||||
$delete.change(function(event) {
|
||||
if ($delete.is(':checked')) {
|
||||
$form.attr('data-formset-form-deleted', '');
|
||||
// Remove required property and pattern attribute to allow submit, back it up to data field
|
||||
$form.find(':required').data(pluginName + '-required-field', true).prop('required', false);
|
||||
$form.find('input[pattern]').each(function() {
|
||||
var pattern = $(this).attr('pattern');
|
||||
$(this).data(pluginName + '-field-pattern', pattern).removeAttr('pattern');
|
||||
});
|
||||
$form.trigger('formDeleted');
|
||||
} else {
|
||||
$form.removeAttr('data-formset-form-deleted');
|
||||
// Restore required property and pattern attributes from data field
|
||||
$form.find('*').filter(function() {
|
||||
return $(this).data(pluginName + '-required-field') === true;
|
||||
}).prop('required', true);
|
||||
$form.find('input').each(function() {
|
||||
var pattern = $(this).data(pluginName + '-field-pattern');
|
||||
if (pattern) {
|
||||
$(this).attr('pattern', pattern);
|
||||
}
|
||||
});
|
||||
$form.trigger('formAdded');
|
||||
}
|
||||
}).trigger('change');
|
||||
|
||||
var $deleteButton = $form.find(this.opts.deleteButton);
|
||||
|
||||
$deleteButton.bind('click', function() {
|
||||
$delete.attr('checked', true).change();
|
||||
});
|
||||
};
|
||||
|
||||
Formset.prototype.$forms = function() {
|
||||
return this.$body.find(this.opts.form);
|
||||
};
|
||||
Formset.prototype.$managementForm = function(name) {
|
||||
return this.$formset.find('[name=' + this.formsetPrefix + '-' + name + ']');
|
||||
};
|
||||
|
||||
Formset.prototype.totalFormCount = function() {
|
||||
return this.$forms().length;
|
||||
};
|
||||
|
||||
Formset.prototype.deletedFormCount = function() {
|
||||
return this.$forms().filter('[data-formset-form-deleted]').length;
|
||||
};
|
||||
|
||||
Formset.prototype.activeFormCount = function() {
|
||||
return this.totalFormCount() - this.deletedFormCount();
|
||||
};
|
||||
|
||||
Formset.prototype.hasMaxForms = function() {
|
||||
var maxForms = parseInt(this.$managementForm('MAX_NUM_FORMS').val(), 10) || 1000;
|
||||
return this.activeFormCount() >= maxForms;
|
||||
};
|
||||
|
||||
Formset.prototype.checkMaxForms = function() {
|
||||
if (this.hasMaxForms()) {
|
||||
this.$formset.addClass(this.opts.hasMaxFormsClass);
|
||||
this.$add.attr('disabled', 'disabled');
|
||||
} else {
|
||||
this.$formset.removeClass(this.opts.hasMaxFormsClass);
|
||||
this.$add.removeAttr('disabled');
|
||||
}
|
||||
};
|
||||
|
||||
Formset.prototype.animateForms = function() {
|
||||
this.$formset.on('formAdded', this.opts.form, function() {
|
||||
var $form = $(this);
|
||||
$form.slideUp(0);
|
||||
$form.slideDown();
|
||||
}).on('formDeleted', this.opts.form, function() {
|
||||
var $form = $(this);
|
||||
$form.slideUp();
|
||||
});
|
||||
this.$forms().filter('[data-formset-form-deleted]').slideUp(0);
|
||||
};
|
||||
|
||||
Formset.getOrCreate = function(el, options) {
|
||||
var rev = $(el).data(pluginName);
|
||||
if (!rev) {
|
||||
rev = new Formset(el, options);
|
||||
}
|
||||
|
||||
return rev;
|
||||
};
|
||||
|
||||
$.fn[pluginName] = function() {
|
||||
var options, fn, args;
|
||||
// Create a new Formset for each element
|
||||
if (arguments.length === 0 || (arguments.length === 1 && $.type(arguments[0]) != 'string')) {
|
||||
options = arguments[0];
|
||||
return this.each(function() {
|
||||
return Formset.getOrCreate(this, options);
|
||||
});
|
||||
}
|
||||
|
||||
// Call a function on each Formset in the selector
|
||||
fn = arguments[0];
|
||||
args = $.makeArray(arguments).slice(1);
|
||||
|
||||
if (fn in Formset) {
|
||||
// Call the Formset class method if it exists
|
||||
args.unshift(this);
|
||||
return Formset[fn].apply(Formset, args);
|
||||
} else {
|
||||
throw new Error("Unknown function call " + fn + " for $.fn.formset");
|
||||
}
|
||||
};
|
||||
})(jQuery);
|
||||
10881
staticfiles/material/js/jquery.js
vendored
Normal file
10881
staticfiles/material/js/jquery.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1050
staticfiles/material/js/materialize.components.js
Normal file
1050
staticfiles/material/js/materialize.components.js
Normal file
File diff suppressed because it is too large
Load Diff
104
staticfiles/material/js/materialize.frontend.min.js
vendored
Normal file
104
staticfiles/material/js/materialize.frontend.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
12382
staticfiles/material/js/materialize.js
vendored
Normal file
12382
staticfiles/material/js/materialize.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
36
staticfiles/material/js/native-shim.js
Normal file
36
staticfiles/material/js/native-shim.js
Normal file
@@ -0,0 +1,36 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* @license
|
||||
* Copyright (c) 2016 The Polymer Project Authors. All rights reserved.
|
||||
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
||||
* The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
||||
* The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
||||
* Code distributed by Google as part of the polymer project is also
|
||||
* subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
||||
*/
|
||||
|
||||
/**
|
||||
* This shim allows elements written in, or compiled to, ES5 to work on native
|
||||
* implementations of Custom Elements v1. It sets new.target to the value of
|
||||
* this.constructor so that the native HTMLElement constructor can access the
|
||||
* current under-construction element's definition.
|
||||
*/
|
||||
(function () {
|
||||
if (
|
||||
// No Reflect, no classes, no need for shim because native custom elements
|
||||
// require ES2015 classes or Reflect.
|
||||
window.Reflect === undefined || window.customElements === undefined ||
|
||||
// The webcomponentsjs custom elements polyfill doesn't require
|
||||
// ES2015-compatible construction (`super()` or `Reflect.construct`).
|
||||
window.customElements.hasOwnProperty('polyfillWrapFlushCallback')) {
|
||||
return;
|
||||
}
|
||||
var BuiltInHTMLElement = HTMLElement;
|
||||
window.HTMLElement = function HTMLElement() {
|
||||
return Reflect.construct(BuiltInHTMLElement, [], this.constructor);
|
||||
};
|
||||
HTMLElement.prototype = BuiltInHTMLElement.prototype;
|
||||
HTMLElement.prototype.constructor = HTMLElement;
|
||||
Object.setPrototypeOf(HTMLElement, BuiltInHTMLElement);
|
||||
})();
|
||||
20
staticfiles/material/js/perfect-scrollbar.min.js
vendored
Normal file
20
staticfiles/material/js/perfect-scrollbar.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
staticfiles/material/js/perfect-scrollbar.min.js.map
Normal file
1
staticfiles/material/js/perfect-scrollbar.min.js.map
Normal file
File diff suppressed because one or more lines are too long
6
staticfiles/material/js/turbolinks.js
Normal file
6
staticfiles/material/js/turbolinks.js
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user