Browse Source

kolotc

master
Jméno Příjmení 4 years ago
parent
commit
b3fa045b0e
  1. 3
      .vscode/settings.json
  2. 10
      home/models.py
  3. 63
      home/templates/home/home_page.html
  4. 15
      hvezdarna/api.py
  5. 3
      hvezdarna/settings/base.py
  6. 3
      hvezdarna/static/css/hvezdarna.css
  7. 5
      hvezdarna/static/css/hvezdarna.less
  8. 938
      hvezdarna/static/js/muj-kolotoc.js
  9. 1
      hvezdarna/static/js/muj-kolotoc.js.map
  10. 2
      hvezdarna/static/js/muj-kolotoc.min.js
  11. 1
      hvezdarna/static/js/muj-kolotoc.min.js.map
  12. 34
      hvezdarna/templates/base.html
  13. 4
      hvezdarna/urls.py

3
.vscode/settings.json

@ -0,0 +1,3 @@
{
"python.pythonPath": ".venv\\Scripts\\python.exe"
}

10
home/models.py

@ -7,6 +7,7 @@ from wagtail.core.fields import RichTextField
from wagtail.admin.edit_handlers import FieldPanel, InlinePanel from wagtail.admin.edit_handlers import FieldPanel, InlinePanel
from wagtail.images.edit_handlers import ImageChooserPanel from wagtail.images.edit_handlers import ImageChooserPanel
from wagtail.search import index from wagtail.search import index
from wagtail.api import APIField
class HomePage(Page): class HomePage(Page):
@ -29,6 +30,10 @@ class HomePage(Page):
index.SearchField('body'), index.SearchField('body'),
] ]
api_fields = [
APIField('carousel_images'),
]
class CarouselImage(Orderable): class CarouselImage(Orderable):
page = ParentalKey(HomePage, on_delete=models.CASCADE, related_name='carousel_images') page = ParentalKey(HomePage, on_delete=models.CASCADE, related_name='carousel_images')
@ -39,3 +44,8 @@ class CarouselImage(Orderable):
ImageChooserPanel('image'), ImageChooserPanel('image'),
FieldPanel('caption'), FieldPanel('caption'),
] ]
api_fields = [
APIField('image'),
APIField('caption'),
]

63
home/templates/home/home_page.html

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
{% load static %}
{% load static wagtailcore_tags %}
{% block body_class %}template-homepage{% endblock %} {% block body_class %}template-homepage{% endblock %}
@ -8,7 +8,68 @@
{% endblock extra_css %} {% endblock extra_css %}
{% block content %} {% block content %}
<div class="row">
<div class="col-md-6">
{% for neco in nekde %}
<div class="carousel-item {% if forloop.first %}active{% endif %}">
<img src="..." class="d-block w-100" alt="...">
</div>
{% endfor %}
<muj-kolotoc></muj-kolotoc>
</div>
<div class="col-md-6">
{{ page.body|richtext }}
</div>
</div>
{% endblock content %} {% endblock content %}
{% block extra_js %}
<script>
$.getJSON("/api/v2/pages/{{ page.id }}/?type=home.HomePage&fields=carousel_images")
.done(function(data) {
console.log(data);
let images = [];
for (let index = 0; index < data.carousel_images.length; index++) {
const item = data.carousel_images[index];
//console.log(item.caption);
//console.log(item.image.meta.download_url);
images.push({
src: item.image.meta.download_url,
title: item.caption
});
}
let kolotoc = document.querySelector("muj-kolotoc");
kolotoc.images = images;
})
.fail(function() {
alert("Chyba při dotazu do API.");
});
/*
let images = [
{
src: "/img/image_01.jpg",
title: "Obrázek 1"
},
{
src: "/img/image_02.jpg",
title: "Obrázek 2"
},
{
src: "/img/image_03.jpg",
title: "Obrázek 3"
}
];
let kolotoc = document.querySelector("muj-kolotoc");
kolotoc.images = images;
*/
</script>
{% endblock %}

15
hvezdarna/api.py

