diff --git a/dist/custom.js b/dist/custom.js index fe97faa..71762fd 100644 --- a/dist/custom.js +++ b/dist/custom.js @@ -117,3 +117,4 @@ $ (function () { }); + diff --git a/src/assets/js/program.js b/src/assets/js/program.js index ebb96e0..ae1f786 100644 --- a/src/assets/js/program.js +++ b/src/assets/js/program.js @@ -1,19 +1,9 @@ $ (document).on ('click', '.js-add-program', function () { - var templateSelector = $ (this).data ('template') + ":last"; - var $templateContainer = $ ($ (this).data ('template-container')); - var $template = $templateContainer.find (templateSelector); + var $template= $($(this).data('template')); - var $copy = $template.clone ().removeClass ('template'); + $template.clone().appendTo($template.parent()); - var itemsCount = $ ('.template-container__item').length; - $copy.find ('input').each (function () { - var name = $ (this).attr ('name'); - - if (typeof name !== 'undefined') - $ (this).attr ('name', name.replace (/\[[0-9]+\]/g, '[' + itemsCount + ']')); - }); - - $copy.removeAttr ('hidden').appendTo ($templateContainer); + renameInputs(); $ ('.select-time').datetimepicker ({ format: 'LT', @@ -28,7 +18,6 @@ function renameInputs() { items.each (function () { var $rows = $ (this).find ('input'); - $rows.each (function () { var name = $ (this).attr ('name'); $ (this).attr ('name', name.replace (/\[[0-9]+\]/g, '[' + i + ']')); @@ -51,14 +40,15 @@ function sortEvents($container, $templates) { var elements = $templates.get (); - elements.sort (function (a, b) { + $container.children().remove(); - console.log (a); + elements.sort (function (a, b) { + // console.log (a); var timeA = $ (a).find ('.select-time').val (); var timeB = $ (b).find ('.select-time').val (); - return timeA > timeB; + return timeA > timeB ? 1 : -1; }); $container.append (elements); @@ -73,6 +63,7 @@ function checkEvents($container, $templates) { var time = $ (this).find ('.select-time').val (); if (time < lastTime) { + // console.log ($(this).find('.select-time').attr('name')+": "+time + " < " + lastTime); orderCorrect = false; } lastTime = time; @@ -89,7 +80,7 @@ $ (document).ready (function () { setInterval (function () { var $templateContainer = $ ('.template-container'); - var $templates = $ ('.template'); + var $templates = $ ('.program-template'); checkEvents ($templateContainer, $templates); }, 1000); diff --git a/src/assets/scss/editor/app.scss b/src/assets/scss/editor/app.scss index 925f360..266710e 100644 --- a/src/assets/scss/editor/app.scss +++ b/src/assets/scss/editor/app.scss @@ -3,7 +3,7 @@ @import "timeline"; @import "gallery"; -.template:first-child { +.program-template:first-child, .template:first-child { .js-remove-program { display: none; } diff --git a/src/views/editor/index.ejs b/src/views/editor/index.ejs index b764b9d..4a863e0 100644 --- a/src/views/editor/index.ejs +++ b/src/views/editor/index.ejs @@ -31,16 +31,23 @@
<%= date.getDate () %>. <%= date.getMonth () + 1 %>. <%= date.getFullYear () %>
+<%= day %>. <%= month %>. <%= year %>
<%= date.getHours () %> - :<%= date.getMinutes () < 10 ? '0' + date.getMinutes () : date.getMinutes () %>
+<%= time %>
| + | Název skupiny | Limit | ||
|---|---|---|---|---|
| - - | +||||
| @@ -42,10 +42,10 @@ | ||||
| - - | +||||
| @@ -67,7 +67,7 @@ | ||||
| - + Přidat skupinu | ||||
| @@ -53,7 +53,7 @@ | ||||
| - + Přidat položku | ||||
| - - | -- - | -- - | -
-
-
-
-
-
-
-
- Kč
-
- |
- - - - - | -
| - + | ||||
| + | @@ -81,7 +53,7 @@ | |||
| - + Přidat položku | - + <% for(var i in program) { %> - | |||
| @@ -26,7 +26,7 @@ | - + | |||
| - Přidat akci + Přidat akci - + | ||||