diff --git a/.gitignore b/.gitignore index d851a5f..0770091 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ node_modules -dist +dist/fonts +dist/bundle.js .idea -!/dist/custom.js -!/dist/custom.css diff --git a/dist/custom.css b/dist/custom.css new file mode 100644 index 0000000..de2e393 --- /dev/null +++ b/dist/custom.css @@ -0,0 +1,24 @@ + +.title-image { + height: 700px; + width: 100%; + background-repeat: no-repeat; + background-size: cover; + background-position: center center; + margin-bottom: 3rem; +} + + +.image-preview { + max-width: 100%; + border: solid 1px; + margin: 10px 0; + display: none; +} + + + +/*Google Places autocomplete*/ +.pac-container { + z-index: 99999; +} \ No newline at end of file diff --git a/dist/custom.js b/dist/custom.js new file mode 100644 index 0000000..91b58da --- /dev/null +++ b/dist/custom.js @@ -0,0 +1,64 @@ + +var editors =new Jodit('.wysiwyg'); + +function readURL(input, preview) { + + // ignore + if (preview == null) { + alert('preview is null'); + return; + } + + // display preview in given element + if (input.files && input.files[0]) { + var reader = new FileReader(); + + reader.onload = function(e) { + preview.attr('src', e.target.result).show(); + } + + reader.readAsDataURL(input.files[0]); + } +} + +$(".file-upload").change(function() { + var preview = null; + + if ($(this).data('preview')) { + preview = $($(this).data('preview')); + } + + readURL(this, preview); +}); + + +$(document).ready(function () { + $('.select-time').datetimepicker({ + format: 'LT', + locale: 'cs', + stepping: 10, + }); + $('.select-date').datetimepicker({ + format: 'D. M. Y', + locale: 'cs', + minDate: new Date() + }); + +}); + + +$('#mainInfoModal').on('show.bs.modal', function (e) { + $ ('#map').locationpicker ({ + location: {latitude: 46.15242437752303, longitude: 2.7470703125}, + radius: 10, + enableReverseGeocode: true, + draggable: true, + inputBinding: { + latitudeInput: null, + longitudeInput: null, + radiusInput: null, + locationNameInput: $ ('#map-input') + }, + enableAutocomplete: true + }); +}) diff --git a/dist/images/01.jpg b/dist/images/01.jpg new file mode 100644 index 0000000..5719453 Binary files /dev/null and b/dist/images/01.jpg differ diff --git a/dist/images/02.jpg b/dist/images/02.jpg new file mode 100644 index 0000000..8fcc254 Binary files /dev/null and b/dist/images/02.jpg differ diff --git a/index.js b/index.js index 36a2e8b..4febe00 100644 --- a/index.js +++ b/index.js @@ -1,15 +1,22 @@ // webpack entry point // JS +// components import $ from 'jquery'; - -window.jQuery = $; -window.$ = $; - import 'bootstrap'; import 'fullcalendar'; +import Jodit from 'jodit'; + +// globaly accessible variables and classes +window.jQuery = $; +window.$ = $; +window.Jodit = Jodit; + +import 'pc-bootstrap4-datetimepicker'; + +// custom made functions - everything in src/assets/js function requireAll(r) { r.keys ().forEach (r); } diff --git a/package-lock.json b/package-lock.json index c6336df..0b861fc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3167,6 +3167,11 @@ "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=", "dev": true }, + "jodit": { + "version": "3.2.22", + "resolved": "https://registry.npmjs.org/jodit/-/jodit-3.2.22.tgz", + "integrity": "sha512-jmXoRb5/zBrLusrVjUHTwzzGV07/7CAyTc0ir65HxtyBQNfbu790WJfzjldec0GQZONWRLL+tSdHZnT9BJzQ1g==" + }, "jquery": { "version": "3.3.1", "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.3.1.tgz", @@ -3694,6 +3699,14 @@ "resolved": "https://registry.npmjs.org/moment/-/moment-2.22.2.tgz", "integrity": "sha1-PCV/mDn8DpP/UxSWMiOeuQeD/2Y=" }, + "moment-timezone": { + "version": "0.4.1", + "resolved": "http://registry.npmjs.org/moment-timezone/-/moment-timezone-0.4.1.tgz", + "integrity": "sha1-gfWYw61eIs2teWtn7NjYjQ9bqgY=", + "requires": { + "moment": ">= 2.6.0" + } + }, "move-concurrently": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/move-concurrently/-/move-concurrently-1.0.1.tgz", @@ -4223,6 +4236,17 @@ "sha.js": "^2.4.8" } }, + "pc-bootstrap4-datetimepicker": { + "version": "4.17.50", + "resolved": "https://registry.npmjs.org/pc-bootstrap4-datetimepicker/-/pc-bootstrap4-datetimepicker-4.17.50.tgz", + "integrity": "sha512-76y2McdmiGWdgwPUim72/otNcDUva05B/VoyJVgIRv2dd+g4GO9gPfvvPvCH4LXyKNvtAzKHQSTSyC+4PKq/FQ==", + "requires": { + "bootstrap": "^4.0.0-beta.2", + "jquery": "^1.8.3 || ^2.0 || ^3.0", + "moment": "^2.10", + "moment-timezone": "^0.4.0" + } + }, "performance-now": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", diff --git a/package.json b/package.json index d176339..259938b 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,9 @@ "file-loader": "^2.0.0", "font-awesome": "^4.7.0", "fullcalendar": "^3.9.0", + "jodit": "^3.2.22", "jquery": "^3.3.1", + "pc-bootstrap4-datetimepicker": "^4.17.50", "popper.js": "^1.14.5" }, "devDependencies": { diff --git a/src/assets/js/datepicker.js b/src/assets/js/datepicker.js index 6484fd6..f1d7927 100644 --- a/src/assets/js/datepicker.js +++ b/src/assets/js/datepicker.js @@ -1,118 +1,118 @@ -$ (document).ready (initDateTimePickers ()); -$ (document).on ('snippet-reloaded', initDateTimePickers); - -$ (document).on ('blur', '.select-date', function () { - $ (this).datetimepicker ('hide'); -}); -$ (document).on ('blur', '.select-datetime', function () { - $ (this).datetimepicker ('hide'); -}); - -var i = 1; - -function initDateTimePickers() { - var $datepicker = $ ('.select-date'); - var $datetimepicker = $ ('.select-datetime'); - var $timepicker = $ ('.select-time'); - - $datepicker.each (function () { - var $e = $ (this); - if (!datePickerInitialized ($e)) { - setDatepickerId ($e, 'datepicker-auto-id'); - initDatePicker ($e); - } - }); - - $datetimepicker.each (function () { - var init = $ (this).attr ('data-picker-init'); - - if (init) { - return; - } - - var $positionedParent = getPositionedParent ($ (this)); - var id = setDatepickerId ($ (this), 'datetimepicker-auto-id'); - - $ (this).attr ('data-toggle', 'datetimepicker'); - $ (this).attr ('data-target', '#' + id); - - $ (this).datetimepicker ({ - sideBySide: true, - stepping: 10, - format: "DD. MM. YYYY HH:mm", - widgetParent: $positionedParent, - useCurrent: false, - locale: window.locale || 'cs' - }); - $ (this).attr ('data-picker-init', true); - }); - - $timepicker.each (function () { - var init = $ (this).attr ('data-picker-init'); - - if (init) { - return; - } - - var id = setDatepickerId ($ (this), 'timepicker-auto-id'); - var $positionedParent = getPositionedParent ($ (this)); - - $ (this).attr ('data-toggle', 'datetimepicker'); - $ (this).attr ('data-target', '#' + id); - - $ (this).datetimepicker ({ - sideBySide: true, - stepping: 10, - widgetParent: $positionedParent, - format: "HH:mm", - useCurrent: false, - locale: window.locale || 'cs' - }); - $ (this).attr ('data-picker-init', true); - }); -} - -function getPositionedParent($e) { - do { - $e = $e.parent (); - } while ($e.css ('position') !== 'relative'); - - return $e; -} - -function datePickerInitialized($element) { - var init = $element.attr ('data-picker-init'); - - return !!init; -} - -function setDatepickerId($element, prefix, postfix) { - if (typeof postfix === 'undefined') { - postfix = 1; - } - - var id = $element.attr ('id'); - if (id === "" || typeof id === 'undefined') { - id = prefix + '-' + postfix++; - $element.attr ('id', id); - } - - return id; -} - -function initDatePicker($element) { - var id = $element.attr ('id'); - $element.attr ('data-toggle', 'datetimepicker'); - $element.attr ('data-target', '#' + id); - - var $positionedParent = getPositionedParent ($element); - $element.datetimepicker ({ - format: "DD. MM. YYYY", - useCurrent: false, - widgetParent: $positionedParent, - locale: window.locale || 'cs' - }); - - $element.attr ('data-picker-init', true); -} - +// $ (document).ready (initDateTimePickers ()); +// $ (document).on ('snippet-reloaded', initDateTimePickers); +// +// $ (document).on ('blur', '.select-date', function () { +// $ (this).datetimepicker ('hide'); +// }); +// $ (document).on ('blur', '.select-datetime', function () { +// $ (this).datetimepicker ('hide'); +// }); +// +// var i = 1; +// +// function initDateTimePickers() { +// var $datepicker = $ ('.select-date'); +// var $datetimepicker = $ ('.select-datetime'); +// var $timepicker = $ ('.select-time'); +// +// $datepicker.each (function () { +// var $e = $ (this); +// if (!datePickerInitialized ($e)) { +// setDatepickerId ($e, 'datepicker-auto-id'); +// initDatePicker ($e); +// } +// }); +// +// $datetimepicker.each (function () { +// var init = $ (this).attr ('data-picker-init'); +// +// if (init) { +// return; +// } +// +// var $positionedParent = getPositionedParent ($ (this)); +// var id = setDatepickerId ($ (this), 'datetimepicker-auto-id'); +// +// $ (this).attr ('data-toggle', 'datetimepicker'); +// $ (this).attr ('data-target', '#' + id); +// +// $ (this).datetimepicker ({ +// sideBySide: true, +// stepping: 10, +// format: "DD. MM. YYYY HH:mm", +// widgetParent: $positionedParent, +// useCurrent: false, +// locale: window.locale || 'cs' +// }); +// $ (this).attr ('data-picker-init', true); +// }); +// +// $timepicker.each (function () { +// var init = $ (this).attr ('data-picker-init'); +// +// if (init) { +// return; +// } +// +// var id = setDatepickerId ($ (this), 'timepicker-auto-id'); +// var $positionedParent = getPositionedParent ($ (this)); +// +// $ (this).attr ('data-toggle', 'datetimepicker'); +// $ (this).attr ('data-target', '#' + id); +// +// $ (this).datetimepicker ({ +// sideBySide: true, +// stepping: 10, +// widgetParent: $positionedParent, +// format: "HH:mm", +// useCurrent: false, +// locale: window.locale || 'cs' +// }); +// $ (this).attr ('data-picker-init', true); +// }); +// } +// +// function getPositionedParent($e) { +// do { +// $e = $e.parent (); +// } while ($e.css ('position') !== 'relative'); +// +// return $e; +// } +// +// function datePickerInitialized($element) { +// var init = $element.attr ('data-picker-init'); +// +// return !!init; +// } +// +// function setDatepickerId($element, prefix, postfix) { +// if (typeof postfix === 'undefined') { +// postfix = 1; +// } +// +// var id = $element.attr ('id'); +// if (id === "" || typeof id === 'undefined') { +// id = prefix + '-' + postfix++; +// $element.attr ('id', id); +// } +// +// return id; +// } +// +// function initDatePicker($element) { +// var id = $element.attr ('id'); +// $element.attr ('data-toggle', 'datetimepicker'); +// $element.attr ('data-target', '#' + id); +// +// var $positionedParent = getPositionedParent ($element); +// $element.datetimepicker ({ +// format: "DD. MM. YYYY", +// useCurrent: false, +// widgetParent: $positionedParent, +// locale: window.locale || 'cs' +// }); +// +// $element.attr ('data-picker-init', true); +// } +// diff --git a/src/assets/js/locationpicker.jquery.js b/src/assets/js/locationpicker.jquery.js new file mode 100644 index 0000000..7edf206 --- /dev/null +++ b/src/assets/js/locationpicker.jquery.js @@ -0,0 +1 @@ +!function(a){function b(a,b){var c=new google.maps.Map(a,b),d=new google.maps.Marker({position:new google.maps.LatLng(54.19335,-3.92695),map:c,title:"Drag Me",draggable:b.draggable});return{map:c,marker:d,circle:null,location:d.position,radius:b.radius,locationName:b.locationName,addressComponents:{formatted_address:null,addressLine1:null,addressLine2:null,streetName:null,streetNumber:null,city:null,district:null,state:null,stateOrProvince:null},settings:b.settings,domContainer:a,geodecoder:new google.maps.Geocoder}}function c(a){return void 0!=d(a)}function d(b){return a(b).data("locationpicker")}function e(a,b){if(a){var c=h.locationFromLatLng(b.location);a.latitudeInput&&a.latitudeInput.val(c.latitude).change(),a.longitudeInput&&a.longitudeInput.val(c.longitude).change(),a.radiusInput&&a.radiusInput.val(b.radius).change(),a.locationNameInput&&a.locationNameInput.val(b.locationName).change()}}function f(b,c){b&&(b.radiusInput&&b.radiusInput.on("change",function(b){b.originalEvent&&(c.radius=a(this).val(),h.setPosition(c,c.location,function(a){a.settings.onchanged.apply(c.domContainer,[h.locationFromLatLng(a.location),a.radius,!1])}))}),b.locationNameInput&&c.settings.enableAutocomplete&&(c.autocomplete=new google.maps.places.Autocomplete(b.locationNameInput.get(0)),google.maps.event.addListener(c.autocomplete,"place_changed",function(){var a=c.autocomplete.getPlace();return a.geometry?void h.setPosition(c,a.geometry.location,function(a){e(b,a),a.settings.onchanged.apply(c.domContainer,[h.locationFromLatLng(a.location),a.radius,!1])}):void c.settings.onlocationnotfound(a.name)})),b.latitudeInput&&b.latitudeInput.on("change",function(b){b.originalEvent&&h.setPosition(c,new google.maps.LatLng(a(this).val(),c.location.lng()),function(a){a.settings.onchanged.apply(c.domContainer,[h.locationFromLatLng(a.location),a.radius,!1])})}),b.longitudeInput&&b.longitudeInput.on("change",function(b){b.originalEvent&&h.setPosition(c,new google.maps.LatLng(c.location.lat(),a(this).val()),function(a){a.settings.onchanged.apply(c.domContainer,[h.locationFromLatLng(a.location),a.radius,!1])})}))}function g(a){google.maps.event.trigger(a.map,"resize"),setTimeout(function(){a.map.setCenter(a.marker.position)},300)}var h={drawCircle:function(b,c,d,e){return null!=b.circle&&b.circle.setMap(null),d>0?(d*=1,e=a.extend({strokeColor:"#0000FF",strokeOpacity:.35,strokeWeight:2,fillColor:"#0000FF",fillOpacity:.2},e),e.map=b.map,e.radius=d,e.center=c,b.circle=new google.maps.Circle(e),b.circle):null},setPosition:function(a,b,c){a.location=b,a.marker.setPosition(b),a.map.panTo(b),this.drawCircle(a,b,a.radius,{}),a.settings.enableReverseGeocode?a.geodecoder.geocode({latLng:a.location},function(b,d){d==google.maps.GeocoderStatus.OK&&b.length>0&&(a.locationName=b[0].formatted_address,a.addressComponents=h.address_component_from_google_geocode(b[0].address_components)),c&&c.call(this,a)}):c&&c.call(this,a)},locationFromLatLng:function(a){return{latitude:a.lat(),longitude:a.lng()}},address_component_from_google_geocode:function(a){for(var b={},c=a.length-1;c>=0;c--){var d=a[c];d.types.indexOf("postal_code")>=0?b.postalCode=d.short_name:d.types.indexOf("street_number")>=0?b.streetNumber=d.short_name:d.types.indexOf("route")>=0?b.streetName=d.short_name:d.types.indexOf("locality")>=0?b.city=d.short_name:d.types.indexOf("sublocality")>=0?b.district=d.short_name:d.types.indexOf("administrative_area_level_1")>=0?b.stateOrProvince=d.short_name:d.types.indexOf("country")>=0&&(b.country=d.short_name)}return b.addressLine1=[b.streetNumber,b.streetName].join(" ").trim(),b.addressLine2="",b}};a.fn.locationpicker=function(i,j){if("string"==typeof i){var k=this.get(0);if(!c(k))return;var l=d(k);switch(i){case"location":if(void 0==j){var m=h.locationFromLatLng(l.location);return m.radius=l.radius,m.name=l.locationName,m}j.radius&&(l.radius=j.radius),h.setPosition(l,new google.maps.LatLng(j.latitude,j.longitude),function(a){e(a.settings.inputBinding,a)});break;case"subscribe":if(void 0==j)return null;var n=j.event,o=j.callback;if(!n||!o)return console.error('LocationPicker: Invalid arguments for method "subscribe"'),null;google.maps.event.addListener(l.map,n,o);break;case"map":if(void 0==j){var p=h.locationFromLatLng(l.location);return p.formattedAddress=l.locationName,p.addressComponents=l.addressComponents,{map:l.map,marker:l.marker,location:p}}return null;case"autosize":return g(l),this}return null}return this.each(function(){var d=a(this);if(!c(this)){var g=a.extend({},a.fn.locationpicker.defaults,i),j=new b(this,{zoom:g.zoom,center:new google.maps.LatLng(g.location.latitude,g.location.longitude),mapTypeId:google.maps.MapTypeId.ROADMAP,mapTypeControl:!1,disableDoubleClickZoom:!1,scrollwheel:g.scrollwheel,streetViewControl:!1,radius:g.radius,locationName:g.locationName,settings:g,draggable:g.draggable});d.data("locationpicker",j),google.maps.event.addListener(j.marker,"dragend",function(){h.setPosition(j,j.marker.position,function(a){var b=h.locationFromLatLng(j.location);a.settings.onchanged.apply(j.domContainer,[b,a.radius,!0]),e(j.settings.inputBinding,j)})}),h.setPosition(j,new google.maps.LatLng(g.location.latitude,g.location.longitude),function(a){e(g.inputBinding,j),f(g.inputBinding,j),a.settings.oninitialized(d)})}})},a.fn.locationpicker.defaults={location:{latitude:40.7324319,longitude:-73.82480799999996},locationName:"",radius:500,zoom:15,scrollwheel:!0,inputBinding:{latitudeInput:null,longitudeInput:null,radiusInput:null,locationNameInput:null},enableAutocomplete:!1,enableReverseGeocode:!0,draggable:!0,onchanged:function(){},onlocationnotfound:function(){},oninitialized:function(){}}}(jQuery); diff --git a/src/assets/scss/app.scss b/src/assets/scss/app.scss index 766b01c..8c28803 100644 --- a/src/assets/scss/app.scss +++ b/src/assets/scss/app.scss @@ -14,15 +14,19 @@ @import "~bootstrap/scss/code"; @import "~bootstrap/scss/grid"; - -@import " ~fullcalendar/dist/fullcalendar.min.css"; - $fa-font-path: "~font-awesome/fonts"; -@import '~font-awesome/scss/font-awesome.scss'; +// plugins +@import '~font-awesome/scss/font-awesome.scss'; +@import "~fullcalendar/dist/fullcalendar.min.css"; +@import "~jodit/build/jodit.min.css"; +@import "~pc-bootstrap4-datetimepicker/build/css/bootstrap-datetimepicker.css"; + +// backend @import "sidebar"; @import "main"; @import "backToDashboard"; @import "boxes"; +// editor @import "editor/app"; diff --git a/src/assets/scss/editor/app.scss b/src/assets/scss/editor/app.scss index 330ab34..df42554 100644 --- a/src/assets/scss/editor/app.scss +++ b/src/assets/scss/editor/app.scss @@ -1,4 +1,5 @@ @import "parts"; -@import "timeline"; \ No newline at end of file +@import "timeline"; + diff --git a/src/views/layouts/editor.ejs b/src/views/layouts/editor.ejs index 655cd8b..b3021b4 100644 --- a/src/views/layouts/editor.ejs +++ b/src/views/layouts/editor.ejs @@ -5,6 +5,7 @@ + @@ -34,15 +35,6 @@ <%- body %> - - - - - - - - - diff --git a/src/views/partials/editor/modals/mainInfo.ejs b/src/views/partials/editor/modals/mainInfo.ejs index eb5eac6..d16ef24 100644 --- a/src/views/partials/editor/modals/mainInfo.ejs +++ b/src/views/partials/editor/modals/mainInfo.ejs @@ -1,5 +1,7 @@ + +