Commit 3e9836de6ae9cf23f6f4292a67638062f8baa33b

Authored by unknown
1 parent 7f32607a

Implemented history Functionality

400-SOURCECODE/AIAHTML5.Web/app/controllers/TileViewListController.js
... ... @@ -33,11 +33,12 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
33 33 selectedorientation: '',
34 34 selectedimagetype: '',
35 35 };
36   -
  36 + //$rootScope.isListViewRowClicked = false;
37 37 $scope.showTabButton = true;
38 38 $scope.isListViewDataLoaded = true;
  39 +
39 40 $scope.setActiveTab = function (tabToSet) {
40   -
  41 + debugger;
41 42 $scope.activeTab = tabToSet;
42 43 localStorage.setItem("activeTab", $scope.activeTab);
43 44 if ($scope.activeTab == 1) {
... ... @@ -47,6 +48,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
47 48 }
48 49 else
49 50 {
  51 +
50 52 $('#grid-view').css("display", "none");
51 53 if ($scope.isListViewDataLoaded == true) {
52 54 var htm = '';
... ... @@ -62,7 +64,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
62 64 htm += "</tr>"
63 65 });
64 66 htm += "</tbody></table>";
65   - $("#list-view").append(htm);
  67 + $("#list-view").html(htm);
66 68 $compile(htm)($scope);
67 69 }
68 70 });
... ... @@ -73,8 +75,20 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
73 75 {
74 76 $('#list-view').css("display", "block");
75 77 }
  78 +
  79 + $timeout(function () {
  80 + // if ($rootScope.isListViewRowClicked == true) {
  81 + // $rootScope.isListViewRowClicked = false;
  82 + $("#demoView").remove();
  83 + $("#viewList").append("<div class='col-xs-12 text-center' style='padding-top:15px;padding-bottom:15px;' id='demoView'><div class='col-xs-12' style='padding:15px;background-color:#fff;'><div class='col-xs-2' style='border:1px solid #000;padding:5px;color:#000;font-size:12px;'><div class='thumbnail' style='margin-bottom:10px;'><img style='width:auto;height:95px!important;' src=" + $rootScope.listArray[0].imageName + "></div><div class='col-xs-12' id='demoText' style='padding:0;'>" + $rootScope.listArray[0].text + "</div></div></div><a style='position:absolute;right:30px;bottom:34px;' onclick='openCurrentView(event)' href='javascript:void(0)' class='pull-right btn btn-primary'>Open</a></div>");
  84 + var moduleItemDataToBeSavedID
  85 + $("#list-view table tbody tr").removeClass("active");
  86 + var moduleItemDataToBeSavedID = localStorage.getItem("listViewSelectedID");
  87 + $("#list-view table tbody #" + moduleItemDataToBeSavedID).addClass("active");
  88 + $scope.isListViewButtonClicked = true;
  89 + // }
  90 + }, 2000);