@ -0,0 +1,15 @@
from wagtail.api.v2.views import PagesAPIViewSet
from wagtail.api.v2.router import WagtailAPIRouter
from wagtail.images.api.v2.views import ImagesAPIViewSet
from wagtail.documents.api.v2.views import DocumentsAPIViewSet
# Create the router. "wagtailapi" is the URL namespace
api_router = WagtailAPIRouter('wagtailapi')
# Add the three endpoints using the "register_endpoint" method.
# The first parameter is the name of the endpoint (eg. pages, images). This
# is used in the URL of the endpoint
# The second parameter is the endpoint class that handles the requests
api_router.register_endpoint('pages', PagesAPIViewSet)
api_router.register_endpoint('images', ImagesAPIViewSet)
api_router.register_endpoint('documents', DocumentsAPIViewSet)

3
hvezdarna/settings/base.py

@ -38,7 +38,8 @@ INSTALLED_APPS = [
'wagtail.search', 'wagtail.search',
'wagtail.admin', 'wagtail.admin',
'wagtail.core', 'wagtail.core',
'rest_framework',
'wagtail.api.v2',
'modelcluster', 'modelcluster',
'taggit', 'taggit',

3
hvezdarna/static/css/hvezdarna.css

@ -0,0 +1,3 @@
footer {
background-color: #505050;
}

5
hvezdarna/static/css/hvezdarna.less

@ -0,0 +1,5 @@
footer {
background-color: #505050;
}

938
hvezdarna/static/js/muj-kolotoc.js

@ -0,0 +1,938 @@
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = "a7c5");
/******/ })
/************************************************************************/
/******/ ({
/***/ "022d":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
// css base code, injected by the css-loader
// eslint-disable-next-line func-names
module.exports = function (useSourceMap) {
var list = []; // return the list of modules as css string
list.toString = function toString() {
return this.map(function (item) {
var content = cssWithMappingToString(item, useSourceMap);
if (item[2]) {
return "@media ".concat(item[2], " {").concat(content, "}");
}
return content;
}).join('');
}; // import a list of modules into the list
// eslint-disable-next-line func-names
list.i = function (modules, mediaQuery, dedupe) {
if (typeof modules === 'string') {
// eslint-disable-next-line no-param-reassign
modules = [[null, modules, '']];
}
var alreadyImportedModules = {};
if (dedupe) {
for (var i = 0; i < this.length; i++) {
// eslint-disable-next-line prefer-destructuring
var id = this[i][0];
if (id != null) {
alreadyImportedModules[id] = true;
}
}
}
for (var _i = 0; _i < modules.length; _i++) {
var item = [].concat(modules[_i]);
if (dedupe && alreadyImportedModules[item[0]]) {
// eslint-disable-next-line no-continue
continue;
}
if (mediaQuery) {
if (!item[2]) {
item[2] = mediaQuery;
} else {
item[2] = "".concat(mediaQuery, " and ").concat(item[2]);
}
}
list.push(item);
}
};
return list;
};
function cssWithMappingToString(item, useSourceMap) {
var content = item[1] || ''; // eslint-disable-next-line prefer-destructuring
var cssMapping = item[3];
if (!cssMapping) {
return content;
}
if (useSourceMap && typeof btoa === 'function') {
var sourceMapping = toComment(cssMapping);
var sourceURLs = cssMapping.sources.map(function (source) {
return "/*# sourceURL=".concat(cssMapping.sourceRoot || '').concat(source, " */");
});
return [content].concat(sourceURLs).concat([sourceMapping]).join('\n');
}
return [content].join('\n');
} // Adapted from convert-source-map (MIT)
function toComment(sourceMap) {
// eslint-disable-next-line no-undef
var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));
var data = "sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(base64);
return "/*# ".concat(data, " */");
}
/***/ }),
/***/ "4933":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _node_modules_vue_style_loader_index_js_ref_6_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_6_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_3_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_Kolotoc_vue_vue_type_style_index_0_lang_css_shadow__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("5c23");
/* harmony import */ var _node_modules_vue_style_loader_index_js_ref_6_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_6_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_3_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_Kolotoc_vue_vue_type_style_index_0_lang_css_shadow__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_vue_style_loader_index_js_ref_6_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_6_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_3_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_Kolotoc_vue_vue_type_style_index_0_lang_css_shadow__WEBPACK_IMPORTED_MODULE_0__);
/* harmony reexport (unknown) */ for(var __WEBPACK_IMPORT_KEY__ in _node_modules_vue_style_loader_index_js_ref_6_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_6_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_3_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_Kolotoc_vue_vue_type_style_index_0_lang_css_shadow__WEBPACK_IMPORTED_MODULE_0__) if(["default"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) (function(key) { __webpack_require__.d(__webpack_exports__, key, function() { return _node_modules_vue_style_loader_index_js_ref_6_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_6_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_3_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_Kolotoc_vue_vue_type_style_index_0_lang_css_shadow__WEBPACK_IMPORTED_MODULE_0__[key]; }) }(__WEBPACK_IMPORT_KEY__));
/***/ }),
/***/ "5c23":
/***/ (function(module, exports, __webpack_require__) {
// style-loader: Adds some css to the DOM by adding a <style> tag
// load the styles
var content = __webpack_require__("60a3");
if(content.__esModule) content = content.default;
if(typeof content === 'string') content = [[module.i, content, '']];
if(content.locals) module.exports = content.locals;
// add CSS to Shadow Root
var add = __webpack_require__("c4de").default
module.exports.__inject__ = function (shadowRoot) {
add("3dd7fef4", content, shadowRoot)
};
/***/ }),
/***/ "60a3":
/***/ (function(module, exports, __webpack_require__) {
// Imports
var ___CSS_LOADER_API_IMPORT___ = __webpack_require__("022d");
exports = ___CSS_LOADER_API_IMPORT___(false);
// Module
exports.push([module.i, ".active{background-color:green}", ""]);
// Exports
module.exports = exports;
/***/ }),
/***/ "8bbf":
/***/ (function(module, exports) {
module.exports = Vue;
/***/ }),
/***/ "a7c5":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// CONCATENATED MODULE: ../node_modules/@vue/cli-service/lib/commands/build/setPublicPath.js
// This file is imported into lib/wc client bundles.
if (typeof window !== 'undefined') {
var currentScript = window.document.currentScript
if (Object({"NODE_ENV":"production","BASE_URL":"/"}).NEED_CURRENTSCRIPT_POLYFILL) {
var getCurrentScript = __webpack_require__("dc36")
currentScript = getCurrentScript()
// for backward compatibility, because previously we directly included the polyfill
if (!('currentScript' in document)) {
Object.defineProperty(document, 'currentScript', { get: getCurrentScript })
}
}
var src = currentScript && currentScript.src.match(/(.+\/)[^/]+\.js(\?.*)?$/)
if (src) {
__webpack_require__.p = src[1] // eslint-disable-line
}
}
// Indicate to webpack that this file can be concatenated
/* harmony default export */ var setPublicPath = (null);
// EXTERNAL MODULE: external "Vue"
var external_Vue_ = __webpack_require__("8bbf");
var external_Vue_default = /*#__PURE__*/__webpack_require__.n(external_Vue_);
// CONCATENATED MODULE: ../node_modules/@vue/web-component-wrapper/dist/vue-wc-wrapper.js
const camelizeRE = /-(\w)/g;
const camelize = str => {
return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : '')
};
const hyphenateRE = /\B([A-Z])/g;
const hyphenate = str => {
return str.replace(hyphenateRE, '-$1').toLowerCase()
};
function getInitialProps (propsList) {
const res = {};
propsList.forEach(key => {
res[key] = undefined;
});
return res
}
function injectHook (options, key, hook) {
options[key] = [].concat(options[key] || []);
options[key].unshift(hook);
}
function callHooks (vm, hook) {
if (vm) {
const hooks = vm.$options[hook] || [];
hooks.forEach(hook => {
hook.call(vm);
});
}
}
function createCustomEvent (name, args) {
return new CustomEvent(name, {
bubbles: false,
cancelable: false,
detail: args
})
}
const isBoolean = val => /function Boolean/.test(String(val));
const isNumber = val => /function Number/.test(String(val));
function convertAttributeValue (value, name, { type } = {}) {
if (isBoolean(type)) {
if (value === 'true' || value === 'false') {
return value === 'true'
}
if (value === '' || value === name || value != null) {
return true
}
return value
} else if (isNumber(type)) {
const parsed = parseFloat(value, 10);
return isNaN(parsed) ? value : parsed
} else {
return value
}
}
function toVNodes (h, children) {
const res = [];
for (let i = 0, l = children.length; i < l; i++) {
res.push(toVNode(h, children[i]));
}
return res
}
function toVNode (h, node) {
if (node.nodeType === 3) {
return node.data.trim() ? node.data : null
} else if (node.nodeType === 1) {
const data = {
attrs: getAttributes(node),
domProps: {
innerHTML: node.innerHTML
}
};
if (data.attrs.slot) {
data.slot = data.attrs.slot;
delete data.attrs.slot;
}
return h(node.tagName, data)
} else {
return null
}
}
function getAttributes (node) {
const res = {};
for (let i = 0, l = node.attributes.length; i < l; i++) {
const attr = node.attributes[i];
res[attr.nodeName] = attr.nodeValue;
}
return res
}
function wrap (Vue, Component) {
const isAsync = typeof Component === 'function' && !Component.cid;
let isInitialized = false;
let hyphenatedPropsList;
let camelizedPropsList;
let camelizedPropsMap;
function initialize (Component) {
if (isInitialized) return
const options = typeof Component === 'function'
? Component.options
: Component;
// extract props info
const propsList = Array.isArray(options.props)
? options.props
: Object.keys(options.props || {});
hyphenatedPropsList = propsList.map(hyphenate);
camelizedPropsList = propsList.map(camelize);
const originalPropsAsObject = Array.isArray(options.props) ? {} : options.props || {};
camelizedPropsMap = camelizedPropsList.reduce((map, key, i) => {
map[key] = originalPropsAsObject[propsList[i]];
return map
}, {});
// proxy $emit to native DOM events
injectHook(options, 'beforeCreate', function () {
const emit = this.$emit;
this.$emit = (name, ...args) => {
this.$root.$options.customElement.dispatchEvent(createCustomEvent(name, args));
return emit.call(this, name, ...args)
};
});
injectHook(options, 'created', function () {
// sync default props values to wrapper on created
camelizedPropsList.forEach(key => {
this.$root.props[key] = this[key];
});
});
// proxy props as Element properties
camelizedPropsList.forEach(key => {
Object.defineProperty(CustomElement.prototype, key, {
get () {
return this._wrapper.props[key]
},
set (newVal) {
this._wrapper.props[key] = newVal;
},
enumerable: false,
configurable: true
});
});
isInitialized = true;
}
function syncAttribute (el, key) {
const camelized = camelize(key);
const value = el.hasAttribute(key) ? el.getAttribute(key) : undefined;
el._wrapper.props[camelized] = convertAttributeValue(
value,
key,
camelizedPropsMap[camelized]
);
}
class CustomElement extends HTMLElement {
constructor () {
const self = super();
self.attachShadow({ mode: 'open' });
const wrapper = self._wrapper = new Vue({
name: 'shadow-root',
customElement: self,
shadowRoot: self.shadowRoot,
data () {
return {
props: {},
slotChildren: []
}
},
render (h) {
return h(Component, {
ref: 'inner',
props: this.props
}, this.slotChildren)
}
});
// Use MutationObserver to react to future attribute & slot content change
const observer = new MutationObserver(mutations => {
let hasChildrenChange = false;
for (let i = 0; i < mutations.length; i++) {
const m = mutations[i];
if (isInitialized && m.type === 'attributes' && m.target === self) {
syncAttribute(self, m.attributeName);
} else {
hasChildrenChange = true;
}
}
if (hasChildrenChange) {
wrapper.slotChildren = Object.freeze(toVNodes(
wrapper.$createElement,
self.childNodes
));
}
});
observer.observe(self, {
childList: true,
subtree: true,
characterData: true,
attributes: true
});
}
get vueComponent () {
return this._wrapper.$refs.inner
}
connectedCallback () {
const wrapper = this._wrapper;
if (!wrapper._isMounted) {
// initialize attributes
const syncInitialAttributes = () => {
wrapper.props = getInitialProps(camelizedPropsList);
hyphenatedPropsList.forEach(key => {
syncAttribute(this, key);
});
};
if (isInitialized) {
syncInitialAttributes();
} else {
// async & unresolved
Component().then(resolved => {
if (resolved.__esModule || resolved[Symbol.toStringTag] === 'Module') {
resolved = resolved.default;
}
initialize(resolved);
syncInitialAttributes();
});
}
// initialize children
wrapper.slotChildren = Object.freeze(toVNodes(
wrapper.$createElement,
this.childNodes
));
wrapper.$mount();
this.shadowRoot.appendChild(wrapper.$el);
} else {
callHooks(this.vueComponent, 'activated');
}
}
disconnectedCallback () {
callHooks(this.vueComponent, 'deactivated');
}
}
if (!isAsync) {
initialize(Component);
}
return CustomElement
}
/* harmony default export */ var vue_wc_wrapper = (wrap);
// EXTERNAL MODULE: ../node_modules/css-loader/dist/runtime/api.js
var api = __webpack_require__("022d");
// EXTERNAL MODULE: ../node_modules/vue-style-loader/lib/addStylesShadow.js + 1 modules
var addStylesShadow = __webpack_require__("c4de");
// CONCATENATED MODULE: ../node_modules/vue-loader/lib/runtime/componentNormalizer.js
/* globals __VUE_SSR_CONTEXT__ */
// IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
// This module is a runtime utility for cleaner component module output and will
// be included in the final webpack user bundle.
function normalizeComponent (
scriptExports,
render,
staticRenderFns,
functionalTemplate,
injectStyles,
scopeId,
moduleIdentifier, /* server only */
shadowMode /* vue-cli only */
) {
// Vue.extend constructor export interop
var options = typeof scriptExports === 'function'
? scriptExports.options
: scriptExports
// render functions
if (render) {
options.render = render
options.staticRenderFns = staticRenderFns
options._compiled = true
}
// functional template
if (functionalTemplate) {
options.functional = true
}
// scopedId
if (scopeId) {
options._scopeId = 'data-v-' + scopeId
}
var hook
if (moduleIdentifier) { // server build
hook = function (context) {
// 2.3 injection
context =
context || // cached call
(this.$vnode && this.$vnode.ssrContext) || // stateful
(this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
// 2.2 with runInNewContext: true
if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
context = __VUE_SSR_CONTEXT__
}
// inject component styles
if (injectStyles) {
injectStyles.call(this, context)
}
// register component module identifier for async chunk inferrence
if (context && context._registeredComponents) {
context._registeredComponents.add(moduleIdentifier)
}
}
// used by ssr in case component is cached and beforeCreate
// never gets called
options._ssrRegister = hook
} else if (injectStyles) {
hook = shadowMode
? function () {
injectStyles.call(
this,
(options.functional ? this.parent : this).$root.$options.shadowRoot
)
}
: injectStyles
}
if (hook) {
if (options.functional) {
// for template-only hot-reload because in that case the render fn doesn't
// go through the normalizer
options._injectStyles = hook
// register for functional component in vue file
var originalRender = options.render
options.render = function renderWithStyleInjection (h, context) {
hook.call(context)
return originalRender(h, context)
}
} else {
// inject component registration as beforeCreate hook
var existing = options.beforeCreate
options.beforeCreate = existing
? [].concat(existing, hook)
: [hook]
}
}
return {
exports: scriptExports,
options: options
}
}
// CONCATENATED MODULE: ../node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"32d9a0a2-vue-loader-template"}!../node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!../node_modules/cache-loader/dist/cjs.js??ref--0-0!../node_modules/vue-loader/lib??vue-loader-options!./src/components/Kolotoc.vue?vue&type=template&id=2800e8f6&shadow
var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',[_c('button',{on:{"click":function($event){_vm.index -= 1}}},[_vm._v("<")]),_c('button',{on:{"click":function($event){_vm.index += 1}}},[_vm._v(">")]),(_vm.images.length > 0)?_c('div',[_vm._v(" "+_vm._s(_vm.images[_vm.index].src)),_c('br'),_vm._v(" "+_vm._s(_vm.images[_vm.index].title)+" ")]):_vm._e(),_vm._l((_vm.images),function(img,i){return _c('button',{key:i,class:{active: i == _vm.index},attrs:{"title":img.title},on:{"click":function($event){_vm.index = i}}})})],2)}
var staticRenderFns = []
// CONCATENATED MODULE: ./src/components/Kolotoc.vue?vue&type=template&id=2800e8f6&shadow
// CONCATENATED MODULE: ../node_modules/cache-loader/dist/cjs.js??ref--12-0!../node_modules/thread-loader/dist/cjs.js!../node_modules/babel-loader/lib!../node_modules/cache-loader/dist/cjs.js??ref--0-0!../node_modules/vue-loader/lib??vue-loader-options!./src/components/Kolotoc.vue?vue&type=script&lang=js&shadow
//
//
//
//
//
//
//
//
//
//
//
//
/* harmony default export */ var Kolotocvue_type_script_lang_js_shadow = ({
props: {
images: {
default: function _default() {
return [];
}
}
},
data: function data() {
return {
index: 0
};
},
watch: {
index: function index(value) {
var total = this.images.length - 1;
if (value < 0) {
this.index = total;
} else if (value > total) {
this.index = 0;
}
}
}
});
// CONCATENATED MODULE: ./src/components/Kolotoc.vue?vue&type=script&lang=js&shadow
/* harmony default export */ var components_Kolotocvue_type_script_lang_js_shadow = (Kolotocvue_type_script_lang_js_shadow);
// CONCATENATED MODULE: ./src/components/Kolotoc.vue?shadow
function injectStyles (context) {
var style0 = __webpack_require__("4933")
if (style0.__inject__) style0.__inject__(context)
}
/* normalize component */
var component = normalizeComponent(
components_Kolotocvue_type_script_lang_js_shadow,
render,
staticRenderFns,
false,
injectStyles,
null,
null
,true
)
/* harmony default export */ var Kolotocshadow = (component.exports);
// CONCATENATED MODULE: ../node_modules/@vue/cli-service/lib/commands/build/entry-wc.js
// runtime shared by every component chunk
window.customElements.define('muj-kolotoc', vue_wc_wrapper(external_Vue_default.a, Kolotocshadow))
/***/ }),
/***/ "c4de":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXPORTS
__webpack_require__.d(__webpack_exports__, "default", function() { return /* binding */ addStylesToShadowDOM; });
// CONCATENATED MODULE: ../node_modules/vue-style-loader/lib/listToStyles.js
/**
* Translates the list format produced by css-loader into something
* easier to manipulate.
*/
function listToStyles (parentId, list) {
var styles = []
var newStyles = {}
for (var i = 0; i < list.length; i++) {
var item = list[i]
var id = item[0]
var css = item[1]
var media = item[2]
var sourceMap = item[3]
var part = {
id: parentId + ':' + i,
css: css,
media: media,
sourceMap: sourceMap
}
if (!newStyles[id]) {
styles.push(newStyles[id] = { id: id, parts: [part] })
} else {
newStyles[id].parts.push(part)
}
}
return styles
}
// CONCATENATED MODULE: ../node_modules/vue-style-loader/lib/addStylesShadow.js
function addStylesToShadowDOM (parentId, list, shadowRoot) {
var styles = listToStyles(parentId, list)
addStyles(styles, shadowRoot)
}
/*
type StyleObject = {
id: number;
parts: Array<StyleObjectPart>
}
type StyleObjectPart = {
css: string;
media: string;
sourceMap: ?string
}
*/
function addStyles (styles /* Array<StyleObject> */, shadowRoot) {
const injectedStyles =
shadowRoot._injectedStyles ||
(shadowRoot._injectedStyles = {})
for (var i = 0; i < styles.length; i++) {
var item = styles[i]
var style = injectedStyles[item.id]
if (!style) {
for (var j = 0; j < item.parts.length; j++) {
addStyle(item.parts[j], shadowRoot)
}
injectedStyles[item.id] = true
}
}
}
function createStyleElement (shadowRoot) {
var styleElement = document.createElement('style')
styleElement.type = 'text/css'
shadowRoot.appendChild(styleElement)
return styleElement
}
function addStyle (obj /* StyleObjectPart */, shadowRoot) {
var styleElement = createStyleElement(shadowRoot)
var css = obj.css
var media = obj.media
var sourceMap = obj.sourceMap
if (media) {
styleElement.setAttribute('media', media)
}
if (sourceMap) {
// https://developer.chrome.com/devtools/docs/javascript-debugging
// this makes source maps inside style tags work properly in Chrome
css += '\n/*# sourceURL=' + sourceMap.sources[0] + ' */'
// http://stackoverflow.com/a/26603875
css += '\n/*# sourceMappingURL=data:application/json;base64,' + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + ' */'
}
if (styleElement.styleSheet) {
styleElement.styleSheet.cssText = css
} else {
while (styleElement.firstChild) {
styleElement.removeChild(styleElement.firstChild)
}
styleElement.appendChild(document.createTextNode(css))
}
}
/***/ }),
/***/ "dc36":
/***/ (function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;// addapted from the document.currentScript polyfill by Adam Miller
// MIT license
// source: https://github.com/amiller-gh/currentScript-polyfill
// added support for Firefox https://bugzilla.mozilla.org/show_bug.cgi?id=1620505
(function (root, factory) {
if (true) {
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else {}
}(typeof self !== 'undefined' ? self : this, function () {
function getCurrentScript () {
var descriptor = Object.getOwnPropertyDescriptor(document, 'currentScript')
// for chrome
if (!descriptor && 'currentScript' in document && document.currentScript) {
return document.currentScript
}
// for other browsers with native support for currentScript
if (descriptor && descriptor.get !== getCurrentScript && document.currentScript) {
return document.currentScript
}
// IE 8-10 support script readyState
// IE 11+ & Firefox support stack trace
try {
throw new Error();
}
catch (err) {
// Find the second match for the "at" string to get file src url from stack.
var ieStackRegExp = /.*at [^(]*\((.*):(.+):(.+)\)$/ig,
ffStackRegExp = /@([^@]*):(\d+):(\d+)\s*$/ig,
stackDetails = ieStackRegExp.exec(err.stack) || ffStackRegExp.exec(err.stack),
scriptLocation = (stackDetails && stackDetails[1]) || false,
line = (stackDetails && stackDetails[2]) || false,
currentLocation = document.location.href.replace(document.location.hash, ''),
pageSource,
inlineScriptSourceRegExp,
inlineScriptSource,
scripts = document.getElementsByTagName('script'); // Live NodeList collection
if (scriptLocation === currentLocation) {
pageSource = document.documentElement.outerHTML;
inlineScriptSourceRegExp = new RegExp('(?:[^\\n]+?\\n){0,' + (line - 2) + '}[^<]*<script>([\\d\\D]*?)<\\/script>[\\d\\D]*', 'i');
inlineScriptSource = pageSource.replace(inlineScriptSourceRegExp, '$1').trim();
}
for (var i = 0; i < scripts.length; i++) {
// If ready state is interactive, return the script tag
if (scripts[i].readyState === 'interactive') {
return scripts[i];
}
// If src matches, return the script tag
if (scripts[i].src === scriptLocation) {
return scripts[i];
}
// If inline source matches, return the script tag
if (
scriptLocation === currentLocation &&
scripts[i].innerHTML &&
scripts[i].innerHTML.trim() === inlineScriptSource
) {
return scripts[i];
}
}
// If no match, return null
return null;
}
};
return getCurrentScript
}));
/***/ })
/******/ });
//# sourceMappingURL=muj-kolotoc.js.map

