Working v0
This commit is contained in:
+31
-15
@@ -11,9 +11,7 @@
|
||||
<script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/vue@2.7.16/dist/vue.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
||||
<!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/vue-resource/0.6.1/vue-resource.min.js"></script> -->
|
||||
<script src="https://cdn.jsdelivr.net/npm/vue-resource@1.5.3"></script>
|
||||
<script src="https://unpkg.com/htmx.org@2.0.2"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/js-cookie@3.0.5/dist/js.cookie.min.js"></script>
|
||||
<script src="https://unpkg.com/vue-router@3/dist/vue-router.js"></script>
|
||||
|
||||
@@ -28,14 +26,22 @@
|
||||
|
||||
<link href="https://cdn.jsdelivr.net/npm/@mdi/font@7.4.47/css/materialdesignicons.min.css" rel="stylesheet">
|
||||
|
||||
<link href="https://fonts.cdnfonts.com/css/jetbrains-mono" rel="stylesheet">
|
||||
<style>
|
||||
.font {
|
||||
font-family: 'JetBrains Mono', sans-serif;
|
||||
}
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'>
|
||||
<v-app>
|
||||
<body>
|
||||
<v-app class="font">
|
||||
<div id="main" data-app>
|
||||
|
||||
<nav class="navbar navbar-expand-lg bg-primary" data-bs-theme="dark">
|
||||
<div class="container-fluid">
|
||||
<a href="#" @click="lock_me" class="navbar-brand">{% trans "Lock" %}</a>
|
||||
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarColor01" aria-controls="navbarColor01" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
@@ -49,13 +55,13 @@
|
||||
</router-link>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<router-link class="nav-link" to="/item_list">{% trans "Items" %}</router-link>
|
||||
<router-link class="nav-link" to="/ItemView">{% trans "Items" %}</router-link>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#">{% trans "Properties" %}</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<router-link class="nav-link" to="/encryption-testing">{% trans "Encryption" %}</router-link>
|
||||
<router-link class="nav-link" to="/EncryptionTesting">{% trans "Encryption" %}</router-link>
|
||||
</li>
|
||||
<li class="nav-item dropdown">
|
||||
<a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">{% trans "More" %}</a>
|
||||
@@ -77,7 +83,7 @@
|
||||
</nav>
|
||||
|
||||
<div id="app" class="container">
|
||||
<k356-loading :crypto_key="key" @update_key="update_key" v-if="locked"></k356-loading>
|
||||
<Loading :crypto_key="key" @update_key="update_key" v-if="locked"></Loading>
|
||||
<template v-if="!locked">
|
||||
<router-view :crypto_key="key"></router-view>
|
||||
</template>
|
||||
@@ -101,17 +107,17 @@
|
||||
|
||||
Vue.config.delimiters = ["[[", "]]"];
|
||||
|
||||
{% for name, value in components.items %}
|
||||
{% include value.path %}
|
||||
Vue.component("{{ name }}", {{ value.flat_name }});
|
||||
{% for name, path in components.items %}
|
||||
{% include path %}
|
||||
Vue.component("{{ name }}", {{ name }});
|
||||
{% endfor %}
|
||||
|
||||
const routes = [
|
||||
{ path: '/', component: null },
|
||||
{% for name, value in components.items %}
|
||||
{% for name, path in components.items %}
|
||||
{
|
||||
path: "/{{ name }}",
|
||||
component: {{ value.flat_name }},
|
||||
component: {{ name }},
|
||||
},
|
||||
{% endfor %}
|
||||
];
|
||||
@@ -131,7 +137,6 @@
|
||||
},
|
||||
methods: {
|
||||
update_key: function(key) {
|
||||
console.log(key);
|
||||
this.key.key = key;
|
||||
this.locked = key == null;
|
||||
},
|
||||
@@ -143,9 +148,9 @@
|
||||
}
|
||||
});
|
||||
|
||||
router.beforeEach((to, from) => {
|
||||
router.beforeEach((to, from, next) => {
|
||||
// Prevent from routing if key is not present.
|
||||
return approuter.key.key != null;
|
||||
next(approuter.key.key != null);
|
||||
});
|
||||
|
||||
</script>
|
||||
@@ -159,5 +164,16 @@
|
||||
refresh_csrftoken();
|
||||
</script>
|
||||
|
||||
<script type="module">
|
||||
import { useDate } from './vuetify.js'
|
||||
|
||||
const date = useDate()
|
||||
|
||||
const formatted = date.format('2010-04-13', 'fullDateWithWeekday')
|
||||
|
||||
console.log(formatted) // Tuesday, April 13, 2010
|
||||
</script>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user