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
|
||||
|
||||
|
||||
//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
|
||||
- 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
|
||||
|
||||
@@ -1,15 +1,12 @@
|
||||
/* ZZeslint-disable */
|
||||
import store from "../store";
|
||||
import gzapi from "./gzapi";
|
||||
import _ from "../libs/lodash.min.js";
|
||||
|
||||
export default {
|
||||
get(key) {
|
||||
// debugger;
|
||||
if (!_.has(store.state.localeText, key)) {
|
||||
if (!window.$gz._.has(window.$gz.store.state.localeText, key)) {
|
||||
return "??" + key;
|
||||
}
|
||||
return store.state.localeText[key];
|
||||
return window.$gz.store.state.localeText[key];
|
||||
},
|
||||
fetch(keys) {
|
||||
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
|
||||
var needIt = [];
|
||||
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]);
|
||||
}
|
||||
}
|
||||
@@ -29,13 +26,19 @@ export default {
|
||||
}
|
||||
|
||||
//step 2: get it
|
||||
fetch(gzapi.APIUrl("locale/subset"), gzapi.fetchPostOptions(needIt))
|
||||
.then(gzapi.status)
|
||||
.then(gzapi.json)
|
||||
fetch(
|
||||
window.$gz.api.APIUrl("locale/subset"),
|
||||
window.$gz.api.fetchPostOptions(needIt)
|
||||
)
|
||||
.then(window.$gz.api.status)
|
||||
.then(window.$gz.api.json)
|
||||
.then(response => {
|
||||
_.forEach(response.data, function commitFetchedLTItemToStore(item) {
|
||||
store.commit("addLocaleText", item);
|
||||
});
|
||||
window.$gz._.forEach(
|
||||
response.data,
|
||||
function commitFetchedLTItemToStore(item) {
|
||||
window.$gz.store.commit("addLocaleText", item);
|
||||
}
|
||||
);
|
||||
|
||||
resolve();
|
||||
});
|
||||
@@ -118,7 +121,7 @@ export default {
|
||||
return v;
|
||||
},
|
||||
format() {
|
||||
return store.state.locale;
|
||||
return window.$gz.store.state.locale;
|
||||
},
|
||||
////////////////////////////////////////////////////////
|
||||
// Take in a string that contains one or more
|
||||
|
||||
@@ -38,11 +38,13 @@ import errorhandler from "./api/errorhandler";
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
// 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 = {
|
||||
locale: locale,
|
||||
formCustomTemplate: gzformcustomtemplate,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import Vue from "vue";
|
||||
import Vuex from "vuex";
|
||||
import createPersistedState from "vuex-persistedstate";
|
||||
import _ from "./libs/lodash.min.js";
|
||||
|
||||
/* Xeslint-disable */
|
||||
const MaxLogLength = 100;
|
||||
|
||||
@@ -86,7 +86,7 @@ export default new Vuex.Store({
|
||||
msg = Date.now() + "|" + msg;
|
||||
state.logArray.push(msg);
|
||||
if (state.logArray.length > MaxLogLength) {
|
||||
state.logArray = _.drop(
|
||||
state.logArray = window.$gz._.drop(
|
||||
state.logArray,
|
||||
state.logArray.length - MaxLogLength
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user