1
hvezdarna/static/js/muj-kolotoc.js.map

File diff suppressed because one or more lines are too long

2
hvezdarna/static/js/muj-kolotoc.min.js

File diff suppressed because one or more lines are too long

1
hvezdarna/static/js/muj-kolotoc.min.js.map

File diff suppressed because one or more lines are too long

34
hvezdarna/templates/base.html

@ -1,7 +1,7 @@
{% load static wagtailuserbar %} {% load static wagtailuserbar %}
<!DOCTYPE html> <!DOCTYPE html>
<html class="no-js" lang="en">
<html class="no-js h-100" lang="cs">
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<title> <title>
@ -18,7 +18,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="viewport" content="width=device-width, initial-scale=1" />
{# Global stylesheets #} {# Global stylesheets #}
{#<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/css/bootstrap.min.css" integrity="sha384-B0vP5xmATw1+K9KRQjQERJvTumQW0nPEzvF6L/Z6nronJ3oUOFUFpCjEUQouq2+l" crossorigin="anonymous">#}
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/css/bootstrap.min.css" integrity="sha384-B0vP5xmATw1+K9KRQjQERJvTumQW0nPEzvF6L/Z6nronJ3oUOFUFpCjEUQouq2+l" crossorigin="anonymous">
<link rel="stylesheet" type="text/css" href="{% static 'css/hvezdarna.css' %}"> <link rel="stylesheet" type="text/css" href="{% static 'css/hvezdarna.css' %}">
{% block extra_css %} {% block extra_css %}
@ -26,38 +26,48 @@
{% endblock %} {% endblock %}
</head> </head>
<body class="{% block body_class %}{% endblock %}">
<body class="d-flex flex-column h-100 {% block body_class %}{% endblock %}">
{% wagtailuserbar %} {% wagtailuserbar %}
<div class="container-fluid"> <div class="container-fluid">
<nav class="navbar navbar-expand-lg p-4 d-block d-md-flex">
<nav class="navbar navbar-expand-lg p-0 d-block d-md-flex">
<a href="/" class="navbar-brand d-block text-center d-md-inline"> <a href="/" class="navbar-brand d-block text-center d-md-inline">
LOGO LOGO
</a> </a>
<ul class="navbar-nav nav-info-text">
<ul class="navbar-nav nav-info-text ml-auto">
<li class="nav-item"> <li class="nav-item">
<a href="mailto:{{ page.email }}">{{ page.email }}</a> <a href="mailto:{{ page.email }}">{{ page.email }}</a>
</li> </li>
<li class="nav-item">|</li>
<li class="nav-item text-muted pr-2 pl-2 d-none d-lg-block">|</li>
<li class="nav-item"> <li class="nav-item">
<a href="mailto:{{ page.address }}">{{ page.address }}</a>
{{ page.address }}
</li> </li>
<li class="nav-item">|</li>
<li class="nav-item text-muted pr-2 pl-2 d-none d-lg-block">|</li>
<li class="nav-item"> <li class="nav-item">
<a href="mailto:{{ page.mobile }}">{{ page.mobile }}</a>
{{ page.mobile }}
</li> </li>
</ul> </ul>
</nav> </nav>
<hr> <hr>
</div>
{% block content %}{% endblock %} {% block content %}{% endblock %}
</div>
<footer class="footer mt-auto py-3 bg-dark">
<div class="container">
<span class="text-muted">&copy; 2021 | Hvězdárna </span>
</div>
</footer>
{# Global javascript #} {# Global javascript #}
<script src="https://cdn.jsdelivr.net/npm/vue@2.6.12/dist/vue.js"></script>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vue@2.6.12"></script>
<script type="text/javascript" src="{% static 'js/muj-kolotoc.min.js' %}"></script>
<script type="text/javascript" src="{% static 'js/hvezdarna.js' %}"></script> <script type="text/javascript" src="{% static 'js/hvezdarna.js' %}"></script>
{% block extra_js %} {% block extra_js %}
{# Override this in templates to add extra javascript #} {# Override this in templates to add extra javascript #}
{% endblock %} {% endblock %}

4
hvezdarna/urls.py

@ -8,7 +8,11 @@ from wagtail.documents import urls as wagtaildocs_urls
from search import views as search_views from search import views as search_views
from .api import api_router
urlpatterns = [ urlpatterns = [
path('api/v2/', api_router.urls),
path('django-admin/', admin.site.urls), path('django-admin/', admin.site.urls),
path('admin/', include(wagtailadmin_urls)), path('admin/', include(wagtailadmin_urls)),

Loading…
Cancel
Save