- this.element.modal({
- type: 'slide',
- //appendTo: this._gallery,
- modalClass: 'mage-new-video-dialog form-inline',
- title: $.mage.__('New Video'),
- buttons: [
- {
- text: $.mage.__('Save'),
- class: 'action-primary video-create-button',
- click: $.proxy(widget._onCreate, widget)
- },
- {
- text: $.mage.__('Cancel'),
- class: 'video-cancel-button',
- click: $.proxy(widget._onCancel, widget)
- },
- {
- text: $.mage.__('Delete'),
- class: 'video-delete-button',
- click: $.proxy(widget._onDelete, widget)
- },
- {
- text: $.mage.__('Save'),
- class: 'action-primary video-edit',
- click: $.proxy(widget._onUpdate, widget)
- }
- ],
-
- /**
- * @returns {null}
- */
- opened: function () {
- var roles,
- file,
- modalTitleElement,
- imageData,
- modal = widget.element.closest('.mage-new-video-dialog');
-
- widget.element.find('#video_url').focus();
- roles = widget.element.find('.video_image_role');
- roles.prop('disabled', false);
- file = widget.element.find('#file_name').val();
- widget._onGetVideoInformationEditClick();
- modalTitleElement = modal.find('.modal-title');
-
- if (!file) {
- widget._blockActionButtons(true);
-
- modal.find('.video-delete-button').hide();
- modal.find('.video-edit').hide();
- modal.find('.video-create-button').show();
- roles.prop('checked', widget._gallery.find('.image.item:not(.removed)').length < 1);
- modalTitleElement.text($.mage.__('New Video'));
- widget._isEditPage = false;
-
- return null;
- }
- widget._blockActionButtons(false);
- modalTitleElement.text($.mage.__('Edit Video'));
- widget._isEditPage = true;
- imageData = widget._getImage(file);
-
- if (!imageData) {
- imageData = {
- url: _.find(widget._gallery.find('.product-image'), function (image) {
- return image.src.indexOf(file) > -1;
- }).src
- };
- }
-
- widget._onPreview(null, imageData.url, false);
- },
-
- /**
- * Closed
- */
- closed: function () {
- widget._onClose();
- widget.createVideoItemIcons();
- }
- });