76 91 }
77   -
78 92 };
79 93  
80 94 $scope.loadForModuleById = function (moduleId) {
... ... @@ -110,22 +124,25 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
110 124 //});
111 125 $scope.isOpenBtnClicked = false;
112 126 $scope.openModuleItemView = function (event) {
113   -
  127 + debugger;
  128 + localStorage.setItem("activeTab", $scope.activeTab);
114 129 //0. Get selected Image Id
115 130 if ($scope.isListViewButtonClicked == true) {
116 131 if ($scope.isOpenBtnClicked == true) {
117   - // alert($("#demoText").html());
  132 +
118 133 var moduleItemDataToBeSaved = $("#demoText").html();
119 134 $scope.isOpenBtnClicked = false;
120 135 }
121 136 else {
122 137 var moduleItemDataToBeSavedID = event.currentTarget.id;
  138 + // localStorage.setItem("listViewSelectedID", moduleItemDataToBeSavedID);
123 139 var moduleItemDataToBeSaved = $("#list-view table tbody #" + moduleItemDataToBeSavedID).find('td:eq(0)').text();
124 140 }
125 141 }
126 142 else
127 143 {
128 144 var moduleItemDataToBeSaved = event.target.id;
  145 + // localStorage.setItem("listViewSelectedID", moduleItemDataToBeSavedID);
129 146 $scope.isListViewButtonClicked = false;
130 147 }
131 148  
... ... @@ -138,8 +155,9 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
138 155 $rootScope.bodySystemName = $rootScope.OpenedTileData[2];
139 156 $rootScope.OpenItemImagePath = "../../../content/images/aa/images/" + $rootScope.OpenedTileData[3];
140 157 $scope.OpenItemImagePath = "../../../content/images/aa/images/" + $rootScope.OpenedTileData[3];
141   -
142   - //3. set opened module item title
  158 + $rootScope.listArray = [];
  159 + $rootScope.listArray.push({ "imageName": $rootScope.OpenItemImagePath, "text": moduleItemDataToBeSaved });
  160 + //3. set opened module item ti
143 161 localStorage.setItem("currentViewTitle", $rootScope.OpenedTileData[6]);
144 162  
145 163 //3. Navigate to the Module-item-view
... ... @@ -149,13 +167,17 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
149 167  
150 168  
151 169 $scope.openListViewModuleItem = function (event) {
  170 +
152 171 $("#demoView").remove();
153 172 var moduleItemDataToBeSavedID = event.currentTarget.id;
154 173 $("#list-view table tbody tr").removeClass("active");
  174 + localStorage.setItem("listViewSelectedID", moduleItemDataToBeSavedID);
155 175 $("#list-view table tbody #" + moduleItemDataToBeSavedID).addClass("active");
156 176 var moduleItemDataToBeSaved = $("#list-view table tbody #" + moduleItemDataToBeSavedID).find('td:eq(0)').text();
157 177 $rootScope.OpenedTileData = ModuleService.GetOpenedTileData(moduleItemDataToBeSaved, $scope.moduleLandingData);
158 178 $rootScope.OpenItemImagePath = "../../../content/images/aa/images/" + $rootScope.OpenedTileData[3];
  179 + $rootScope.listArray = [];
  180 + $rootScope.listArray.push({ "imageName": $rootScope.OpenItemImagePath, "text": moduleItemDataToBeSaved });
159 181 $("#viewList").append("<div class='col-xs-12 text-center' style='padding-top:15px;padding-bottom:15px;' id='demoView'><div class='col-xs-12' style='padding:15px;background-color:#fff;'><div class='col-xs-2' style='border:1px solid #000;padding:5px;color:#000;font-size:12px;'><div class='thumbnail' style='margin-bottom:10px;'><img style='width:auto;height:95px!important;' src=" + $rootScope.OpenItemImagePath + "></div><div class='col-xs-12' id='demoText' style='padding:0;'>" + moduleItemDataToBeSaved + "</div></div></div><a style='position:absolute;right:30px;bottom:34px;' onclick='openCurrentView(event)' href='javascript:void(0)' class='pull-right btn btn-primary'>Open</a></div>");
160 182 }
161 183  
... ... @@ -279,13 +301,20 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
279 301  
280 302  
281 303  
282   -
  304 +
283 305 angular.element(document).ready(function (e) {
284 306 $("#ImagePanel").resize(function () {
285 307 $("#canvasDiv").scrollLeft($rootScope.CanvasDivLeftPosition);
286 308 $("#canvasDiv").scrollTop($rootScope.CanvasDivTopPosition);
287 309 });
  310 + $(document).on("click", "#ImagePanel .jsPanel-hdr .jsPanel-hdr-r .jsPanel-btn-close .jsglyph-remove", function () {
  311 + $scope.setActiveTab(parseInt(localStorage.getItem("activeTab")));
  312 + //if (localStorage.getItem("activeTab") != null) {
  313 +
  314 + // $rootScope.isListViewRowClicked = true;
288 315  
  316 + //}
  317 + });
289 318 })
290 319  
291 320 $scope.showAllPins = function () {
... ... @@ -1540,6 +1569,7 @@ function openModuleItemView(event) {
1540 1569 }
1541 1570  
1542 1571 function openListViewModuleItem(event) {
  1572 + debugger;
1543 1573 var scope = angular.element(document.getElementById("list-view")).scope();
1544 1574 scope.isListViewButtonClicked = true;
1545 1575 scope.$apply(function () {
... ... @@ -1548,6 +1578,7 @@ function openListViewModuleItem(event) {
1548 1578 }
1549 1579  
1550 1580 function openCurrentView(event) {
  1581 + debugger;
1551 1582 var scope = angular.element(document.getElementById("list-view")).scope();
1552 1583 scope.isOpenBtnClicked = true;
1553 1584 scope.$apply(function () {
... ...