#5099: Improved image element dialog by hiding Save/Cancel buttons.

This commit is contained in:
Sipke Schoorstra
2015-07-04 11:45:43 +02:00
parent c2b0041e1c
commit bbf6700e1a
5 changed files with 31 additions and 3 deletions

View File

@@ -90,6 +90,7 @@
<Content Include="Scripts\DemoData.js" /> <Content Include="Scripts\DemoData.js" />
<Content Include="Scripts\element-browser.js" /> <Content Include="Scripts\element-browser.js" />
<Content Include="Scripts\AutoFocus.js" /> <Content Include="Scripts\AutoFocus.js" />
<Content Include="Scripts\Elements\Image.js" />
<Content Include="Scripts\LayoutDesignerHost.js" /> <Content Include="Scripts\LayoutDesignerHost.js" />
<Content Include="Scripts\element-editor.js" /> <Content Include="Scripts\element-editor.js" />
<Content Include="Scripts\frame.js" /> <Content Include="Scripts\frame.js" />
@@ -322,7 +323,7 @@
<Compile Include="Drivers\MenuElementDriver.cs" /> <Compile Include="Drivers\MenuElementDriver.cs" />
<Compile Include="Drivers\NotificationsElementDriver.cs" /> <Compile Include="Drivers\NotificationsElementDriver.cs" />
<Compile Include="Drivers\HeadingElementDriver.cs" /> <Compile Include="Drivers\HeadingElementDriver.cs" />
<Compile Include="Drivers\ShapeElementDriver.cs" /> <Compile Include="Drivers\ShapeElementDriver.cs" />
<Compile Include="Drivers\BreakElementDriver.cs" /> <Compile Include="Drivers\BreakElementDriver.cs" />
<Compile Include="Elements\Breadcrumbs.cs" /> <Compile Include="Elements\Breadcrumbs.cs" />
<Compile Include="Elements\Canvas.cs" /> <Compile Include="Elements\Canvas.cs" />

View File

@@ -0,0 +1,11 @@
(function ($) {
$(function() {
$(".media-library-picker-field").on("opened", function(e) {
window.parent.currentDialog.toggleCommands(false);
});
$(".media-library-picker-field").on("closed", function(e) {
window.parent.currentDialog.toggleCommands(true);
});
});
})(jQuery);

View File

@@ -124,6 +124,13 @@
this.element.trigger(event, args); this.element.trigger(event, args);
}; };
this.toggleCommands = function (show) {
var scope = this.element;
var buttons = scope.find(".buttons");
buttons.toggle(show);
};
var resizeIFrame = function () { var resizeIFrame = function () {
if (self.frame == null) if (self.frame == null)
return; return;
@@ -202,7 +209,7 @@
var button = $(this); var button = $(this);
var command = button.data("command"); var command = button.data("command");
if (!command || command.length == 0) if (!command || command.length === 0)
return; return;
self.trigger("command", { self.trigger("command", {

View File

@@ -1,5 +1,9 @@
@using Orchard.ContentManagement @using Orchard.ContentManagement
@model Orchard.Layouts.ViewModels.ImageEditorViewModel @model Orchard.Layouts.ViewModels.ImageEditorViewModel
@{
Script.Require("jQuery");
Script.Include("Elements/Image.js");
}
@{ @{
var contentItems = new List<ContentItem>(); var contentItems = new List<ContentItem>();

View File

@@ -78,12 +78,15 @@
onLoad: function() { // hide the scrollbars from the main window onLoad: function() { // hide the scrollbars from the main window
$('html, body').css('overflow', 'hidden'); $('html, body').css('overflow', 'hidden');
$('#cboxClose').remove(); $('#cboxClose').remove();
element.trigger("opened");
}, },
onClosed: function() { onClosed: function() {
$('html, body').css('overflow', ''); $('html, body').css('overflow', '');
var selectedData = $.colorbox.selectedData; var selectedData = $.colorbox.selectedData;
if (selectedData == null) // Dialog cancelled, do nothing if (selectedData == null) { // Dialog cancelled, do nothing
element.trigger("closed");
return; return;
}
var selectionLength = multiple ? selectedData.length : Math.min(selectedData.length, 1); var selectionLength = multiple ? selectedData.length : Math.min(selectedData.length, 1);
@@ -102,6 +105,8 @@
if (selectedData.length) { if (selectedData.length) {
showSaveMsg(); showSaveMsg();
} }
element.trigger("closed");
} }
}); });