dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #35778
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18312: tracker-capture: changes to dashboard layout are now persisted automatically
------------------------------------------------------------
revno: 18312
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2015-02-18 14:12:41 +0100
message:
tracker-capture: changes to dashboard layout are now persisted automatically
modified:
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard-controller.js
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard-widgets.html
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard.html
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard-controller.js 2015-02-18 13:00:15 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard-controller.js 2015-02-18 13:12:41 +0000
@@ -184,6 +184,10 @@
$scope.orderChanged = true;
}
}
+
+ if($scope.orderChanged){
+ saveDashboardLayout();
+ }
}
});
@@ -215,27 +219,15 @@
$scope.removeWidget = function(widget){
widget.show = false;
- trackWidgetStatusChange(widget);
+ saveDashboardLayout();
};
$scope.expandCollapse = function(widget){
widget.expand = !widget.expand;
- trackWidgetStatusChange(widget);
- };
-
- var trackWidgetStatusChange = function(widget){
- var w = $scope.dashboardStatus[widget.title];
-
- if(!angular.equals(w, widget) && $scope.widgetsChanged.indexOf(widget.title) === -1){
- $scope.widgetsChanged.push(widget.title);
- }
- if(angular.equals(w, widget) && $scope.widgetsChanged.indexOf(widget.title) !== -1){
- var idx = $scope.widgetsChanged.indexOf(widget.title);
- $scope.widgetsChanged.splice(idx,1);
- }
- };
-
- $scope.saveDashboardLayout = function(){
+ saveDashboardLayout();;
+ };
+
+ var saveDashboardLayout = function(){
var widgets = [];
angular.forEach($rootScope.dashboardWidgets, function(widget){
var w = angular.copy(widget);
@@ -257,15 +249,7 @@
$scope.dashboardLayouts[$scope.selectedProgram.id] = {widgets: widgets, program: $scope.selectedProgram.id};
}
- DashboardLayoutService.saveLayout($scope.dashboardLayouts).then(function(){
- if($scope.selectedProgramId && $scope.selectedProgram && $scope.selectedProgramId === $scope.selectedProgram.id ||
- !$scope.selectedProgramId && !$scope.selectedProgram){
- $route.reload();
- }
- else{
- $location.path('/dashboard').search({tei: $scope.selectedTeiId,
- program: $scope.selectedProgram ? $scope.selectedProgram.id: null});
- }
+ DashboardLayoutService.saveLayout($scope.dashboardLayouts).then(function(){
});
};
@@ -280,6 +264,6 @@
};
$rootScope.closeOpenWidget = function(widget){
- trackWidgetStatusChange(widget);
+ saveDashboardLayout();
};
});
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard-widgets.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard-widgets.html 2015-02-06 20:22:45 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard-widgets.html 2015-02-18 13:12:41 +0000
@@ -1,32 +1,3 @@
-<!--<div class="modal-header">
- <h1>{{'select_widgets_to_show'| translate}}</h1>
-</div>
-
-<div class="modal-body">
- <table class="listTable dhis2-table-striped-border">
- <tr ng-repeat="biggerWidget in biggerDashboardWidgets">
- <td>
- {{biggerWidget.title | translate}}
- </td>
- <td>
- <input type="checkbox" ng-model="biggerWidget.show" ng-change="applyWidgetChange(biggerWidget)">
- </td>
- </tr>
- <tr ng-repeat="smallerWidget in smallerDashboardWidgets">
- <td>
- {{smallerWidget.title | translate}}
- </td>
- <td>
- <input type="checkbox" ng-model="smallerWidget.show" ng-change="applyWidgetChange(smallerWidget)">
- </td>
- </tr>
- </table>
-</div>
-
-<div class="modal-footer">
- <button type="button" class="btn btn-default" data-ng-click="close()">{{'close'| translate}}</button>
-</div>-->
-
<div class="modal-header">
<h1>{{'select_widgets_to_show'| translate}}</h1>
</div>
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard.html 2015-02-09 17:04:31 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard.html 2015-02-18 13:12:41 +0000
@@ -12,9 +12,6 @@
</select>
<div class="pull-right">
- <span ng-if="selectedProgram && (widgetsChanged.length > 0 || orderChanged)">
- <span class="trimmed-alert alert-danger">{{'dashboard_layout_not_saved'| translate}}</span><button type="button" class="btn btn-primary small-horizonal-spacing" ng-click="saveDashboardLayout()">{{'save'| translate}}</button>
- </span>
<div class="btn-group" dropdown is-open="status.isopen">
<button type="button" class="btn btn-default dropdown-toggle">
<i class="fa fa-cog" title="{{'settings'| translate}}"></i>