web-apps/apps/documenteditor/forms/app/view/ApplicationView.js

154 lines
7.1 KiB
JavaScript
Raw Normal View History

2021-08-06 10:55:26 +00:00
define([
'jquery',
'underscore',
'backbone',
'common/main/lib/util/utils',
2021-08-18 21:52:04 +00:00
'common/main/lib/component/InputField',
2021-08-06 10:55:26 +00:00
'common/main/lib/component/Button',
2021-08-20 08:22:17 +00:00
'common/main/lib/component/Menu'
2021-08-06 10:55:26 +00:00
], function ($, _, Backbone) {
'use strict';
2021-10-29 19:29:47 +00:00
DE.Views.ApplicationView = Backbone.View.extend(_.extend({
2021-08-06 10:55:26 +00:00
// Render layout
render: function() {
2021-08-07 08:44:58 +00:00
this.btnOptions = new Common.UI.Button({
cls: 'btn-toolbar no-caret',
iconCls: 'svg-icon more-vertical',
menu: new Common.UI.Menu({
2021-11-24 10:08:13 +00:00
cls: 'shifted-right',
2021-08-07 08:44:58 +00:00
items: [
{caption: this.txtPrint, value: 'print', iconCls: 'mi-icon svg-icon print'},
{caption: '--'},
{caption: this.txtDownload, value: 'download', iconCls: 'mi-icon svg-icon download'},
{caption: this.txtDownloadDocx, value: 'download-docx', iconCls: 'mi-icon svg-icon download'},
{caption: this.txtDownloadPdf, value: 'download-pdf', iconCls: 'mi-icon'},
{caption: '--'},
{caption: this.txtTheme, value: 'theme', iconCls: 'mi-icon',
menu : this.mnuThemes = new Common.UI.Menu({
cls: 'shifted-right',
menuAlign: 'tl-tr',
items: []
})
},
2021-12-15 13:43:21 +00:00
{caption: this.textZoom, value: 'zoomn', conCls: 'mi-icon' ,
menu : this.mnuZoom = new Common.UI.Menu({
cls: 'shifted-right',
menuAlign: 'tl-tr',
items: [
{caption: this.textFitToPage, value: 'zoom:page', toggleGroup: 'view-zoom', checkable: true},
{caption: this.textFitToWidth, value: 'zoom:width', toggleGroup: 'view-zoom', checkable: true},
(new Common.UI.MenuItem({
template: _.template([
'<div id="id-menu-zoom" class="menu-zoom" style="height: 26px;" ',
'<% if(!_.isUndefined(options.stopPropagation)) { %>',
'data-stopPropagation="true"',
'<% } %>', '>',
'<label class="title">' + this.textZoom + '</label>',
'<button id="id-menu-zoom-in" type="button" style="float:right; margin: 2px 5px 0 0;" class="btn btn-toolbar"><i class="mi-icon svg-icon zoom-in">&nbsp;</i></button>',
'<label class="zoom"><%= options.value %>%</label>',
'<button id="id-menu-zoom-out" type="button" style="float:right; margin-top: 2px;" class="btn btn-toolbar"><i class="mi-icon svg-icon zoom-out">&nbsp;</i></button>',
'</div>'
].join('')),
stopPropagation: true,
value: 30
}))
]
})
},
{caption: '--'},
2021-08-07 08:44:58 +00:00
{caption: this.txtShare, value: 'share', iconCls: 'mi-icon svg-icon share'},
{caption: this.txtFileLocation, value: 'close', iconCls: 'mi-icon svg-icon go-to-location'},
{caption: '--'},
{caption: this.txtEmbed, value: 'embed', iconCls: 'mi-icon svg-icon embed'},
{caption: this.txtFullScreen, value: 'fullscr', iconCls: 'mi-icon svg-icon fullscr'}
]
})
});
this.btnOptions.render($('#box-tools'));
2021-08-06 10:55:26 +00:00
2021-12-15 13:43:21 +00:00
2021-08-18 18:29:47 +00:00
this.btnClear = new Common.UI.Button({
cls: 'btn-toolbar',
iconCls: 'svg-icon clear-style',
caption: this.textClear
});
this.btnClear.render($('#id-btn-clear-fields'));
this.btnNext = new Common.UI.Button({
cls: 'btn-toolbar',
iconCls: 'svg-icon arrow-down',
caption: this.textNext
});
this.btnNext.render($('#id-btn-next-field'));
this.btnPrev = new Common.UI.Button({
cls: 'btn-toolbar',
iconCls: 'svg-icon arrow-up'
});
this.btnPrev.render($('#id-btn-prev-field'));
2021-08-06 10:55:26 +00:00
2021-08-19 20:09:18 +00:00
this.btnSubmit = new Common.UI.Button({
cls: 'btn-text-default colored margin-left-small margin-right-small',
caption: this.textSubmit
});
this.btnSubmit.render($('#id-submit-group'));
2021-10-29 17:15:38 +00:00
this.btnDownload = new Common.UI.Button({
cls: 'btn-text-default colored margin-left-small margin-right-small',
caption: this.txtDownload,
hint: this.txtDownloadPdf
});
this.btnDownload.render($('#id-download-group'));
2021-08-18 21:52:04 +00:00
this.txtGoToPage = new Common.UI.InputField({
el: $('#page-number'),
cls: 'masked',
allowBlank : true,
style : 'width: 35px;',
value: '1',
maskExp: /[0-9]/
});
2021-08-18 20:15:52 +00:00
return this;
2021-08-06 17:07:03 +00:00
},
2021-11-10 14:41:01 +00:00
getContextMenu: function() {
return new Common.UI.Menu({
2021-11-11 08:38:34 +00:00
cls: 'shifted-right',
2021-11-10 14:41:01 +00:00
items: [
2021-11-29 16:22:34 +00:00
{ caption: this.textUndo, value: 'undo', iconCls: 'mi-icon svg-icon undo' },
{ caption: this.textRedo, value: 'redo', iconCls: 'mi-icon svg-icon redo' },
{ caption: '--' },
2021-11-11 08:38:34 +00:00
{ caption: this.textCut, value: 'cut', iconCls: 'mi-icon svg-icon cut' },
{ caption: this.textCopy, value: 'copy', iconCls: 'mi-icon svg-icon copy' },
2021-11-22 11:42:28 +00:00
{ caption: this.textPaste, value: 'paste', iconCls: 'mi-icon svg-icon paste' }
2021-11-10 14:41:01 +00:00
]
});
},
2021-08-06 10:55:26 +00:00
txtDownload: 'Download',
txtPrint: 'Print',
txtShare: 'Share',
txtEmbed: 'Embed',
txtFullScreen: 'Full Screen',
txtFileLocation: 'Open file location',
txtDownloadDocx: 'Download as docx',
2021-08-18 18:29:47 +00:00
txtDownloadPdf: 'Download as pdf',
textNext: 'Next Field',
2021-08-19 20:09:18 +00:00
textClear: 'Clear All Fields',
textSubmit: 'Submit',
2021-11-10 14:41:01 +00:00
txtTheme: 'Interface theme',
textCut: 'Cut',
textCopy: 'Copy',
textPaste: 'Paste',
2021-11-19 14:36:02 +00:00
textPrintSel: 'Print Selection',
2021-11-29 16:22:34 +00:00
txtDarkMode: 'Dark mode',
textUndo: 'Undo',
2021-12-15 13:43:21 +00:00
textRedo: 'Redo',
textZoom: 'Zoom',
textFitToPage: 'Fit to Page',
textFitToWidth: 'Fit to Width'
2021-11-10 14:41:01 +00:00
2021-10-29 19:29:47 +00:00
}, DE.Views.ApplicationView || {}));
2021-08-06 10:55:26 +00:00
});