From 15c0f0b54a119955be035f9770a8bcf513388f37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Kv=C3=A1=C4=8Dek?= Date: Fri, 16 Nov 2018 14:01:31 +0100 Subject: [PATCH] Pridan program, opraveno jQuery s webpackem --- .gitignore | 3 +- index.js | 19 +++-- src/assets/js/calendar.js | 8 +- src/assets/js/program.js | 38 +++++++++ src/assets/scss/app.scss | 2 +- src/assets/scss/boxes.scss | 4 +- src/assets/scss/editor/app.scss | 4 + src/assets/scss/editor/timeline.scss | 56 ++++++++++++++ src/views/editor/index.ejs | 63 ++++++++++++++- src/views/layouts/editor.ejs | 4 +- src/views/partials/editor/modals/mainInfo.ejs | 40 ++++++++++ src/views/partials/editor/modals/program.ejs | 77 +++++++++++++++++++ .../partials/editor/modals/setAboutUs.ejs | 23 ++---- 13 files changed, 311 insertions(+), 30 deletions(-) create mode 100644 src/assets/js/program.js create mode 100644 src/assets/scss/editor/app.scss create mode 100644 src/assets/scss/editor/timeline.scss create mode 100644 src/views/partials/editor/modals/mainInfo.ejs create mode 100644 src/views/partials/editor/modals/program.ejs diff --git a/.gitignore b/.gitignore index 7714c7d..d851a5f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ node_modules dist .idea -!dist/custom.* \ No newline at end of file +!/dist/custom.js +!/dist/custom.css diff --git a/index.js b/index.js index 49d0674..75eb0f6 100644 --- a/index.js +++ b/index.js @@ -1,13 +1,22 @@ // webpack entry point // JS +import $ from 'jquery'; + +window.jQuery = $; +window.$ = $; + import 'bootstrap'; +import 'fullcalendar'; -var req = require.context("./src/assets/js", true, /^(.*\.(js$))[^.]*$/igm); -req.keys().forEach(function(key){ - req(key); -}); +function requireAll(r) { + r.keys ().forEach (r); +} +requireAll (require.context ('./src/assets/js', true, /\.js$/)); // SASS -import './src/assets/scss/app.scss'; \ No newline at end of file +import './src/assets/scss/app.scss'; + +// nefunguje kalendar z nejakeho duvodu - mam blbe cestu +// import '~fullcalendar/dist/fullcalendar.css'; \ No newline at end of file diff --git a/src/assets/js/calendar.js b/src/assets/js/calendar.js index 538dc05..d1cdf32 100644 --- a/src/assets/js/calendar.js +++ b/src/assets/js/calendar.js @@ -48,7 +48,7 @@ function initCalendar() { $modal.find ('input[name=startdate]').val (startdate); }, - eventDrop: function (event) { + /*eventDrop: function (event) { if (event.type === "event") { $.nette.ajax ({ url: {plink editCalendarEvent!}, @@ -71,7 +71,7 @@ function initCalendar() { } }); } - }, + },*/ eventClick: function (event, jsEvent, view) { // wasn't remove button clicked? if ($ (jsEvent.target).hasClass ('fa-times')) { @@ -97,14 +97,14 @@ function initCalendar() { $modal.modal ('show'); }, - eventRender: function (event, element) { + /*eventRender: function (event, element) { var url = {plink delete! 0,1}; url = url.replace ("0?", event.id + "?").replace ("type=1", "type=" + event.type); var link = ''; element.find (".fc-title").parent ().append (link); - }, + },*/ events: window.events }); diff --git a/src/assets/js/program.js b/src/assets/js/program.js new file mode 100644 index 0000000..9069123 --- /dev/null +++ b/src/assets/js/program.js @@ -0,0 +1,38 @@ +$ (document).on ('click', '.js-add-program', function () { + var $template = $ ($ (this).data ('template')); + + var $templateContainer = $ ($ (this).data ('template-container')); + + var $copy = $template.clone ().removeClass ('template'); + $copy.find ('.js-remove-program').removeAttr('hidden'); + + + $copy.appendTo ($templateContainer); +}); + +$ (document).on ('click', '.js-remove-program', function () { + + if ($ (this).hasClass ('template')) + return; + + $ (this).closest ('tr').remove (); +}); + +var $iconTarget = null; +$(document).on('click', '.js-set-icon-program', function () { + $('#setIconProgramModal').modal('show'); + + $iconTarget = $(this); +}); + +$(document).on('click', '.js-choose-icon', function () { + + var icon = $(this).data('icon'); + + $iconTarget.find('input').val(icon); + $iconTarget.find('.fa').removeAttr('class').addClass('fa fa-2x fa-'+icon); + $iconTarget = null; + + $('#setIconProgramModal').modal('hide'); + +}); \ No newline at end of file diff --git a/src/assets/scss/app.scss b/src/assets/scss/app.scss index c56bae6..328b683 100644 --- a/src/assets/scss/app.scss +++ b/src/assets/scss/app.scss @@ -23,4 +23,4 @@ $fa-font-path: "~font-awesome/fonts"; @import "backToDashboard"; @import "boxes"; -@import "editor/parts"; \ No newline at end of file +@import "editor/app"; diff --git a/src/assets/scss/boxes.scss b/src/assets/scss/boxes.scss index 5a40160..fbe58e8 100644 --- a/src/assets/scss/boxes.scss +++ b/src/assets/scss/boxes.scss @@ -4,9 +4,11 @@ &__container { column-count: 2; column-width: 50%; + padding: 20px; } &__item { - margin: 20px; + margin-bottom: 20px; } + } \ No newline at end of file diff --git a/src/assets/scss/editor/app.scss b/src/assets/scss/editor/app.scss new file mode 100644 index 0000000..330ab34 --- /dev/null +++ b/src/assets/scss/editor/app.scss @@ -0,0 +1,4 @@ + + +@import "parts"; +@import "timeline"; \ No newline at end of file diff --git a/src/assets/scss/editor/timeline.scss b/src/assets/scss/editor/timeline.scss new file mode 100644 index 0000000..412ba19 --- /dev/null +++ b/src/assets/scss/editor/timeline.scss @@ -0,0 +1,56 @@ +.timeline-container { + overflow: auto; + white-space: nowrap; +} + +.timeline { + list-style: none; + width: auto; + color: gray; + display: flex; + flex-wrap: nowrap; + flex-direction: row; +} + +.timeline .timeline__item { + display: inline-block; + max-width: 200px; + text-align: center; + padding: 0 20px; + margin: 0 10px; + flex-grow: 1; +} + + +.timeline .timeline__icon { + width: 40px; + height: 40px; + font-size: 40px; + position: relative; +} + +.timeline::before { + border: solid 1px; + position: absolute; + top: 100px; + content: " "; + width: 100%; +} + +.timeline .timeline__icon::after { + font: normal normal normal 14px/1 FontAwesome; + content: "\F111"; + position: absolute; + z-index: -1; + width: 100%; + bottom: -30px; + left: 0; + font-size: 20px; +} + +.timeline .timeline__content { + margin-top: 30px; +} + +.timeline .timeline__content h3 { +} \ No newline at end of file diff --git a/src/views/editor/index.ejs b/src/views/editor/index.ejs index 4673528..ecc3aff 100644 --- a/src/views/editor/index.ejs +++ b/src/views/editor/index.ejs @@ -2,5 +2,66 @@
<% include ../partials/editor/aboutUs.ejs %> +
+ +
+ +
+
+

