forked from verdnatura/hedera-web
refs #3971 fixes
This commit is contained in:
parent
ebb6055be5
commit
9309bd156c
|
@ -1,4 +1,4 @@
|
|||
hedera-web (22.48.1) stable; urgency=low
|
||||
hedera-web (22.48.2) stable; urgency=low
|
||||
|
||||
* Initial Release.
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ export default new Class({
|
|||
this.locations = resultSet.fetchData();
|
||||
|
||||
if (!gmapsIsLoaded) {
|
||||
gmapsLoadedCallback = this.gmapsLoaded.bind(this);
|
||||
window.gmapsLoadedCallback = () => this.gmapsLoaded();
|
||||
Vn.includeJs('https://maps.google.com/maps/api/js'
|
||||
+'?sensor=false&callback=gmapsLoadedCallback'
|
||||
+'&key=AIzaSyBbunFsAFEkjtw-c7BUHNgkThSlKEKFxiE',
|
||||
|
@ -29,7 +29,6 @@ export default new Class({
|
|||
,gmapsLoaded() {
|
||||
this.gui.loaderPop();
|
||||
gmapsIsLoaded = true;
|
||||
this.allLoaded();
|
||||
|
||||
if (!this.locations || !gmapsIsLoaded)
|
||||
return;
|
||||
|
|
|
@ -176,38 +176,37 @@ export default new Class({
|
|||
},
|
||||
|
||||
onAgenciesReady(model) {
|
||||
if (!model.ready) return;
|
||||
|
||||
if (model.numRows > 0) {
|
||||
let agency;
|
||||
const agencies = [];
|
||||
|
||||
if (this.$.orderForm.$)
|
||||
agencies.push(this.$.orderForm.$);
|
||||
|
||||
const defaults = this.$.defaults.$;
|
||||
if (defaults)
|
||||
agencies.push(
|
||||
defaults.agencyModeFk,
|
||||
defaults.defaultAgencyFk
|
||||
);
|
||||
|
||||
for (let i = 0; i < agencies.length; i++) {
|
||||
agency = agencies[i];
|
||||
if (model.search('id', agency) !== -1)
|
||||
break;
|
||||
}
|
||||
|
||||
this.autoStepLocked = true;
|
||||
this.$.lot.assign({agency});
|
||||
this.autoStepLocked = false;
|
||||
} else
|
||||
Htk.Toast.showError(_('NoAgeciesAvailableForDate'));
|
||||
this.selectAgency(model, 'NoAgeciesAvailableForDate');
|
||||
},
|
||||
|
||||
onWarehousesReady(model) {
|
||||
if (model.ready && model.numRows == 0)
|
||||
Htk.Toast.showError(_('NoWarehousesAvailableForDate'));
|
||||
this.selectAgency(model, 'NoWarehousesAvailableForDate');
|
||||
},
|
||||
|
||||
selectAgency(model, emptyMessage) {
|
||||
if (!model.ready) return;
|
||||
let agencyId = null;
|
||||
|
||||
if (model.numRows > 0) {
|
||||
const agencies = [this.$.lot.$.agency];
|
||||
|
||||
const defaults = this.$.defaults.$ || {};
|
||||
if (defaults.agencyModeFk)
|
||||
defaults.push(defaults.agencyModeFk);
|
||||
if (defaults.defaultAgencyFk)
|
||||
defaults.push(defaults.defaultAgencyFk);
|
||||
|
||||
for (const agency of agencies)
|
||||
if (model.search('id', agency) !== -1) {
|
||||
agencyId = agency;
|
||||
break;
|
||||
}
|
||||
} else
|
||||
Htk.Toast.showError(_(emptyMessage));
|
||||
|
||||
this.autoStepLocked = true;
|
||||
this.$.lot.assign({agency: agencyId});
|
||||
this.autoStepLocked = false;
|
||||
},
|
||||
|
||||
calendarRestrict(date) {
|
||||
|
|
|
@ -38,11 +38,11 @@ const contentCss = require('tinymce/skins/content/default/content.css');
|
|||
|
||||
export default new Class({
|
||||
Extends: Hedera.Form,
|
||||
Template: require('./ui.xml')
|
||||
Template: require('./ui.xml'),
|
||||
|
||||
,editor: null
|
||||
editor: null,
|
||||
|
||||
,activate() {
|
||||
activate() {
|
||||
this.$.model.mode = Db.Model.Mode.ON_DEMAND;
|
||||
this.$.model.setDefault('userFk', 'news',
|
||||
new Sql.Function({schema: 'account', name: 'myUser_getId'}));
|
||||
|
@ -65,7 +65,7 @@ export default new Class({
|
|||
+'|fontselect fontsizeselect'
|
||||
+'|forecolor backcolor '
|
||||
,image_advtab: true
|
||||
,init_instance_callback: this._onEditorInit.bind(this)
|
||||
,init_instance_callback: editor => this._onEditorInit(editor)
|
||||
,skin: false
|
||||
,content_css: false
|
||||
,content_style: contentUiCss.toString() + '\n' + contentCss.toString()
|
||||
|
@ -83,32 +83,25 @@ export default new Class({
|
|||
},
|
||||
|
||||
setEditorText() {
|
||||
if (!this.editor)
|
||||
return;
|
||||
|
||||
if (!this.editor) return;
|
||||
const row = this.$.iter.$;
|
||||
this.editor.setContent(row ? row.text : '');
|
||||
},
|
||||
|
||||
onStatusChange() {
|
||||
if (!this.hash.$.new)
|
||||
onReady() {
|
||||
if (this.hash.$.new)
|
||||
this.setEditorText();
|
||||
else
|
||||
this.$.iter.insertRow();
|
||||
},
|
||||
|
||||
onOperationsDone() {
|
||||
|
||||
async onAcceptClick() {
|
||||
this.$.iter.set('text', this.editor.getContent());
|
||||
await this.$.iter.performOperations();
|
||||
Htk.Toast.showMessage(_('NewChangedSuccessfully'));
|
||||
this.onReturnClick();
|
||||
},
|
||||
|
||||
onReady() {
|
||||
this.setEditorText();
|
||||
},
|
||||
|
||||
onAcceptClick() {
|
||||
this.$.iter.set('text', this.editor.getContent());
|
||||
this.$.iter.performOperations();
|
||||
},
|
||||
|
||||
onReturnClick() {
|
||||
this.hash.setAll({form: 'news/news'});
|
||||
}
|
||||
|
|
|
@ -1,14 +1,12 @@
|
|||
<vn>
|
||||
<vn-group>
|
||||
<db-form id="iter"
|
||||
on-status-changed="this.onStatusChange()"
|
||||
on-ready="this.onReady()">
|
||||
<db-model
|
||||
id="model"
|
||||
property="model"
|
||||
updatable="true"
|
||||
lot="hash"
|
||||
on-operations-done="this.onOperationsDone()">
|
||||
lot="hash">
|
||||
SELECT id, title, text, tag, priority, image
|
||||
FROM news WHERE id = #new
|
||||
</db-model>
|
||||
|
|
|
@ -2,30 +2,29 @@ import './style.scss';
|
|||
|
||||
export default new Class({
|
||||
Extends: Hedera.Form,
|
||||
Template: require('./ui.xml')
|
||||
Template: require('./ui.xml'),
|
||||
|
||||
,activate() {
|
||||
activate() {
|
||||
this.$.newsModel.setInfo('n', 'news', 'hedera', ['id'], 'id');
|
||||
}
|
||||
},
|
||||
|
||||
onAddClick() {
|
||||
this.hash.setAll({
|
||||
form: 'news/new',
|
||||
new: null
|
||||
});
|
||||
},
|
||||
|
||||
,editNew(newId) {
|
||||
onEditClick(newId) {
|
||||
this.hash.setAll({
|
||||
form: 'news/new',
|
||||
new: newId
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
,onEditClick(newId) {
|
||||
this.editNew(newId);
|
||||
}
|
||||
|
||||
,onDeleteClick(form) {
|
||||
async onDeleteClick(form) {
|
||||
if (confirm(_('ReallyDelete')))
|
||||
form.deleteRow();
|
||||
}
|
||||
|
||||
,onAddClick() {
|
||||
this.editNew(0);
|
||||
await form.deleteRow();
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -65,20 +65,12 @@ module.exports = new Class({
|
|||
|
||||
// Retrieving configuration parameters
|
||||
|
||||
var res = resultSet.fetchResult();
|
||||
var columns = res.columns;
|
||||
|
||||
if (res.next())
|
||||
for (var i = 0; i < res.columns.length; i++)
|
||||
Vn.Config[columns[i].name] = res.get(columns[i].name);
|
||||
|
||||
// Retrieving configuration parameters
|
||||
|
||||
Vn.Config.defaultForm = resultSet.fetchValue();
|
||||
Vn.Config.imageUrl = resultSet.fetchValue();
|
||||
|
||||
// Retrieving configuration parameters
|
||||
|
||||
var isTesting = !resultSet.fetchValue();
|
||||
const isTesting = !resultSet.fetchValue();
|
||||
|
||||
if (isTesting) {
|
||||
this.$.devInfo.style.display = 'block';
|
||||
|
@ -87,15 +79,17 @@ module.exports = new Class({
|
|||
|
||||
// Retrieving configuration parameters
|
||||
|
||||
var res = resultSet.fetchObject();
|
||||
const res = resultSet.fetchObject();
|
||||
|
||||
if (res && res.testDomain) {
|
||||
let linkText, linkField;
|
||||
|
||||
if (location.host != res.productionDomain) {
|
||||
var linkText = 'Old website';
|
||||
var linkField = 'productionDomain';
|
||||
linkText = 'Old website';
|
||||
linkField = 'productionDomain';
|
||||
} else {
|
||||
var linkText = 'Test the new website';
|
||||
var linkField = 'testDomain';
|
||||
linkText = 'Test the new website';
|
||||
linkField = 'testDomain';
|
||||
}
|
||||
|
||||
Vn.Node.setText(this.$.testLink, _(linkText));
|
||||
|
@ -354,11 +348,12 @@ module.exports = new Class({
|
|||
formPath = Vn.Config.defaultForm;
|
||||
|
||||
this.hideMenu();
|
||||
this.loaderPush();
|
||||
await this.closeForm();
|
||||
this.requestedForm = formPath;
|
||||
|
||||
var newChoosedOption = this.menuOptions[formPath];
|
||||
if (!formPath) return;
|
||||
this.loaderPush();
|
||||
const newChoosedOption = this.menuOptions[formPath];
|
||||
|
||||
if (newChoosedOption) {
|
||||
Vn.Node.addClass(newChoosedOption, 'selected');
|
||||
|
|
|
@ -61,7 +61,7 @@ $login-margin-between: 55px;
|
|||
|
||||
.vn-login > .column {
|
||||
max-width: 250px;
|
||||
overflow: visible;
|
||||
overflow: hidden;
|
||||
|
||||
& > .header {
|
||||
margin-top: $login-margin-top;
|
||||
|
|
|
@ -37,7 +37,7 @@ module.exports =
|
|||
/**
|
||||
* @returns {Promise}
|
||||
*/
|
||||
loadLang(path, lang) {
|
||||
async loadLang(path, lang) {
|
||||
let langLoad = this.loads[lang];
|
||||
if (!langLoad)
|
||||
langLoad = this.loads[lang] = {};
|
||||
|
@ -50,19 +50,20 @@ module.exports =
|
|||
const request = new XMLHttpRequest();
|
||||
request.open('get', langFile, true);
|
||||
|
||||
return new Promise(
|
||||
(resolve, reject) => {
|
||||
request.onreadystatechange =
|
||||
() => this.onRequestReady(request, resolve, reject);
|
||||
request.send();
|
||||
})
|
||||
.then(translations => {
|
||||
this.add(translations, lang);
|
||||
})
|
||||
.catch(err => {
|
||||
langLoad[path] = false;
|
||||
console.warn(err);
|
||||
});
|
||||
const promise = new Promise((resolve, reject) => {
|
||||
request.onreadystatechange =
|
||||
() => this.onRequestReady(request, resolve, reject);
|
||||
});
|
||||
|
||||
request.send();
|
||||
|
||||
try {
|
||||
const translations = await promise;
|
||||
this.add(translations, lang);
|
||||
} catch(err) {
|
||||
langLoad[path] = false;
|
||||
//console.warn(err);
|
||||
}
|
||||
},
|
||||
|
||||
onRequestReady(request, resolve, reject) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "hedera-web",
|
||||
"version": "22.48.1",
|
||||
"version": "22.48.2",
|
||||
"description": "Verdnatura web page",
|
||||
"license": "GPL-3.0",
|
||||
"repository": {
|
||||
|
@ -41,7 +41,8 @@
|
|||
},
|
||||
"scripts": {
|
||||
"front": "webpack serve --open",
|
||||
"back": "cd ../salix && NODE_ENV=test gulp backOnly",
|
||||
"back": "cd ../salix && gulp backOnly",
|
||||
"db": "cd ../vn-database && myvc run",
|
||||
"build": "rm -rf build/ ; webpack",
|
||||
"clean": "rm -rf build/"
|
||||
}
|
||||
|
|
|
@ -43,16 +43,16 @@ function getWebpackAssets() {
|
|||
&& property_exists($asset, 'js'))
|
||||
$jsFiles[] = $serverPath . $asset->js;
|
||||
|
||||
function addAssets(&$jsFiles, $assets) {
|
||||
function addAssets($serverPath, &$jsFiles, $assets) {
|
||||
foreach ($assets->js as $asset)
|
||||
if (preg_match('/^chunk\./', basename($asset)) === 0)
|
||||
$jsFiles[] = $serverPath.$asset;
|
||||
}
|
||||
|
||||
if (isset($wpAssets->_empty_))
|
||||
addAssets($jsFiles, $wpAssets->_empty_);
|
||||
addAssets($serverPath, $jsFiles, $wpAssets->_empty_);
|
||||
if (isset($wpAssets->{''}))
|
||||
addAssets($jsFiles, $wpAssets->{''});
|
||||
addAssets($serverPath, $jsFiles, $wpAssets->{''});
|
||||
|
||||
$jsFiles[] = $serverPath . $wpAssets->main->js;
|
||||
|
||||
|
|
Loading…
Reference in New Issue