control sort before ui.sortable upgrade

This commit is contained in:
antoine
2014-09-06 17:35:13 +02:00
parent c04fee2aba
commit 142c4c09e1
3 changed files with 104 additions and 9 deletions

View File

@@ -7,7 +7,7 @@
// Sortabel
// -------------------------
.usky-grid .ui-sortable-helper {
border: dashed 1px #$000;
border: dashed 1px #000;
background: #ccc;
opacity: 0.4;
height: 50px !important;
@@ -205,9 +205,9 @@
// CONTROL
// -------------------------
.usky-grid .usky-control {
transition: all .20s ease-in-out;
/*transition: all .20s ease-in-out;
-moz-transition: all .20s ease-in-out;
-webkit-transition: all .20s ease-in-out;
-webkit-transition: all .20s ease-in-out;*/
position:relative;
display:block;

View File

@@ -19,37 +19,133 @@ angular.module("umbraco")
cursor: "move",
placeholder: 'ui-sortable-placeholder',
handle: '.cell-tools-move',
start: function (e, ui) {
ui.item.find('.mceNoEditor').each(function () {
tinyMCE.execCommand('mceRemoveEditor', false, $(this).attr('id'));
});
},
stop: function (e, ui) {
ui.item.find('.mceNoEditor').each(function () {
tinyMCE.execCommand('mceAddEditor', false, $(this).attr('id'));
});
}
};
var includedRte = [];
var allowedEditors = [];
var currentEditor = "";
$scope.sortableOptionsCell = {
distance: 10,
cursor: "move",
placeholder: "ui-sortable-placeholder",
handle: '.cell-tools-move',
connectWith: ".usky-cell",
forcePlaceholderSize: true,
receive: function (event, ui) {
ui.sender.sortable("cancel");
$scope.$apply();
//if ($(this).scope().area)
//{
// var allowedEditors = $(this).scope().area.allowed;
//}
//if (ui.item.scope().control) {
// var currentEditor = ui.item.scope().control.editor.alias;
//}
},
update: function (event, ui) {
//ui.sender.sortable("cancel");
//$scope.$apply();
//if ($.inArray(currentEditor, allowedEditors) < 0) {
// var notIncludedRte = [];
// ui.item.find('.mceNoEditor').each(function () {
// notIncludedRte.splice(0, 0, $(this).attr('id'));
// });
// if (ui.sender) {
// ui.item.parents(".usky-cell").find('.mceNoEditor').each(function () {
// if ($.inArray($(this).attr('id'), notIncludedRte) < 0) {
// tinyMCE.execCommand('mceRemoveEditor', false, $(this).attr('id'));
// includedRte.splice(0, 0, $(this).attr('id'));
// }
// });
// }
// ui.item.sortable.cancel();
//}
//else {
if (ui.sender) {
var notIncludedRte = [];
ui.item.find('.mceNoEditor').each(function () {
notIncludedRte.splice(0, 0, $(this).attr('id'));
});
ui.item.parents(".usky-cell").find('.mceNoEditor').each(function () {
if ($.inArray($(this).attr('id'), notIncludedRte) < 0) {
tinyMCE.execCommand('mceRemoveEditor', false, $(this).attr('id'));
includedRte.splice(0, 0, $(this).attr('id'));
}
});
ui.item.find('.mceNoEditor').each(function () {
tinyMCE.execCommand('mceAddEditor', false, $(this).attr('id'));
});
}
//}
},
start: function (e, ui) {
ui.item.find('.mceNoEditor').each(function () {
tinyMCE.execCommand('mceRemoveEditor', false, $(this).attr('id'));
tinyMCE.execCommand('mceRemoveEditor', false, $(this).attr('id'))
});
},
stop: function (e, ui) {
$scope.$apply();
ui.item.find('.mceNoEditor').each(function () {
tinyMCE.execCommand('mceAddEditor', false, $(this).attr('id'));
});
_.forEach(includedRte, function (value, index) {
tinyMCE.execCommand('mceAddEditor', false, value);
});
}
};
}
// *********************************************
// Template management functions

View File

@@ -36,8 +36,7 @@
ng-init="initSection(section)"
style="width:{{section.$percentage}}%">
<!--<div ui-sortable="sortableOptionsTest" ng-model="section.rows">-->
<div ng-model="section.rows">
<div ui-sortable="sortableOptions" ng-model="section.rows">
<!-- for each row in template section -->
<div ng-repeat="row in section.rows"
@@ -55,7 +54,7 @@
<div class="iconBox"
ng-click="deletePrompt = true"
ng-mouseover="setCurrentRemoveControl(row)"
ng-mouseleave="disableCurrentRemoveControl(row)">
ng-mouseleave="disableCurrentRemoveControl(row)">
<span ng-if="deletePrompt">
Are you sure?