X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/aea4919dfc3beda0cd14c8997a12288921c8745c..6eb09805dd1b6a4a3a7305eff38449ebcf5154db:/redakcja/static/js/catalogue/catalogue.js diff --git a/redakcja/static/js/catalogue/catalogue.js b/redakcja/static/js/catalogue/catalogue.js index 9d2bd958..796e3e8b 100755 --- a/redakcja/static/js/catalogue/catalogue.js +++ b/redakcja/static/js/catalogue/catalogue.js @@ -27,6 +27,121 @@ }); + var nowTemp = new Date(); + var now = new Date(nowTemp.getFullYear(), nowTemp.getMonth(), nowTemp.getDate(), 0, 0, 0, 0); + + $('.datepicker-field').each(function() { + var checkout = $(this).datepicker({ + format: 'yyyy-mm-dd', + weekStart: 1, + onRender: function(date) { + return date.valueOf() < now.valueOf() ? 'disabled' : ''; + } + }).on('changeDate', function() { + checkout.hide(); + }).data('datepicker'); + }); + + + $("select").change(function() { + var helpdiv = $(this).next(); + if (helpdiv.hasClass('help-text')) { + var helptext = $("option:selected", this).attr('data-help'); + helpdiv.html(helptext || ''); + } + }); + + + + // tutorial mode + var tutorial, tutorial_no; + var start; + + var first_reset = true; + function tutreset() { + if (start) $(start).popover('hide'); + start = null; + tutorial_no = null; + var all_tutorial = $('[data-toggle="tutorial"]'); + + function sortKey(a) { + return parseInt($(a).attr('data-tutorial')); + } + tutorial = $.makeArray(all_tutorial.sort( + function(a, b) {return sortKey(a) < sortKey(b) ? -1 : 1} + )); + + if (first_reset) { + $.each(tutorial, function(i, e) { + var but = (i < tutorial.length - 1) ? '>>' : 'OK', + but_prev_html = i === 0 ? '' : '<<'; + $(e).popover({ + title: '×Tutorial', + trigger: 'focus', + html: 'true', + template: '