try 1 at getting row indicator

This commit is contained in:
John Mitchell
2016-01-08 14:05:18 -05:00
parent 4f20b6c861
commit 490b25c3eb
3 changed files with 33 additions and 0 deletions

View File

@@ -2085,3 +2085,7 @@ button.dropdown-toggle,
.error.ng-hide {
opacity: 0;
}
.editedRow {
border-left: 5px solid red;
}

View File

@@ -966,6 +966,14 @@ var tower = angular.module('Tower', [
$rootScope.removeConfigReady();
}
$rootScope.removeConfigReady = $rootScope.$on('ConfigReady', function() {
// initially set row edit indicator for crud pages
if ($location.$$path.split("/")[2]) {
var list = $location.$$path.split("/")[1];
var id = $location.$$path.split("/")[2];
$rootScope.listBeingEdited = list;
$rootScope.rowBeingEdited = id;
}
LoadBasePaths();
$rootScope.crumbCache = [];
@@ -1048,7 +1056,19 @@ var tower = angular.module('Tower', [
},2000);
});
$rootScope.$on("$stateChangeStart", function (event, next, nextParams, prev) {
// broadcast event change if editing crud object
if ($location.$$path.split("/")[2]) {
var list = $location.$$path.split("/")[1];
var id = $location.$$path.split("/")[2];
delete $rootScope.listBeingEdited
delete $rootScope.rowBeingEdited
$rootScope.$broadcast("EditIndicatorChange", list, id);
}
// this line removes the query params attached to a route
if(prev && prev.$$route &&
prev.$$route.name === 'systemTracking'){

View File

@@ -170,6 +170,14 @@ export default ['$location', '$compile', '$rootScope', 'SearchWidget', 'Paginate
this.scope.list = list;
this.scope.mode = options.mode;
// respond to changes to the edit indicator from
// the stateChangeStart event in app.js
this.scope.$on("EditIndicatorChange", function(e, list, id) {
e.targetScope.listBeingEdited = list;
e.targetScope.rowBeingEdited = id;
console.log(list, id);
});
this.scope.isHiddenByOptions = function(options) {
// If neither ngHide nor ngShow are specified we
@@ -439,6 +447,7 @@ export default ['$location', '$compile', '$rootScope', 'SearchWidget', 'Paginate
if (list.multiSelect) {
innerTable += ", " + list.iterator + ".isSelected ? 'is-selected-row' : ''";
}
innerTable += ", rowBeingEdited === '{{ " + list.iterator + ".id }}' && listBeingEdited === '" + list.name + "' ? 'editedRow' : ''";
innerTable += "]\" ";
innerTable += "id=\"{{ " + list.iterator + ".id }}\" ";
innerTable += "class=\"" + list.iterator + "_class\" ";