This commit is contained in:
@@ -87,6 +87,12 @@ DONE: WIDGET Customize menu item
|
|||||||
- this is to customize the form but it should contain a link to the locale text editor in case that's what they actually intend to customize
|
- this is to customize the form but it should contain a link to the locale text editor in case that's what they actually intend to customize
|
||||||
|
|
||||||
|
|
||||||
|
//DONE: Move all of my libs and code into the Window object under window.$gz(.local, .api etc)
|
||||||
|
|
||||||
|
TODO: (may be done already) modify the inventory-widget-edit form initialization shit so that the stuff needed after form loads still happens but the before is moved to route before enter and that it's all called
|
||||||
|
with two separate methods: One standard one for init form before it is loaded and one for init form stuff for after it's loaded. BeforeLoadInit, AfterLoadInit or something
|
||||||
|
|
||||||
|
|
||||||
TODO: Custom fields
|
TODO: Custom fields
|
||||||
- Needs to cache the customization data of the form and concurrency token used to fetch it and then it checks the concurrency token periodically
|
- Needs to cache the customization data of the form and concurrency token used to fetch it and then it checks the concurrency token periodically
|
||||||
- Needs to be aware of and handle the fact that the end user may change the data type
|
- Needs to be aware of and handle the fact that the end user may change the data type
|
||||||
|
|||||||
@@ -1,15 +1,12 @@
|
|||||||
/* ZZeslint-disable */
|
/* ZZeslint-disable */
|
||||||
import store from "../store";
|
|
||||||
import gzapi from "./gzapi";
|
|
||||||
import _ from "../libs/lodash.min.js";
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
get(key) {
|
get(key) {
|
||||||
// debugger;
|
// debugger;
|
||||||
if (!_.has(store.state.localeText, key)) {
|
if (!window.$gz._.has(window.$gz.store.state.localeText, key)) {
|
||||||
return "??" + key;
|
return "??" + key;
|
||||||
}
|
}
|
||||||
return store.state.localeText[key];
|
return window.$gz.store.state.localeText[key];
|
||||||
},
|
},
|
||||||
fetch(keys) {
|
fetch(keys) {
|
||||||
return new Promise(function fetchLocaleKeysFromServer(resolve) {
|
return new Promise(function fetchLocaleKeysFromServer(resolve) {
|
||||||
@@ -18,7 +15,7 @@ export default {
|
|||||||
//Note: this will ensure only unique keys go into the store so it's safe to call this with dupes as can happen
|
//Note: this will ensure only unique keys go into the store so it's safe to call this with dupes as can happen
|
||||||
var needIt = [];
|
var needIt = [];
|
||||||
for (var i = 0; i < keys.length; i++) {
|
for (var i = 0; i < keys.length; i++) {
|
||||||
if (!_.has(store.state.localeText, keys[i])) {
|
if (!window.$gz._.has(window.$gz.store.state.localeText, keys[i])) {
|
||||||
needIt.push(keys[i]);
|
needIt.push(keys[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -29,13 +26,19 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//step 2: get it
|
//step 2: get it
|
||||||
fetch(gzapi.APIUrl("locale/subset"), gzapi.fetchPostOptions(needIt))
|
fetch(
|
||||||
.then(gzapi.status)
|
window.$gz.api.APIUrl("locale/subset"),
|
||||||
.then(gzapi.json)
|
window.$gz.api.fetchPostOptions(needIt)
|
||||||
|
)
|
||||||
|
.then(window.$gz.api.status)
|
||||||
|
.then(window.$gz.api.json)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
_.forEach(response.data, function commitFetchedLTItemToStore(item) {
|
window.$gz._.forEach(
|
||||||
store.commit("addLocaleText", item);
|
response.data,
|
||||||
});
|
function commitFetchedLTItemToStore(item) {
|
||||||
|
window.$gz.store.commit("addLocaleText", item);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
resolve();
|
resolve();
|
||||||
});
|
});
|
||||||
@@ -118,7 +121,7 @@ export default {
|
|||||||
return v;
|
return v;
|
||||||
},
|
},
|
||||||
format() {
|
format() {
|
||||||
return store.state.locale;
|
return window.$gz.store.state.locale;
|
||||||
},
|
},
|
||||||
////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////
|
||||||
// Take in a string that contains one or more
|
// Take in a string that contains one or more
|
||||||
|
|||||||
@@ -38,11 +38,13 @@ import errorhandler from "./api/errorhandler";
|
|||||||
|
|
||||||
/////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////
|
||||||
// LIBS AND GLOBAL ITEMS
|
// LIBS AND GLOBAL ITEMS
|
||||||
// (https://medium.com/js-dojo/use-any-javascript-library-with-vue-js-3f7e2a4974a8)
|
// NOTE: I'm putting them on Window deliberately to be globally available
|
||||||
|
// some say this is bad only due to if you want to server render the page
|
||||||
|
// however when I researched that I found it's easily worked around
|
||||||
|
// as all you need is a "window" global var defined and then it's all good in the hood
|
||||||
|
// so for convenience and far less fuckery this is the way
|
||||||
//
|
//
|
||||||
//todo: Now that all is in Window.$gz Look for unnecessary local imports of global libs (search for import and see what comes up)
|
|
||||||
//then modify the inventory-widget-edit form initialization shit so that the stuff needed after form loads still happens but the before is moved to route before enter and that it's all called
|
|
||||||
//with two separate methods: One standard one for init form before it is loaded and one for init form stuff for after it's loaded. BeforeLoadInit, AfterLoadInit or something
|
|
||||||
window.$gz = {
|
window.$gz = {
|
||||||
locale: locale,
|
locale: locale,
|
||||||
formCustomTemplate: gzformcustomtemplate,
|
formCustomTemplate: gzformcustomtemplate,
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import Vue from "vue";
|
import Vue from "vue";
|
||||||
import Vuex from "vuex";
|
import Vuex from "vuex";
|
||||||
import createPersistedState from "vuex-persistedstate";
|
import createPersistedState from "vuex-persistedstate";
|
||||||
import _ from "./libs/lodash.min.js";
|
|
||||||
/* Xeslint-disable */
|
/* Xeslint-disable */
|
||||||
const MaxLogLength = 100;
|
const MaxLogLength = 100;
|
||||||
|
|
||||||
@@ -86,7 +86,7 @@ export default new Vuex.Store({
|
|||||||
msg = Date.now() + "|" + msg;
|
msg = Date.now() + "|" + msg;
|
||||||
state.logArray.push(msg);
|
state.logArray.push(msg);
|
||||||
if (state.logArray.length > MaxLogLength) {
|
if (state.logArray.length > MaxLogLength) {
|
||||||
state.logArray = _.drop(
|
state.logArray = window.$gz._.drop(
|
||||||
state.logArray,
|
state.logArray,
|
||||||
state.logArray.length - MaxLogLength
|
state.logArray.length - MaxLogLength
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user