Kdy?

+

1. 9. 2019

+
+
+

Kde?

+

Zámek Litomyšl

+
+
+

V kolik?

+

11:00

+
+ + +
+ + + +
+ + <% include ../partials/editor/modals/mainInfo.ejs %> + +
+
+ +
+

Svatební program

+ +
+ +
+ + <% for(var i = 0; i < 5; i++) { %> +
+ + + +
+

11:00

+

<%= i %> Hostina

+
+ +
+ <% } %> + +
+
+ +
+ + + +
+ + <% include ../partials/editor/modals/program.ejs %> + +
- \ No newline at end of file diff --git a/src/views/layouts/editor.ejs b/src/views/layouts/editor.ejs index 1e7e606..655cd8b 100644 --- a/src/views/layouts/editor.ejs +++ b/src/views/layouts/editor.ejs @@ -6,7 +6,6 @@ - Svatební web @@ -45,4 +44,7 @@ + + + diff --git a/src/views/partials/editor/modals/mainInfo.ejs b/src/views/partials/editor/modals/mainInfo.ejs new file mode 100644 index 0000000..eb5eac6 --- /dev/null +++ b/src/views/partials/editor/modals/mainInfo.ejs @@ -0,0 +1,40 @@ + \ No newline at end of file diff --git a/src/views/partials/editor/modals/program.ejs b/src/views/partials/editor/modals/program.ejs new file mode 100644 index 0000000..0240778 --- /dev/null +++ b/src/views/partials/editor/modals/program.ejs @@ -0,0 +1,77 @@ + + + + + \ No newline at end of file diff --git a/src/views/partials/editor/modals/setAboutUs.ejs b/src/views/partials/editor/modals/setAboutUs.ejs index cad8708..d9d52f6 100644 --- a/src/views/partials/editor/modals/setAboutUs.ejs +++ b/src/views/partials/editor/modals/setAboutUs.ejs @@ -8,22 +8,13 @@ + +