Set the form dirty when adding/removing/sorting rules

This commit is contained in:
Kenn Jacobsen
2018-11-02 09:20:42 +01:00
parent d0e6d0af2f
commit 60e8fed552
2 changed files with 14 additions and 5 deletions

View File

@@ -156,6 +156,10 @@
vm.stylesheet = stylesheet;
vm.setDirty = function () {
setFormState("dirty");
}
//sync state
editorState.set(vm.stylesheet);
@@ -215,7 +219,7 @@
vm.editor.on("change", changeAceEditor);
}
}
}
function changeAceEditor() {
@@ -263,7 +267,7 @@
payload),
"Failed to extract style sheet rules");
}
$scope.selectApp = function (app) {
vm.page.loading = true;

View File

@@ -1,5 +1,5 @@
angular.module("umbraco").controller("Umbraco.Editors.StyleSheets.RulesController",
function ($scope) {
function ($scope, angularHelper) {
$scope.sortableOptions = {
axis: 'y',
containment: 'parent',
@@ -7,8 +7,7 @@ angular.module("umbraco").controller("Umbraco.Editors.StyleSheets.RulesControlle
items: 'div.umb-stylesheet-rules__listitem',
tolerance: 'pointer',
update: function (e, ui) {
// TODO
console.log("TODO: set dirty")
setDirty();
}
};
@@ -16,11 +15,17 @@ angular.module("umbraco").controller("Umbraco.Editors.StyleSheets.RulesControlle
evt.preventDefault();
$scope.model.stylesheet.rules.push({});
setDirty();
}
$scope.remove = function (rule, evt) {
evt.preventDefault();
$scope.model.stylesheet.rules = _.without($scope.model.stylesheet.rules, rule);
setDirty();
}
function setDirty() {
$scope.model.setDirty();
}
});