[SSE] Formula wizard: show help

This commit is contained in:
Julia Radzhabova 2020-04-21 22:48:51 +03:00
parent 875ea063fb
commit c7b79585c9
2 changed files with 36 additions and 2 deletions

View file

@ -240,6 +240,7 @@ define([
(new SSE.Views.FormulaWizard({
api : this.api,
lang : this.appOptions.lang,
funcprops: funcprops,
props : props,
handler : function(dlg, result, settings) {

View file

@ -82,9 +82,12 @@ define([
this.props = this.options.props;
this.funcprops = this.options.funcprops;
this.api = this.options.api;
this.lang = this.options.lang;
this._noApply = false;
this.args = [];
this.repeatedArg = undefined;
this.helpUrl = undefined;
this.minArgCount = 1;
this.maxArgCount = 1;
@ -138,8 +141,7 @@ define([
props.name ? $('#formula-wizard-name').html('<b>' + this.textFunction + ': </b>' + props.name) : $('#formula-wizard-name').addClass('hidden');
this.$window.find('#formula-wizard-help').on('click', function (e) {
// me.close();
SSE.getController('LeftMenu').getView('LeftMenu').showMenu('file:help', 'Functions\/' + me.funcprops.origin.toLocaleLowerCase() + '.htm');
me.showHelp();
})
}
var height = this.panelDesc.outerHeight();
@ -313,6 +315,37 @@ define([
}
},
showHelp: function() {
if (this.helpUrl==undefined) {
if (!this.funcprops || !this.funcprops.origin) {
this.helpUrl = null;
return;
}
var me = this,
lang = (this.lang) ? this.lang.split(/[\-\_]/)[0] : 'en',
url = 'resources/help/' + lang + '/Functions/' + (this.funcprops.origin.toLocaleLowerCase()) + '.htm';
fetch(url).then(function(response){
if ( response.ok ) {
me.helpUrl = url;
me.showHelp();
} else {
url = 'resources/help/en/Functions/' + (me.funcprops.origin.toLocaleLowerCase()) + '.htm';
fetch(url).then(function(response){
if ( response.ok ) {
me.helpUrl = url;
me.showHelp();
} else {
me.helpUrl = null;
}
});
}
});
} else if (this.helpUrl) {
window.open(this.helpUrl);
}
},
getSettings: function() {
return {};
},