{{toast.title}}
{{toast.message | limitTo:500}} {{toast.button.title}} {{toast.button.title}}{{toast.button.title}}
diff --git a/dist/mw-uikit.js b/dist/mw-uikit.js index 4e2ab5ae..5395b313 100644 --- a/dist/mw-uikit.js +++ b/dist/mw-uikit.js @@ -41,7 +41,7 @@ //Will be replaced with the actual version number duringh the build process; //DO NOT TOUCH - root.mwUI.VERSION = '1.0.11-bv1.0.11'; + root.mwUI.VERSION = '1.0.12-b430'; angular.module("mwUI").run(["$templateCache", function($templateCache) { 'use strict'; @@ -1592,18 +1592,24 @@ mwUI.Backbone.Filterable = function (collectionInstance, options) { return _sortOrder; }; - this.setFilters = function (filterMap) { + this.setFilters = function (filterMap, options) { + options = options || {}; _.forEach(filterMap, function (value, key) { if (_.has(this.filterValues, key)) { this.filterValues[key] = value; + var filterValue = {}; + filterValue[key] = value; + if(_.isUndefined(options.silent) || !options.silent){ + collectionInstance.trigger('change:filterValue', filterValue); + } } else { throw new Error('Filter named \'' + key + '\' not found, did you add it to filterValues of the model?'); } }, this); + this.setPage(1); this.filterIsSet = true; - }; this.getFilters = function () { @@ -1905,6 +1911,37 @@ mwUI.Backbone.Selectable.Collection = function (collectionInstance, options) { }; + this.setCollectionFromSelection = function (collection) { + var selected = this.getSelected(); + if (collection instanceof mwUI.Backbone.Collection) { + collection.replace(selected.toJSON()); + } else { + throw new Error('[Selectable] The passed collection is not an instance of mwUI.Backbone.Collection'); + } + return collection; + }; + + this.setModelFromSelection = function (model) { + var selected = this.getSelected(); + if (model instanceof Backbone.Model) { + if (selected.length === 0) { + model.clear(); + } else { + model.set(selected.first().toJSON()); + } + } else { + throw new Error('[Selectable] The passed model is not an instance of Backbone.Model'); + } + return model; + }; + + this.useSelectionFor = function (modelOrCollection) { + if (modelOrCollection instanceof Backbone.Model) { + return this.setModelFromSelection(modelOrCollection); + } else if(modelOrCollection instanceof Backbone.Collection){ + return this.setCollectionFromSelection(modelOrCollection); + } + }; var main = function () { if (!(_collection instanceof Backbone.Collection)) { @@ -3912,6 +3949,10 @@ angular.module('mwUI.List') var newOffset; var throttledScrollFn = _.throttle(function () { + if(!el.is(':visible')){ + return; + } + if (!newOffset) { var headerOffset, headerHeight, diff --git a/dist/mw-uikit.min.js b/dist/mw-uikit.min.js index de74d6c3..078764c4 100644 --- a/dist/mw-uikit.min.js +++ b/dist/mw-uikit.min.js @@ -1,4 +1,4 @@ -!function(a,b){"use strict";b.module("mwUI",["mwUI.Backbone","mwUI.ExceptionHandler","mwUI.Form","mwUI.Inputs","mwUI.i18n","mwUI.Layout","mwUI.List","mwUI.Menu","mwUI.Modal","mwUI.ResponseHandler","mwUI.Toast","mwUI.ResponseToastHandler","mwUI.Utils","mwUI.UiComponents"]).config(["i18nProvider","mwIconProvider",function(a,b){a.addLocale("de_DE","Deutsch","de_DE.json"),a.addLocale("en_US","English (US)","en_US.json"),b.addIconSet({id:"mwUI",classPrefix:"fa",iconsUrl:"uikit/mw_ui_icons.json"},!0)}]).run(["i18n",function(a){a.setLocale("en_US")}]),window.mCAP=window.mCAP||{},a.mwUI={},a.mwUI.VERSION="1.0.11-bv1.0.11",b.module("mwUI").run(["$templateCache",function(a){a.put("uikit/mw-exception-handler/modals/templates/mw_exception_modal.html",'
{{\'ExceptionHandler.mwExceptionModal.unknownError\' | i18n}}
{{exception}}
{{\'ExceptionHandler.mwExceptionModal.userMessage\' | i18n}}
{{ \'List.mwListFooter.noneFound\' | i18n }}
{{ text }}
{{\'ExceptionHandler.mwExceptionModal.unknownError\' | i18n}}
{{exception}}
{{\'ExceptionHandler.mwExceptionModal.userMessage\' | i18n}}
{{ \'List.mwListFooter.noneFound\' | i18n }}
{{ text }}
{{\'ExceptionHandler.mwExceptionModal.unknownError\' | i18n}}
{{exception}}
{{\'ExceptionHandler.mwExceptionModal.userMessage\' | i18n}}
{{ \'List.mwListFooter.noneFound\' | i18n }}
{{\'ExceptionHandler.mwExceptionModal.unknownError\' | i18n}}
{{exception}}
{{\'ExceptionHandler.mwExceptionModal.userMessage\' | i18n}}
{{ \'List.mwListFooter.noneFound\' | i18n }}
{{ text }}
{{ 'markdownTooltip.description' | i18n }}
{{ 'markdownTooltip.link' | i18n }}
{{getFileName()}}
{{ text }}
{{ \'common.noneFound\' | i18n }}
[^\r]+?<\/pre>)/gm,function(a,b){var c=b;return c=c.replace(/^ /gm,"~0"),c=c.replace(/~0/g,"")}),d.subParser("hashBlock")("\n"+f+"\n",b,c)})}),d.subParser("codeBlocks",function(a,b,c){"use strict";a+="~0";var e=/(?:\n\n|^)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=~0))/g;return a=a.replace(e,function(a,e,f){var g=e,h=f,i="\n";return g=d.subParser("outdent")(g),g=d.subParser("encodeCode")(g),g=d.subParser("detab")(g),g=g.replace(/^\n+/g,""),g=g.replace(/\n+$/g,""),b.omitExtraWLInCodeBlocks&&(i=""),g="",d.subParser("hashBlock")(g,b,c)+h}),a=a.replace(/~0/,"")}),d.subParser("codeSpans",function(a){"use strict";return a=a.replace(/("+g+i+"
<]*?>)([^]*?)<\/code>/g,function(a,b,c){return c=c.replace(/^([ \t]*)/g,""),c=c.replace(/[ \t]*$/g,""),c=d.subParser("encodeCode")(c),b+c+"
"}),a=a.replace(/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm,function(a,b,c,e){var f=e;return f=f.replace(/^([ \t]*)/g,""),f=f.replace(/[ \t]*$/g,""),f=d.subParser("encodeCode")(f),b+""+f+"
"})}),d.subParser("detab",function(a){"use strict";return a=a.replace(/\t(?=\t)/g," "),a=a.replace(/\t/g,"~A~B"),a=a.replace(/~B(.+?)~A/g,function(a,b){for(var c=b,d=4-c.length%4,e=0;d>e;e++)c+=" ";return c}),a=a.replace(/~A/g," "),a=a.replace(/~B/g,"")}),d.subParser("encodeAmpsAndAngles",function(a){"use strict";return a=a.replace(/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/g,"&"),a=a.replace(/<(?![a-z\/?\$!])/gi,"<")}),d.subParser("encodeBackslashEscapes",function(a){"use strict";return a=a.replace(/\\(\\)/g,d.helper.escapeCharactersCallback),a=a.replace(/\\([`*_{}\[\]()>#+-.!])/g,d.helper.escapeCharactersCallback)}),d.subParser("encodeCode",function(a){"use strict";return a=a.replace(/&/g,"&"),a=a.replace(//g,">"),a=d.helper.escapeCharacters(a,"*_{}[]\\",!1)}),d.subParser("encodeEmailAddress",function(a){"use strict";var b=[function(a){return""+a.charCodeAt(0)+";"},function(a){return""+a.charCodeAt(0).toString(16)+";"},function(a){return a}];return a="mailto:"+a,a=a.replace(/./g,function(a){if("@"===a)a=b[Math.floor(2*Math.random())](a);else if(":"!==a){var c=Math.random();a=c>.9?b[2](a):c>.45?b[1](a):b[0](a)}return a}),a=''+a+"",a=a.replace(/">.+:/g,'">')}),d.subParser("escapeSpecialCharsWithinTagAttributes",function(a){"use strict";var b=/(<[a-z\/!$]("[^"]*"|'[^']*'|[^'">])*>|)/gi;return a=a.replace(b,function(a){var b=a.replace(/(.)<\/?code>(?=.)/g,"$1`");return b=d.helper.escapeCharacters(b,"\\`*_",!1)})}),d.subParser("githubCodeBlocks",function(a,b,c){"use strict";return b.ghCodeBlocks?(a+="~0",a=a.replace(/(?:^|\n)```(.*)\n([\s\S]*?)\n```/g,function(a,e,f){var g=b.omitExtraWLInCodeBlocks?"":"\n";return f=d.subParser("encodeCode")(f),f=d.subParser("detab")(f),f=f.replace(/^\n+/g,""),f=f.replace(/\n+$/g,""),f="",d.subParser("hashBlock")(f,b,c)}),a=a.replace(/~0/,"")):a}),d.subParser("hashBlock",function(a,b,c){"use strict";return a=a.replace(/(^\n+|\n+$)/g,""),"\n\n~K"+(c.gHtmlBlocks.push(a)-1)+"K\n\n"}),d.subParser("hashElement",function(a,b,c){"use strict";return function(a,b){var d=b;return d=d.replace(/\n\n/g,"\n"),d=d.replace(/^\n/,""),d=d.replace(/\n+$/g,""),d="\n\n~K"+(c.gHtmlBlocks.push(d)-1)+"K\n\n"}}),d.subParser("hashHTMLBlocks",function(a,b,c){"use strict";return a=a.replace(/\n/g,"\n\n"),a=a.replace(/^(<(p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|ins|del)\b[^\r]*?\n<\/\2>[ \t]*(?=\n+))/gm,d.subParser("hashElement")(a,b,c)),a=a.replace(/^(<(p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|style|section|header|footer|nav|article|aside|address|audio|canvas|figure|hgroup|output|video)\b[^\r]*?<\/\2>[ \t]*(?=\n+)\n)/gm,d.subParser("hashElement")(a,b,c)),a=a.replace(/(\n[ ]{0,3}(<(hr)\b([^<>])*?\/?>)[ \t]*(?=\n{2,}))/g,d.subParser("hashElement")(a,b,c)),a=a.replace(/(\n\n[ ]{0,3}[ \t]*(?=\n{2,}))/g,d.subParser("hashElement")(a,b,c)),a=a.replace(/(?:\n\n)([ ]{0,3}(?:<([?%])[^\r]*?\2>)[ \t]*(?=\n{2,}))/g,d.subParser("hashElement")(a,b,c)),a=a.replace(/\n\n/g,"\n")}),d.subParser("headers",function(a,b,c){"use strict";function e(a){var b,e=a.replace(/[^\w]/g,"").toLowerCase();return c.hashLinkCounts[e]?b=e+"-"+c.hashLinkCounts[e]++:(b=e,c.hashLinkCounts[e]=1),f===!0&&(f="section"),d.helper.isString(f)?f+b:b}var f=b.prefixHeaderId,g=isNaN(parseInt(b.headerLevelStart))?1:parseInt(b.headerLevelStart),h=b.smoothLivePreview?/^(.+)[ \t]*\n={2,}[ \t]*\n+/gm:/^(.+)[ \t]*\n=+[ \t]*\n+/gm,i=b.smoothLivePreview?/^(.+)[ \t]*\n-{2,}[ \t]*\n+/gm:/^(.+)[ \t]*\n-+[ \t]*\n+/gm;return a=a.replace(h,function(a,f){ var h=d.subParser("spanGamut")(f,b,c),i=b.noHeaderId?"":' id="'+e(f)+'"',j=g,k=""+f+g+"
"+h+" ";return d.subParser("hashBlock")(k,b,c)}),a=a.replace(i,function(a,f){var h=d.subParser("spanGamut")(f,b,c),i=b.noHeaderId?"":' id="'+e(f)+'"',j=g+1,k=""+h+" ";return d.subParser("hashBlock")(k,b,c)}),a=a.replace(/^(#{1,6})[ \t]*(.+?)[ \t]*#*\n+/gm,function(a,f,h){var i=d.subParser("spanGamut")(h,b,c),j=b.noHeaderId?"":' id="'+e(h)+'"',k=g-1+f.length,l=""+i+" ";return d.subParser("hashBlock")(l,b,c)})}),d.subParser("images",function(a,b,c){"use strict";function e(a,b,e,f,g,h,i,j){var k=c.gUrls,l=c.gTitles,m=c.gDimensions;if(e=e.toLowerCase(),j||(j=""),""===f||null===f){if((""===e||null===e)&&(e=b.toLowerCase().replace(/ ?\n/g," ")),f="#"+e,d.helper.isUndefined(k[e]))return a;f=k[e],d.helper.isUndefined(l[e])||(j=l[e]),d.helper.isUndefined(m[e])||(g=m[e].width,h=m[e].height)}b=b.replace(/"/g,"""),b=d.helper.escapeCharacters(b,"*_",!1),f=d.helper.escapeCharacters(f,"*_",!1);var n='"}var f=/!\[(.*?)]\s?\([ \t]*()(\S+?)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(['"])(.*?)\6[ \t]*)?\)/g,g=/!\[(.*?)][ ]?(?:\n[ ]*)?\[(.*?)]()()()()()/g;return a=a.replace(g,e),a=a.replace(f,e)}),d.subParser("italicsAndBold",function(a,b){"use strict";return b.literalMidWordUnderscores?(a=a.replace(/(^|\s|>|\b)__(?=\S)([^]+?)__(?=\b|<|\s|$)/gm,"$1$2"),a=a.replace(/(^|\s|>|\b)_(?=\S)([^]+?)_(?=\b|<|\s|$)/gm,"$1$2"),a=a.replace(/\*\*(?=\S)([^]+?)\*\*/g,"$1"),a=a.replace(/\*(?=\S)([^]+?)\*/g,"$1")):(a=a.replace(/(\*\*|__)(?=\S)([^\r]*?\S[*_]*)\1/g,"$2"),a=a.replace(/(\*|_)(?=\S)([^\r]*?\S)\1/g,"$2")),a}),d.subParser("lists",function(a,b,c){"use strict";function e(a,e){c.gListLevel++,a=a.replace(/\n{2,}$/,"\n"),a+="~0";var f=/(\n)?(^[ \t]*)([*+-]|\d+[.])[ \t]+((\[(x| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(~0|\2([*+-]|\d+[.])[ \t]+))/gm,g=/\n[ \t]*\n(?!~0)/.test(a);return a=a.replace(f,function(a,e,f,h,i,j,k){k=k&&""!==k.trim();var l=d.subParser("outdent")(i,b,c),m="";return j&&b.tasklists&&(m=' class="task-list-item" style="list-style-type: none;"',l=l.replace(/^[ \t]*\[(x| )?]/m,function(){var a='"})),e||l.search(/\n{2,}/)>-1?(l=d.subParser("githubCodeBlocks")(l,b,c),l=d.subParser("blockGamut")(l,b,c)):(l=d.subParser("lists")(l,b,c),l=l.replace(/\n$/,""),l=g?d.subParser("paragraphs")(l,b,c):d.subParser("spanGamut")(l,b,c)),l="\n
"),i+="
",f.push(i))}for(g=f.length,h=0;g>h;h++)for(;f[h].search(/~K(\d+)K/)>=0;){var j=c.gHtmlBlocks[RegExp.$1];j=j.replace(/\$/g,"$$$$"),f[h]=f[h].replace(/~K\d+K/,j)}return f.join("\n\n")}),d.subParser("runExtension",function(a,b,c,d){"use strict";if(a.filter)b=a.filter(b,d.converter,c);else if(a.regex){var e=a.regex;!e instanceof RegExp&&(e=new RegExp(e,"g")),b=b.replace(e,a.replace)}return b}),d.subParser("spanGamut",function(a,b,c){"use strict";return a=d.subParser("codeSpans")(a,b,c),a=d.subParser("escapeSpecialCharsWithinTagAttributes")(a,b,c),a=d.subParser("encodeBackslashEscapes")(a,b,c),a=d.subParser("images")(a,b,c),a=d.subParser("anchors")(a,b,c),a=d.subParser("autoLinks")(a,b,c),a=d.subParser("encodeAmpsAndAngles")(a,b,c),a=d.subParser("italicsAndBold")(a,b,c),a=d.subParser("strikethrough")(a,b,c),a=a.replace(/ +\n/g,"