mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-10-03 20:09:42 +00:00
Apply prettier rules
This commit is contained in:
@@ -1,39 +1,49 @@
|
||||
import AddressDetailsButton from "../../vuejs/_components/AddressDetails/AddressDetailsButton.vue";
|
||||
import {createApp} from "vue";
|
||||
import {createI18n} from "vue-i18n";
|
||||
import {_createI18n} from "../../vuejs/_js/i18n";
|
||||
import {Address} from "../../types";
|
||||
import { createApp } from "vue";
|
||||
import { createI18n } from "vue-i18n";
|
||||
import { _createI18n } from "../../vuejs/_js/i18n";
|
||||
import { Address } from "../../types";
|
||||
|
||||
const i18n = _createI18n({});
|
||||
|
||||
document.querySelectorAll<HTMLSpanElement>('span[data-address-details]').forEach((el) => {
|
||||
const dataset = el.dataset as {
|
||||
addressId: string,
|
||||
addressRefStatus: string,
|
||||
};
|
||||
document
|
||||
.querySelectorAll<HTMLSpanElement>("span[data-address-details]")
|
||||
.forEach((el) => {
|
||||
const dataset = el.dataset as {
|
||||
addressId: string;
|
||||
addressRefStatus: string;
|
||||
};
|
||||
|
||||
const app = createApp({
|
||||
components: {AddressDetailsButton},
|
||||
data() {
|
||||
return {
|
||||
addressId: Number.parseInt(dataset.addressId),
|
||||
addressRefStatus: dataset.addressRefStatus,
|
||||
}
|
||||
},
|
||||
template: '<address-details-button :address_id="addressId" :address_ref_status="addressRefStatus" @update-address="onUpdateAddress"></address-details-button>',
|
||||
methods: {
|
||||
onUpdateAddress: (address: Address): void => {
|
||||
if (address.refStatus === 'to_review' || address.refStatus === 'reviewed') {
|
||||
// in this two case, the address content do not change
|
||||
return;
|
||||
}
|
||||
if (window.confirm("L'adresse a été modifiée. Vous pouvez continuer votre travail. Cependant, pour afficher les données immédiatement, veuillez recharger la page. \n\n Voulez-vous recharger la page immédiatement ?")) {
|
||||
window.location.reload();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
const app = createApp({
|
||||
components: { AddressDetailsButton },
|
||||
data() {
|
||||
return {
|
||||
addressId: Number.parseInt(dataset.addressId),
|
||||
addressRefStatus: dataset.addressRefStatus,
|
||||
};
|
||||
},
|
||||
template:
|
||||
'<address-details-button :address_id="addressId" :address_ref_status="addressRefStatus" @update-address="onUpdateAddress"></address-details-button>',
|
||||
methods: {
|
||||
onUpdateAddress: (address: Address): void => {
|
||||
if (
|
||||
address.refStatus === "to_review" ||
|
||||
address.refStatus === "reviewed"
|
||||
) {
|
||||
// in this two case, the address content do not change
|
||||
return;
|
||||
}
|
||||
if (
|
||||
window.confirm(
|
||||
"L'adresse a été modifiée. Vous pouvez continuer votre travail. Cependant, pour afficher les données immédiatement, veuillez recharger la page. \n\n Voulez-vous recharger la page immédiatement ?",
|
||||
)
|
||||
) {
|
||||
window.location.reload();
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
app.use(i18n);
|
||||
app.mount(el);
|
||||
});
|
||||
app.use(i18n);
|
||||
app.mount(el);
|
||||
});
|
||||
|
@@ -1,20 +1,20 @@
|
||||
require('./blur.scss');
|
||||
require("./blur.scss");
|
||||
|
||||
document.querySelectorAll('.confidential').forEach(function (el) {
|
||||
let i = document.createElement('i');
|
||||
const classes = ['fa', 'fa-eye-slash', 'toggle-twig'];
|
||||
i.classList.add(...classes);
|
||||
el.appendChild(i);
|
||||
document.querySelectorAll(".confidential").forEach(function (el) {
|
||||
let i = document.createElement("i");
|
||||
const classes = ["fa", "fa-eye-slash", "toggle-twig"];
|
||||
i.classList.add(...classes);
|
||||
el.appendChild(i);
|
||||
|
||||
const toggleBlur = function(e) {
|
||||
for (let child of el.children) {
|
||||
if (!child.classList.contains('toggle-twig')) {
|
||||
child.classList.toggle('blur');
|
||||
}
|
||||
}
|
||||
i.classList.toggle('fa-eye-slash');
|
||||
i.classList.toggle('fa-eye');
|
||||
const toggleBlur = function (e) {
|
||||
for (let child of el.children) {
|
||||
if (!child.classList.contains("toggle-twig")) {
|
||||
child.classList.toggle("blur");
|
||||
}
|
||||
}
|
||||
i.addEventListener('click', toggleBlur);
|
||||
toggleBlur();
|
||||
});
|
||||
i.classList.toggle("fa-eye-slash");
|
||||
i.classList.toggle("fa-eye");
|
||||
};
|
||||
i.addEventListener("click", toggleBlur);
|
||||
toggleBlur();
|
||||
});
|
||||
|
@@ -2,62 +2,65 @@
|
||||
//require('bootstrap/scss/bootstrap.scss')
|
||||
|
||||
// Or compile bootstrap only enabled assets
|
||||
require('./bootstrap.scss');
|
||||
require("./bootstrap.scss");
|
||||
|
||||
// You can specify which plugins you need
|
||||
import Dropdown from 'bootstrap/js/src/dropdown';
|
||||
import Modal from 'bootstrap/js/dist/modal';
|
||||
import Collapse from 'bootstrap/js/src/collapse';
|
||||
import Carousel from 'bootstrap/js/src/carousel';
|
||||
import Popover from 'bootstrap/js/src/popover';
|
||||
import 'bootstrap-icons/font/bootstrap-icons.css';
|
||||
import Dropdown from "bootstrap/js/src/dropdown";
|
||||
import Modal from "bootstrap/js/dist/modal";
|
||||
import Collapse from "bootstrap/js/src/collapse";
|
||||
import Carousel from "bootstrap/js/src/carousel";
|
||||
import Popover from "bootstrap/js/src/popover";
|
||||
import "bootstrap-icons/font/bootstrap-icons.css";
|
||||
|
||||
//
|
||||
// Carousel: ACHeaderSlider is a small slider used in banner of AccompanyingCourse Section
|
||||
// Initialize options, and show/hide controls in first/last slides
|
||||
//
|
||||
let ACHeaderSlider = document.querySelector('#ACHeaderSlider');
|
||||
let ACHeaderSlider = document.querySelector("#ACHeaderSlider");
|
||||
if (ACHeaderSlider) {
|
||||
let controlPrev = ACHeaderSlider.querySelector('button[data-bs-slide="prev"]'),
|
||||
controlNext = ACHeaderSlider.querySelector('button[data-bs-slide="next"]'),
|
||||
length = ACHeaderSlider.querySelectorAll('.carousel-item').length,
|
||||
last = length-1,
|
||||
carousel = new Carousel(ACHeaderSlider, {
|
||||
interval: false,
|
||||
wrap: false,
|
||||
ride: false,
|
||||
keyboard: false,
|
||||
touch: true
|
||||
})
|
||||
;
|
||||
document.addEventListener('DOMContentLoaded', (e) => {
|
||||
controlNext.classList.remove('visually-hidden');
|
||||
let controlPrev = ACHeaderSlider.querySelector(
|
||||
'button[data-bs-slide="prev"]',
|
||||
),
|
||||
controlNext = ACHeaderSlider.querySelector('button[data-bs-slide="next"]'),
|
||||
length = ACHeaderSlider.querySelectorAll(".carousel-item").length,
|
||||
last = length - 1,
|
||||
carousel = new Carousel(ACHeaderSlider, {
|
||||
interval: false,
|
||||
wrap: false,
|
||||
ride: false,
|
||||
keyboard: false,
|
||||
touch: true,
|
||||
});
|
||||
ACHeaderSlider.addEventListener('slid.bs.carousel', (e) => {
|
||||
//console.log('from slide', e.direction, e.relatedTarget, e.from, e.to );
|
||||
switch (e.to) {
|
||||
case 0:
|
||||
controlPrev.classList.add('visually-hidden');
|
||||
controlNext.classList.remove('visually-hidden');
|
||||
break;
|
||||
case last:
|
||||
controlPrev.classList.remove('visually-hidden');
|
||||
controlNext.classList.add('visually-hidden');
|
||||
break;
|
||||
default:
|
||||
controlPrev.classList.remove('visually-hidden');
|
||||
controlNext.classList.remove('visually-hidden');
|
||||
}
|
||||
})
|
||||
document.addEventListener("DOMContentLoaded", (e) => {
|
||||
controlNext.classList.remove("visually-hidden");
|
||||
});
|
||||
ACHeaderSlider.addEventListener("slid.bs.carousel", (e) => {
|
||||
//console.log('from slide', e.direction, e.relatedTarget, e.from, e.to );
|
||||
switch (e.to) {
|
||||
case 0:
|
||||
controlPrev.classList.add("visually-hidden");
|
||||
controlNext.classList.remove("visually-hidden");
|
||||
break;
|
||||
case last:
|
||||
controlPrev.classList.remove("visually-hidden");
|
||||
controlNext.classList.add("visually-hidden");
|
||||
break;
|
||||
default:
|
||||
controlPrev.classList.remove("visually-hidden");
|
||||
controlNext.classList.remove("visually-hidden");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//
|
||||
// Popover: used in workflow breadcrumb,
|
||||
// (expected in: contextual help, notification-box, workflow-box )
|
||||
//
|
||||
const triggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="popover"]'));
|
||||
const triggerList = [].slice.call(
|
||||
document.querySelectorAll('[data-bs-toggle="popover"]'),
|
||||
);
|
||||
const popoverList = triggerList.map(function (el) {
|
||||
return new Popover(el, {
|
||||
html: true,
|
||||
});
|
||||
return new Popover(el, {
|
||||
html: true,
|
||||
});
|
||||
});
|
||||
|
@@ -1,13 +1,13 @@
|
||||
import ClassicEditorBase from '@ckeditor/ckeditor5-editor-classic/src/classiceditor';
|
||||
import EssentialsPlugin from '@ckeditor/ckeditor5-essentials/src/essentials';
|
||||
import MarkdownPlugin from '@ckeditor/ckeditor5-markdown-gfm/src/markdown';
|
||||
import BoldPlugin from '@ckeditor/ckeditor5-basic-styles/src/bold';
|
||||
import ItalicPlugin from '@ckeditor/ckeditor5-basic-styles/src/italic';
|
||||
import BlockQuotePlugin from '@ckeditor/ckeditor5-block-quote/src/blockquote';
|
||||
import HeadingPlugin from '@ckeditor/ckeditor5-heading/src/heading';
|
||||
import LinkPlugin from '@ckeditor/ckeditor5-link/src/link';
|
||||
import ListPlugin from '@ckeditor/ckeditor5-list/src/list';
|
||||
import ParagraphPlugin from '@ckeditor/ckeditor5-paragraph/src/paragraph';
|
||||
import ClassicEditorBase from "@ckeditor/ckeditor5-editor-classic/src/classiceditor";
|
||||
import EssentialsPlugin from "@ckeditor/ckeditor5-essentials/src/essentials";
|
||||
import MarkdownPlugin from "@ckeditor/ckeditor5-markdown-gfm/src/markdown";
|
||||
import BoldPlugin from "@ckeditor/ckeditor5-basic-styles/src/bold";
|
||||
import ItalicPlugin from "@ckeditor/ckeditor5-basic-styles/src/italic";
|
||||
import BlockQuotePlugin from "@ckeditor/ckeditor5-block-quote/src/blockquote";
|
||||
import HeadingPlugin from "@ckeditor/ckeditor5-heading/src/heading";
|
||||
import LinkPlugin from "@ckeditor/ckeditor5-link/src/link";
|
||||
import ListPlugin from "@ckeditor/ckeditor5-list/src/list";
|
||||
import ParagraphPlugin from "@ckeditor/ckeditor5-paragraph/src/paragraph";
|
||||
import "./index.scss";
|
||||
|
||||
export default class ClassicEditor extends ClassicEditorBase {}
|
||||
@@ -21,23 +21,23 @@ ClassicEditor.builtinPlugins = [
|
||||
HeadingPlugin,
|
||||
LinkPlugin,
|
||||
ListPlugin,
|
||||
ParagraphPlugin
|
||||
ParagraphPlugin,
|
||||
];
|
||||
|
||||
ClassicEditor.defaultConfig = {
|
||||
toolbar: {
|
||||
items: [
|
||||
'heading',
|
||||
'|',
|
||||
'bold',
|
||||
'italic',
|
||||
'link',
|
||||
'bulletedList',
|
||||
'numberedList',
|
||||
'blockQuote',
|
||||
'undo',
|
||||
'redo'
|
||||
]
|
||||
"heading",
|
||||
"|",
|
||||
"bold",
|
||||
"italic",
|
||||
"link",
|
||||
"bulletedList",
|
||||
"numberedList",
|
||||
"blockQuote",
|
||||
"undo",
|
||||
"redo",
|
||||
],
|
||||
},
|
||||
language: 'fr',
|
||||
language: "fr",
|
||||
};
|
||||
|
@@ -1,15 +1,14 @@
|
||||
import ClassicEditor from "./editor_config";
|
||||
|
||||
const ckeditorFields: NodeListOf<HTMLTextAreaElement> = document.querySelectorAll('textarea[ckeditor]');
|
||||
const ckeditorFields: NodeListOf<HTMLTextAreaElement> =
|
||||
document.querySelectorAll("textarea[ckeditor]");
|
||||
ckeditorFields.forEach((field: HTMLTextAreaElement): void => {
|
||||
ClassicEditor
|
||||
.create( field )
|
||||
.then( editor => {
|
||||
ClassicEditor.create(field)
|
||||
.then((editor) => {
|
||||
//console.log( 'CkEditor was initialized', editor );
|
||||
})
|
||||
.catch( error => {
|
||||
console.error( error.stack );
|
||||
})
|
||||
;
|
||||
.catch((error) => {
|
||||
console.error(error.stack);
|
||||
});
|
||||
});
|
||||
//Fields.push.apply(Fields, document.querySelectorAll('.cf-fields textarea'));
|
||||
|
@@ -28,7 +28,7 @@
|
||||
* });
|
||||
* ```
|
||||
*/
|
||||
import './collection.scss';
|
||||
import "./collection.scss";
|
||||
|
||||
export class CollectionEventPayload {
|
||||
collection: HTMLUListElement;
|
||||
@@ -41,27 +41,31 @@ export class CollectionEventPayload {
|
||||
}
|
||||
|
||||
export const handleAdd = (button: any): void => {
|
||||
const
|
||||
form_name = button.dataset.collectionAddTarget,
|
||||
const form_name = button.dataset.collectionAddTarget,
|
||||
prototype = button.dataset.formPrototype,
|
||||
collection: HTMLUListElement | null = document.querySelector('ul[data-collection-name="' + form_name + '"]');
|
||||
collection: HTMLUListElement | null = document.querySelector(
|
||||
'ul[data-collection-name="' + form_name + '"]',
|
||||
);
|
||||
|
||||
if (collection === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
const
|
||||
empty_explain: HTMLLIElement | null = collection.querySelector('li[data-collection-empty-explain]'),
|
||||
entry = document.createElement('li'),
|
||||
counter = collection.querySelectorAll('li.entry').length, // Updated counter logic
|
||||
const empty_explain: HTMLLIElement | null = collection.querySelector(
|
||||
"li[data-collection-empty-explain]",
|
||||
),
|
||||
entry = document.createElement("li"),
|
||||
counter = collection.querySelectorAll("li.entry").length, // Updated counter logic
|
||||
content = prototype.replace(/__name__/g, counter.toString()),
|
||||
event = new CustomEvent('collection-add-entry', {detail: new CollectionEventPayload(collection, entry)});
|
||||
event = new CustomEvent("collection-add-entry", {
|
||||
detail: new CollectionEventPayload(collection, entry),
|
||||
});
|
||||
|
||||
console.log(counter)
|
||||
console.log(content)
|
||||
console.log(counter);
|
||||
console.log(content);
|
||||
|
||||
entry.innerHTML = content;
|
||||
entry.classList.add('entry');
|
||||
entry.classList.add("entry");
|
||||
|
||||
if ("collectionRegular" in collection.dataset) {
|
||||
initializeRemove(collection, entry);
|
||||
@@ -75,7 +79,10 @@ export const handleAdd = (button: any): void => {
|
||||
window.dispatchEvent(event);
|
||||
};
|
||||
|
||||
const initializeRemove = (collection: HTMLUListElement, entry: HTMLLIElement): void => {
|
||||
const initializeRemove = (
|
||||
collection: HTMLUListElement,
|
||||
entry: HTMLLIElement,
|
||||
): void => {
|
||||
const button = buildRemoveButton(collection, entry);
|
||||
if (null === button) {
|
||||
return;
|
||||
@@ -83,21 +90,24 @@ const initializeRemove = (collection: HTMLUListElement, entry: HTMLLIElement): v
|
||||
entry.appendChild(button);
|
||||
};
|
||||
|
||||
export const buildRemoveButton = (collection: HTMLUListElement, entry: HTMLLIElement): HTMLButtonElement|null => {
|
||||
export const buildRemoveButton = (
|
||||
collection: HTMLUListElement,
|
||||
entry: HTMLLIElement,
|
||||
): HTMLButtonElement | null => {
|
||||
const button = document.createElement("button"),
|
||||
isPersisted = entry.dataset.collectionIsPersisted || "",
|
||||
content = collection.dataset.collectionButtonRemoveLabel || "",
|
||||
allowDelete = collection.dataset.collectionAllowDelete || "",
|
||||
event = new CustomEvent("collection-remove-entry", {
|
||||
detail: new CollectionEventPayload(collection, entry),
|
||||
});
|
||||
|
||||
const
|
||||
button = document.createElement('button'),
|
||||
isPersisted = entry.dataset.collectionIsPersisted || '',
|
||||
content = collection.dataset.collectionButtonRemoveLabel || '',
|
||||
allowDelete = collection.dataset.collectionAllowDelete || '',
|
||||
event = new CustomEvent('collection-remove-entry', {detail: new CollectionEventPayload(collection, entry)});
|
||||
|
||||
if (allowDelete === '0' && isPersisted === '1') {
|
||||
if (allowDelete === "0" && isPersisted === "1") {
|
||||
return null;
|
||||
}
|
||||
button.classList.add('btn', 'btn-delete', 'remove-entry');
|
||||
button.classList.add("btn", "btn-delete", "remove-entry");
|
||||
button.textContent = content;
|
||||
button.addEventListener('click', (e: Event) => {
|
||||
button.addEventListener("click", (e: Event) => {
|
||||
e.preventDefault();
|
||||
entry.remove();
|
||||
collection.dispatchEvent(event);
|
||||
@@ -105,22 +115,26 @@ export const buildRemoveButton = (collection: HTMLUListElement, entry: HTMLLIEle
|
||||
});
|
||||
|
||||
return button;
|
||||
}
|
||||
};
|
||||
|
||||
window.addEventListener('load', () => {
|
||||
const
|
||||
addButtons: NodeListOf<HTMLButtonElement> = document.querySelectorAll("button[data-collection-add-target]"),
|
||||
collections: NodeListOf<HTMLUListElement> = document.querySelectorAll("ul[data-collection-regular]");
|
||||
window.addEventListener("load", () => {
|
||||
const addButtons: NodeListOf<HTMLButtonElement> = document.querySelectorAll(
|
||||
"button[data-collection-add-target]",
|
||||
),
|
||||
collections: NodeListOf<HTMLUListElement> = document.querySelectorAll(
|
||||
"ul[data-collection-regular]",
|
||||
);
|
||||
|
||||
for (let i = 0; i < addButtons.length; i++) {
|
||||
const addButton = addButtons[i];
|
||||
addButton.addEventListener('click', (e: Event) => {
|
||||
addButton.addEventListener("click", (e: Event) => {
|
||||
e.preventDefault();
|
||||
handleAdd(e.target);
|
||||
});
|
||||
}
|
||||
for (let i = 0; i < collections.length; i++) {
|
||||
const entries: NodeListOf<HTMLLIElement> = collections[i].querySelectorAll(':scope > li');
|
||||
const entries: NodeListOf<HTMLLIElement> =
|
||||
collections[i].querySelectorAll(":scope > li");
|
||||
for (let j = 0; j < entries.length; j++) {
|
||||
if (entries[j].dataset.collectionEmptyExplain === "1") {
|
||||
continue;
|
||||
|
@@ -3,14 +3,11 @@
|
||||
* ID 'create-form' must be added to submit forms.
|
||||
*/
|
||||
|
||||
var form = document.getElementById('create-form');
|
||||
var form = document.getElementById("create-form");
|
||||
var submitButtons = document.querySelectorAll("[type=submit]");
|
||||
|
||||
form.addEventListener('submit', function(e){
|
||||
for(var i=0; i<submitButtons.length; i++){
|
||||
submitButtons[i].disabled = true;
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
|
||||
form.addEventListener("submit", function (e) {
|
||||
for (var i = 0; i < submitButtons.length; i++) {
|
||||
submitButtons[i].disabled = true;
|
||||
}
|
||||
});
|
||||
|
@@ -1,34 +1,32 @@
|
||||
import { createApp } from "vue";
|
||||
import ListWorkflowModalVue from 'ChillMainAssets/vuejs/_components/EntityWorkflow/ListWorkflowModal.vue';
|
||||
import ListWorkflowModalVue from "ChillMainAssets/vuejs/_components/EntityWorkflow/ListWorkflowModal.vue";
|
||||
import { _createI18n } from "ChillMainAssets/vuejs/_js/i18n";
|
||||
|
||||
const i18n = _createI18n({});
|
||||
|
||||
// list workflow
|
||||
document.querySelectorAll('[data-list-workflows]')
|
||||
.forEach(function (el) {
|
||||
const app = {
|
||||
components: {
|
||||
ListWorkflowModalVue,
|
||||
},
|
||||
template:
|
||||
'<list-workflow-modal-vue ' +
|
||||
':workflows="workflows" ' +
|
||||
':allowCreate="allowCreate" ' +
|
||||
':relatedEntityClass="relatedEntityClass" ' +
|
||||
':relatedEntityId="relatedEntityId" ' +
|
||||
':workflowsAvailables="workflowsAvailables" ' +
|
||||
'></list-workflow-modal-vue>',
|
||||
data() {
|
||||
return {
|
||||
workflows: JSON.parse(el.dataset.workflows),
|
||||
allowCreate: el.dataset.allowCreate === "1",
|
||||
relatedEntityClass: el.dataset.relatedEntityClass,
|
||||
relatedEntityId: Number.parseInt(el.dataset.relatedEntityId),
|
||||
workflowsAvailables: JSON.parse(el.dataset.workflowsAvailables),
|
||||
}
|
||||
}
|
||||
};
|
||||
createApp(app).use(i18n).mount(el);
|
||||
})
|
||||
;
|
||||
document.querySelectorAll("[data-list-workflows]").forEach(function (el) {
|
||||
const app = {
|
||||
components: {
|
||||
ListWorkflowModalVue,
|
||||
},
|
||||
template:
|
||||
"<list-workflow-modal-vue " +
|
||||
':workflows="workflows" ' +
|
||||
':allowCreate="allowCreate" ' +
|
||||
':relatedEntityClass="relatedEntityClass" ' +
|
||||
':relatedEntityId="relatedEntityId" ' +
|
||||
':workflowsAvailables="workflowsAvailables" ' +
|
||||
"></list-workflow-modal-vue>",
|
||||
data() {
|
||||
return {
|
||||
workflows: JSON.parse(el.dataset.workflows),
|
||||
allowCreate: el.dataset.allowCreate === "1",
|
||||
relatedEntityClass: el.dataset.relatedEntityClass,
|
||||
relatedEntityId: Number.parseInt(el.dataset.relatedEntityId),
|
||||
workflowsAvailables: JSON.parse(el.dataset.workflowsAvailables),
|
||||
};
|
||||
},
|
||||
};
|
||||
createApp(app).use(i18n).mount(el);
|
||||
});
|
||||
|
@@ -1,32 +1,33 @@
|
||||
import {createApp} from "vue";
|
||||
import EntityWorkflowVueSubscriber from 'ChillMainAssets/vuejs/_components/EntityWorkflow/EntityWorkflowVueSubscriber.vue';
|
||||
import { _createI18n } from 'ChillMainAssets/vuejs/_js/i18n';
|
||||
import { appMessages } from 'ChillMainAssets/vuejs/PickEntity/i18n';
|
||||
import { createApp } from "vue";
|
||||
import EntityWorkflowVueSubscriber from "ChillMainAssets/vuejs/_components/EntityWorkflow/EntityWorkflowVueSubscriber.vue";
|
||||
import { _createI18n } from "ChillMainAssets/vuejs/_js/i18n";
|
||||
import { appMessages } from "ChillMainAssets/vuejs/PickEntity/i18n";
|
||||
|
||||
const i18n = _createI18n(appMessages);
|
||||
|
||||
let containers = document.querySelectorAll('[data-entity-workflow-subscribe]');
|
||||
let containers = document.querySelectorAll("[data-entity-workflow-subscribe]");
|
||||
|
||||
containers.forEach(container => {
|
||||
let app = {
|
||||
components: {
|
||||
EntityWorkflowVueSubscriber,
|
||||
},
|
||||
template: '<entity-workflow-vue-subscriber :entityWorkflowId="this.entityWorkflowId" :subscriberStep="this.subscriberStep" :subscriberFinal="this.subscriberFinal" @subscriptionUpdated="onUpdate"></entity-workflow-vue-subscriber>',
|
||||
data() {
|
||||
return {
|
||||
entityWorkflowId: Number.parseInt(container.dataset.entityWorkflowId),
|
||||
subscriberStep: container.dataset.subscribeStep === "1",
|
||||
subscriberFinal: container.dataset.subscribeFinal === "1",
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onUpdate(status) {
|
||||
this.subscriberStep = status.step;
|
||||
this.subscriberFinal = status.final;
|
||||
}
|
||||
}
|
||||
}
|
||||
containers.forEach((container) => {
|
||||
let app = {
|
||||
components: {
|
||||
EntityWorkflowVueSubscriber,
|
||||
},
|
||||
template:
|
||||
'<entity-workflow-vue-subscriber :entityWorkflowId="this.entityWorkflowId" :subscriberStep="this.subscriberStep" :subscriberFinal="this.subscriberFinal" @subscriptionUpdated="onUpdate"></entity-workflow-vue-subscriber>',
|
||||
data() {
|
||||
return {
|
||||
entityWorkflowId: Number.parseInt(container.dataset.entityWorkflowId),
|
||||
subscriberStep: container.dataset.subscribeStep === "1",
|
||||
subscriberFinal: container.dataset.subscribeFinal === "1",
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
onUpdate(status) {
|
||||
this.subscriberStep = status.step;
|
||||
this.subscriberFinal = status.final;
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
createApp(app).use(i18n).mount(container);
|
||||
})
|
||||
createApp(app).use(i18n).mount(container);
|
||||
});
|
||||
|
@@ -1,2 +1,2 @@
|
||||
// Compile all Fork-Awesome fonts assets from node-modules
|
||||
require('fork-awesome/scss/fork-awesome.scss');
|
||||
require("fork-awesome/scss/fork-awesome.scss");
|
||||
|
@@ -1 +1 @@
|
||||
import './index.scss';
|
||||
import "./index.scss";
|
||||
|
@@ -60,4 +60,3 @@ window.addEventListener("DOMContentLoaded", function (e) {
|
||||
.mount(el);
|
||||
});
|
||||
});
|
||||
|
||||
|
@@ -8,7 +8,7 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||
const elements = document.querySelectorAll(".notification_all_read");
|
||||
|
||||
elements.forEach((element) => {
|
||||
console.log('launch');
|
||||
console.log("launch");
|
||||
createApp({
|
||||
template: `<notification-read-all-toggle @markAsRead="markAsRead" @markAsUnRead="markAsUnread"></notification-read-all-toggle>`,
|
||||
components: {
|
||||
@@ -16,24 +16,28 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||
},
|
||||
methods: {
|
||||
markAsRead(id: number) {
|
||||
const el = document.querySelector<HTMLDivElement>(`div.notification-status[data-notification-id="${id}"]`);
|
||||
const el = document.querySelector<HTMLDivElement>(
|
||||
`div.notification-status[data-notification-id="${id}"]`,
|
||||
);
|
||||
if (el === null) {
|
||||
return;
|
||||
}
|
||||
el.classList.add('read');
|
||||
el.classList.remove('unread');
|
||||
el.classList.add("read");
|
||||
el.classList.remove("unread");
|
||||
},
|
||||
markAsUnread(id: number) {
|
||||
const el = document.querySelector<HTMLDivElement>(`div.notification-status[data-notification-id="${id}"]`);
|
||||
const el = document.querySelector<HTMLDivElement>(
|
||||
`div.notification-status[data-notification-id="${id}"]`,
|
||||
);
|
||||
if (el === null) {
|
||||
return;
|
||||
}
|
||||
el.classList.remove('read');
|
||||
el.classList.add('unread');
|
||||
el.classList.remove("read");
|
||||
el.classList.add("unread");
|
||||
},
|
||||
}
|
||||
},
|
||||
})
|
||||
.use(i18n)
|
||||
.mount(element);
|
||||
.use(i18n)
|
||||
.mount(element);
|
||||
});
|
||||
});
|
||||
|
@@ -1,7 +1,7 @@
|
||||
import { createApp } from 'vue';
|
||||
import PickEntity from 'ChillMainAssets/vuejs/PickEntity/PickEntity.vue';
|
||||
import { _createI18n } from 'ChillMainAssets/vuejs/_js/i18n';
|
||||
import { appMessages } from 'ChillMainAssets/vuejs/PickEntity/i18n';
|
||||
import { createApp } from "vue";
|
||||
import PickEntity from "ChillMainAssets/vuejs/PickEntity/PickEntity.vue";
|
||||
import { _createI18n } from "ChillMainAssets/vuejs/_js/i18n";
|
||||
import { appMessages } from "ChillMainAssets/vuejs/PickEntity/i18n";
|
||||
|
||||
const i18n = _createI18n(appMessages);
|
||||
|
||||
@@ -9,155 +9,169 @@ let appsOnPage = new Map();
|
||||
let appsPerInput = new Map();
|
||||
|
||||
function loadDynamicPicker(element) {
|
||||
let apps = element.querySelectorAll('[data-module="pick-dynamic"]');
|
||||
|
||||
let apps = element.querySelectorAll('[data-module="pick-dynamic"]');
|
||||
apps.forEach(function (el) {
|
||||
const isMultiple = parseInt(el.dataset.multiple) === 1,
|
||||
uniqId = el.dataset.uniqid,
|
||||
input = element.querySelector(
|
||||
'[data-input-uniqid="' + el.dataset.uniqid + '"]',
|
||||
),
|
||||
// the "picked" will always be an array, even if multiple is false
|
||||
picked = isMultiple
|
||||
? JSON.parse(input.value)
|
||||
: input.value === "[]" || input.value === ""
|
||||
? null
|
||||
: [JSON.parse(input.value)];
|
||||
(suggested = JSON.parse(el.dataset.suggested)),
|
||||
(as_id = parseInt(el.dataset.asId) === 1),
|
||||
(submit_on_adding_new_entity =
|
||||
parseInt(el.dataset.submitOnAddingNewEntity) === 1);
|
||||
label = el.dataset.label;
|
||||
|
||||
apps.forEach(function(el) {
|
||||
if (!isMultiple) {
|
||||
if (input.value === "[]") {
|
||||
input.value = null;
|
||||
}
|
||||
}
|
||||
|
||||
const
|
||||
isMultiple = parseInt(el.dataset.multiple) === 1,
|
||||
uniqId = el.dataset.uniqid,
|
||||
input = element.querySelector('[data-input-uniqid="'+ el.dataset.uniqid +'"]'),
|
||||
// the "picked" will always be an array, even if multiple is false
|
||||
picked = isMultiple ?
|
||||
JSON.parse(input.value) : (
|
||||
(input.value === '[]' || input.value === '') ?
|
||||
null : [ JSON.parse(input.value) ]
|
||||
)
|
||||
suggested = JSON.parse(el.dataset.suggested),
|
||||
as_id = parseInt(el.dataset.asId) === 1,
|
||||
submit_on_adding_new_entity = parseInt(el.dataset.submitOnAddingNewEntity) === 1
|
||||
label = el.dataset.label;
|
||||
|
||||
if (!isMultiple) {
|
||||
if (input.value === '[]'){
|
||||
input.value = null;
|
||||
}
|
||||
}
|
||||
|
||||
const app = createApp({
|
||||
template: '<pick-entity ' +
|
||||
':multiple="multiple" ' +
|
||||
':types="types" ' +
|
||||
':picked="picked" ' +
|
||||
':uniqid="uniqid" ' +
|
||||
':suggested="notPickedSuggested" ' +
|
||||
':label="label" ' +
|
||||
'@addNewEntity="addNewEntity" ' +
|
||||
'@removeEntity="removeEntity"></pick-entity>',
|
||||
components: {
|
||||
PickEntity,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
multiple: isMultiple,
|
||||
types: JSON.parse(el.dataset.types),
|
||||
picked: picked === null ? [] : picked,
|
||||
uniqid: el.dataset.uniqid,
|
||||
suggested,
|
||||
as_id,
|
||||
submit_on_adding_new_entity,
|
||||
label,
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
notPickedSuggested() {
|
||||
const pickedIds = new Set();
|
||||
for (const p of this.picked) {
|
||||
pickedIds.add(`${p.type}${p.id}`);
|
||||
}
|
||||
return this.suggested.filter(e => !pickedIds.has(`${e.type}${e.id}`))
|
||||
const app = createApp({
|
||||
template:
|
||||
"<pick-entity " +
|
||||
':multiple="multiple" ' +
|
||||
':types="types" ' +
|
||||
':picked="picked" ' +
|
||||
':uniqid="uniqid" ' +
|
||||
':suggested="notPickedSuggested" ' +
|
||||
':label="label" ' +
|
||||
'@addNewEntity="addNewEntity" ' +
|
||||
'@removeEntity="removeEntity"></pick-entity>',
|
||||
components: {
|
||||
PickEntity,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
multiple: isMultiple,
|
||||
types: JSON.parse(el.dataset.types),
|
||||
picked: picked === null ? [] : picked,
|
||||
uniqid: el.dataset.uniqid,
|
||||
suggested,
|
||||
as_id,
|
||||
submit_on_adding_new_entity,
|
||||
label,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
notPickedSuggested() {
|
||||
const pickedIds = new Set();
|
||||
for (const p of this.picked) {
|
||||
pickedIds.add(`${p.type}${p.id}`);
|
||||
}
|
||||
return this.suggested.filter(
|
||||
(e) => !pickedIds.has(`${e.type}${e.id}`),
|
||||
);
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
addNewEntity({ entity }) {
|
||||
if (this.multiple) {
|
||||
if (
|
||||
!this.picked.some((el) => {
|
||||
return el.type === entity.type && el.id === entity.id;
|
||||
})
|
||||
) {
|
||||
this.picked.push(entity);
|
||||
if (!as_id) {
|
||||
input.value = JSON.stringify(this.picked);
|
||||
} else {
|
||||
const ids = this.picked.map((el) => el.id);
|
||||
input.value = ids.join(",");
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
addNewEntity({entity}) {
|
||||
if (this.multiple) {
|
||||
if (!this.picked.some(el => {
|
||||
return el.type === entity.type && el.id === entity.id;
|
||||
})) {
|
||||
this.picked.push(entity);
|
||||
if (!as_id) {
|
||||
input.value = JSON.stringify(this.picked);
|
||||
} else {
|
||||
const ids = this.picked.map(el => el.id);
|
||||
input.value = ids.join(',');
|
||||
}
|
||||
console.log(entity)
|
||||
}
|
||||
} else {
|
||||
if (!this.picked.some(el => {
|
||||
return el.type === entity.type && el.id === entity.id;
|
||||
})) {
|
||||
this.picked.splice(0, this.picked.length);
|
||||
this.picked.push(entity);
|
||||
if (!as_id) {
|
||||
input.value = JSON.stringify(this.picked[0]);
|
||||
} else {
|
||||
input.value = this.picked.map(el => el.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.submit_on_adding_new_entity) {
|
||||
input.form.submit();
|
||||
}
|
||||
},
|
||||
removeEntity({entity}) {
|
||||
if (-1 === this.suggested.findIndex(e => e.type === entity.type && e.id === entity.id)) {
|
||||
this.suggested.push(entity);
|
||||
}
|
||||
this.picked = this.picked.filter(e => !(e.type === entity.type && e.id === entity.id));
|
||||
if (this.multiple) {
|
||||
input.value = JSON.stringify(this.picked);
|
||||
} else {
|
||||
input.value = "";
|
||||
}
|
||||
},
|
||||
console.log(entity);
|
||||
}
|
||||
})
|
||||
.use(i18n)
|
||||
.mount(el);
|
||||
} else {
|
||||
if (
|
||||
!this.picked.some((el) => {
|
||||
return el.type === entity.type && el.id === entity.id;
|
||||
})
|
||||
) {
|
||||
this.picked.splice(0, this.picked.length);
|
||||
this.picked.push(entity);
|
||||
if (!as_id) {
|
||||
input.value = JSON.stringify(this.picked[0]);
|
||||
} else {
|
||||
input.value = this.picked.map((el) => el.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
appsOnPage.set(uniqId, app);
|
||||
appsPerInput.set(input.name, app);
|
||||
});
|
||||
if (this.submit_on_adding_new_entity) {
|
||||
input.form.submit();
|
||||
}
|
||||
},
|
||||
removeEntity({ entity }) {
|
||||
if (
|
||||
-1 ===
|
||||
this.suggested.findIndex(
|
||||
(e) => e.type === entity.type && e.id === entity.id,
|
||||
)
|
||||
) {
|
||||
this.suggested.push(entity);
|
||||
}
|
||||
this.picked = this.picked.filter(
|
||||
(e) => !(e.type === entity.type && e.id === entity.id),
|
||||
);
|
||||
if (this.multiple) {
|
||||
input.value = JSON.stringify(this.picked);
|
||||
} else {
|
||||
input.value = "";
|
||||
}
|
||||
},
|
||||
},
|
||||
})
|
||||
.use(i18n)
|
||||
.mount(el);
|
||||
|
||||
appsOnPage.set(uniqId, app);
|
||||
appsPerInput.set(input.name, app);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
document.addEventListener('show-hide-show', function(e) {
|
||||
loadDynamicPicker(e.detail.container)
|
||||
document.addEventListener("show-hide-show", function (e) {
|
||||
loadDynamicPicker(e.detail.container);
|
||||
});
|
||||
|
||||
document.addEventListener('show-hide-hide', function(e) {
|
||||
console.log('hiding event caught')
|
||||
e.detail.container.querySelectorAll('[data-module="pick-dynamic"]').forEach((el) => {
|
||||
let uniqId = el.dataset.uniqid;
|
||||
if (appsOnPage.has(uniqId)) {
|
||||
appsOnPage.get(uniqId).unmount();
|
||||
appsOnPage.delete(uniqId);
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
document.addEventListener('pick-entity-type-action', function (e) {
|
||||
console.log('pick entity event', e);
|
||||
if (!appsPerInput.has(e.detail.name)) {
|
||||
console.error('no app with this name');
|
||||
return;
|
||||
}
|
||||
const app = appsPerInput.get(e.detail.name);
|
||||
if (e.detail.action === 'add') {
|
||||
app.addNewEntity(e.detail.entity);
|
||||
} else if (e.detail.action === 'remove') {
|
||||
app.removeEntity(e.detail.entity);
|
||||
} else {
|
||||
console.error('action not supported: '+e.detail.action);
|
||||
document.addEventListener("show-hide-hide", function (e) {
|
||||
console.log("hiding event caught");
|
||||
e.detail.container
|
||||
.querySelectorAll('[data-module="pick-dynamic"]')
|
||||
.forEach((el) => {
|
||||
let uniqId = el.dataset.uniqid;
|
||||
if (appsOnPage.has(uniqId)) {
|
||||
appsOnPage.get(uniqId).unmount();
|
||||
appsOnPage.delete(uniqId);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function(e) {
|
||||
loadDynamicPicker(document)
|
||||
})
|
||||
document.addEventListener("pick-entity-type-action", function (e) {
|
||||
console.log("pick entity event", e);
|
||||
if (!appsPerInput.has(e.detail.name)) {
|
||||
console.error("no app with this name");
|
||||
return;
|
||||
}
|
||||
const app = appsPerInput.get(e.detail.name);
|
||||
if (e.detail.action === "add") {
|
||||
app.addNewEntity(e.detail.entity);
|
||||
} else if (e.detail.action === "remove") {
|
||||
app.removeEntity(e.detail.entity);
|
||||
} else {
|
||||
console.error("action not supported: " + e.detail.action);
|
||||
}
|
||||
});
|
||||
|
||||
document.addEventListener("DOMContentLoaded", function (e) {
|
||||
loadDynamicPicker(document);
|
||||
});
|
||||
|
||||
window.loadDynamicPicker = loadDynamicPicker;
|
||||
|
||||
|
@@ -1,60 +1,57 @@
|
||||
import { createApp } from 'vue';
|
||||
import PickPostalCode from 'ChillMainAssets/vuejs/PickPostalCode/PickPostalCode';
|
||||
import { _createI18n } from 'ChillMainAssets/vuejs/_js/i18n';
|
||||
import { appMessages } from 'ChillMainAssets/vuejs/PickEntity/i18n';
|
||||
import { makeFetch } from 'ChillMainAssets/lib/api/apiMethods';
|
||||
import { createApp } from "vue";
|
||||
import PickPostalCode from "ChillMainAssets/vuejs/PickPostalCode/PickPostalCode";
|
||||
import { _createI18n } from "ChillMainAssets/vuejs/_js/i18n";
|
||||
import { appMessages } from "ChillMainAssets/vuejs/PickEntity/i18n";
|
||||
import { makeFetch } from "ChillMainAssets/lib/api/apiMethods";
|
||||
|
||||
const i18n = _createI18n(appMessages);
|
||||
|
||||
|
||||
function loadOnePicker(el, input, uniqId, city) {
|
||||
const app = createApp({
|
||||
template: '<pick-postal-code @select-city="onCitySelected" @removeCity="onCityRemoved" :picked="city"></pick-postal-code>',
|
||||
components: {
|
||||
PickPostalCode,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
city: city,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onCitySelected(city) {
|
||||
this.city = city;
|
||||
input.value = city.id;
|
||||
},
|
||||
onCityRemoved(city) {
|
||||
this.city = null;
|
||||
input.value = '';
|
||||
}
|
||||
}
|
||||
})
|
||||
.use(i18n)
|
||||
.mount(el);
|
||||
const app = createApp({
|
||||
template:
|
||||
'<pick-postal-code @select-city="onCitySelected" @removeCity="onCityRemoved" :picked="city"></pick-postal-code>',
|
||||
components: {
|
||||
PickPostalCode,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
city: city,
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
onCitySelected(city) {
|
||||
this.city = city;
|
||||
input.value = city.id;
|
||||
},
|
||||
onCityRemoved(city) {
|
||||
this.city = null;
|
||||
input.value = "";
|
||||
},
|
||||
},
|
||||
})
|
||||
.use(i18n)
|
||||
.mount(el);
|
||||
}
|
||||
|
||||
function loadDynamicPickers(element) {
|
||||
let apps = element.querySelectorAll('[data-module="pick-postal-code"]');
|
||||
|
||||
let apps = element.querySelectorAll('[data-module="pick-postal-code"]');
|
||||
|
||||
apps.forEach(function(el) {
|
||||
|
||||
const
|
||||
uniqId = el.dataset.uniqid,
|
||||
input = document.querySelector(`input[data-input-uniqid="${uniqId}"]`),
|
||||
cityIdValue = input.value === '' ? null : input.value
|
||||
;
|
||||
|
||||
if (cityIdValue !== null) {
|
||||
makeFetch('GET', `/api/1.0/main/postal-code/${cityIdValue}.json`).then(city => {
|
||||
loadOnePicker(el, input, uniqId, city);
|
||||
})
|
||||
} else {
|
||||
loadOnePicker(el, input, uniqId, null);
|
||||
}
|
||||
});
|
||||
apps.forEach(function (el) {
|
||||
const uniqId = el.dataset.uniqid,
|
||||
input = document.querySelector(`input[data-input-uniqid="${uniqId}"]`),
|
||||
cityIdValue = input.value === "" ? null : input.value;
|
||||
if (cityIdValue !== null) {
|
||||
makeFetch("GET", `/api/1.0/main/postal-code/${cityIdValue}.json`).then(
|
||||
(city) => {
|
||||
loadOnePicker(el, input, uniqId, city);
|
||||
},
|
||||
);
|
||||
} else {
|
||||
loadOnePicker(el, input, uniqId, null);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function(e) {
|
||||
loadDynamicPickers(document)
|
||||
})
|
||||
document.addEventListener("DOMContentLoaded", function (e) {
|
||||
loadDynamicPickers(document);
|
||||
});
|
||||
|
@@ -1,23 +1,23 @@
|
||||
import {ShowHide} from 'ChillMainAssets/lib/show_hide/index';
|
||||
import { ShowHide } from "ChillMainAssets/lib/show_hide/index";
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function(_e) {
|
||||
document.querySelectorAll('div[data-rolling-date]').forEach( (picker) => {
|
||||
const
|
||||
roll_wrapper = picker.querySelector('div.roll-wrapper'),
|
||||
fixed_wrapper = picker.querySelector('div.fixed-wrapper');
|
||||
document.addEventListener("DOMContentLoaded", function (_e) {
|
||||
document.querySelectorAll("div[data-rolling-date]").forEach((picker) => {
|
||||
const roll_wrapper = picker.querySelector("div.roll-wrapper"),
|
||||
fixed_wrapper = picker.querySelector("div.fixed-wrapper");
|
||||
|
||||
new ShowHide({
|
||||
froms: [roll_wrapper],
|
||||
container: [fixed_wrapper],
|
||||
test: function (elems) {
|
||||
for (let el of elems) {
|
||||
for (let select_roll of el.querySelectorAll('select[data-roll-picker]')) {
|
||||
return select_roll.value === 'fixed_date';
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
})
|
||||
new ShowHide({
|
||||
froms: [roll_wrapper],
|
||||
container: [fixed_wrapper],
|
||||
test: function (elems) {
|
||||
for (let el of elems) {
|
||||
for (let select_roll of el.querySelectorAll(
|
||||
"select[data-roll-picker]",
|
||||
)) {
|
||||
return select_roll.value === "fixed_date";
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
@@ -1,10 +1,9 @@
|
||||
import { createApp } from 'vue';
|
||||
import OpenWopiLink from 'ChillMainAssets/vuejs/_components/OpenWopiLink';
|
||||
import {_createI18n} from "ChillMainAssets/vuejs/_js/i18n";
|
||||
import { createApp } from "vue";
|
||||
import OpenWopiLink from "ChillMainAssets/vuejs/_components/OpenWopiLink";
|
||||
import { _createI18n } from "ChillMainAssets/vuejs/_js/i18n";
|
||||
|
||||
const i18n = _createI18n({});
|
||||
|
||||
|
||||
//TODO move to chillDocStore or ChillWopi
|
||||
|
||||
/*
|
||||
@@ -19,25 +18,28 @@ tags to load module:
|
||||
|
||||
*/
|
||||
|
||||
window.addEventListener('DOMContentLoaded', function (e) {
|
||||
document.querySelectorAll('span[data-module="wopi-link"]')
|
||||
.forEach(function (el) {
|
||||
createApp({
|
||||
template: '<open-wopi-link :wopiUrl="wopiUrl" :type="type" :options="options"></open-wopi-link>',
|
||||
components: {
|
||||
OpenWopiLink
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
wopiUrl: el.dataset.wopiUrl,
|
||||
type: el.dataset.docType,
|
||||
options: el.dataset.options !== 'null' ? JSON.parse(el.dataset.options) : {}
|
||||
}
|
||||
}
|
||||
})
|
||||
.use(i18n)
|
||||
.mount(el)
|
||||
;
|
||||
})
|
||||
;
|
||||
window.addEventListener("DOMContentLoaded", function (e) {
|
||||
document
|
||||
.querySelectorAll('span[data-module="wopi-link"]')
|
||||
.forEach(function (el) {
|
||||
createApp({
|
||||
template:
|
||||
'<open-wopi-link :wopiUrl="wopiUrl" :type="type" :options="options"></open-wopi-link>',
|
||||
components: {
|
||||
OpenWopiLink,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
wopiUrl: el.dataset.wopiUrl,
|
||||
type: el.dataset.docType,
|
||||
options:
|
||||
el.dataset.options !== "null"
|
||||
? JSON.parse(el.dataset.options)
|
||||
: {},
|
||||
};
|
||||
},
|
||||
})
|
||||
.use(i18n)
|
||||
.mount(el);
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user