| Server IP : 85.158.181.41 / Your IP : 216.73.217.12 Web Server : Apache System : Linux cloud9-vm129 6.1.178+1-ph #ph SMP PREEMPT_DYNAMIC Wed Jul 29 09:00:54 UTC 2026 x86_64 User : moncbefd ( 1024) PHP Version : 7.3.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/moncbefd/www.moneta.at/StyleEdit3/javascript/controllers/ |
Upload File : |
/* --------------------------------------------------------------
PreviewImageModal.js 2019-06-07
Gambio GmbH
http://www.gambio.de
Copyright (c) 2019 Gambio GmbH
Released under the GNU General Public License (Version 2)
[http://www.gnu.org/licenses/gpl-2.0.html]
--------------------------------------------------------------*/
'use strict';
import Modal from '../libs/Modal';
import EventsEmitter from '../libs/EventsEmitter';
/**
* Upload Image Modal Controller
*
* This controller will handle the image upload. After a successful upload it will set the newest
* image to the setting that triggered the upload and then it will also update the select boxes of
* all the other image widgets, so that the option is also available there.
*/
export default class PreviewImageModal {
/**
* Class Constructor
*
* @param {jQuery} $target Select box selector of the setting that triggered the modal.
*/
constructor($target) {
StyleEdit.Validator.isObject($target);
/**
* Select Box
*
* @type {jQuery}
*/
this.$target = $target;
/**
* The modal selector.
*
* @type {jQuery}
*/
this.$modal = null;
}
/**
* Initialize Controller
*/
initialize() {
const data = {
title_preview_image_modal: StyleEdit.Language.translate('title_preview_image_modal', 'style_edit'),
image_url: StyleEdit.Config.get('previewUrl') + '/' + StyleEdit.Config.get('imagesDir')
+ this.$target.find('option:selected').text()
};
this.$modal = Modal.show($('#preview-image-modal-template'), data);
this.$modal.on('click', '.btn.ok', () => this.destroy());
EventsEmitter.triggerControllerInitialized(this.$modal, ['PreviewImageModal']);
$.material.init();
}
/**
* Destroy Controller
*/
destroy() {
Modal.hide(this.$modal);
EventsEmitter.triggerControllerDestroyed(this.$modal, ['PreviewImageModal']);
}
}