Commit 9a8ad01c456fbba4e4ff84759dba0d464ad3f650
1 parent
3da70732
made jspanel dynamic. removed hardcoded DAcontroller
Showing
3 changed files
with
127 additions
and
94 deletions
400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js
... | ... | @@ -303,6 +303,8 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo |
303 | 303 | id: 'daImagePanel', |
304 | 304 | selector: '.daBodyView', |
305 | 305 | theme: 'success', |
306 | + currentController: 'DAController', | |
307 | + parentSlug:'da-view-list', | |
306 | 308 | ajax: { |
307 | 309 | url: 'app/views/da/da-view.html' |
308 | 310 | }, |
... | ... | @@ -1311,50 +1313,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo |
1311 | 1313 | //alert('Disabled wait cursor is done.See val :' + $rootScope.isLoading); |
1312 | 1314 | } |
1313 | 1315 | |
1314 | - //called on jspanel close | |
1315 | - $scope.openParent = function () { | |
1316 | - // debugger; | |
1317 | - var openViews = $rootScope.openViews; | |
1318 | - if (openViews.length > 0) { | |
1319 | - $rootScope.openViews.splice(openViews.length - 1); | |
1320 | - } | |
1321 | - if (openViews.length > 0) { | |
1322 | - var lastOpenMoudle = $rootScope.openViews[openViews.length - 1]; | |
1323 | - } | |
1324 | - $('#daImagePanel').remove(); | |
1325 | - $location.url('/da-view-list'); | |
1326 | - } | |
1327 | - | |
1328 | - //called on jsanel minimize | |
1329 | - $scope.setState = function (state, title) { | |
1330 | - //debugger; | |
1331 | - | |
1332 | - | |
1333 | - var alreadyOpenThisView = new jinqJs() | |
1334 | - .from($rootScope.openViews) | |
1335 | - .where("body-views == " + title) | |
1336 | - .select(); | |
1337 | - var k = 0; | |
1338 | - if (alreadyOpenThisView != null) { | |
1339 | - for (var i = 0; i < $rootScope.openViews.length; i++) { | |
1340 | - k++; | |
1341 | - if ($rootScope.openViews[i].body - views == title) { | |
1342 | - $rootScope.openViews.splice((k - 1), 1); | |
1343 | - | |
1344 | - $rootScope.openViews.push( | |
1345 | - { | |
1346 | - "module": $rootScope.currentActiveModuleTitle, "body-views": title, "state": state, "BodyViewId": $rootScope.currentBodyViewId, | |
1347 | - "slug": $rootScope.currentSlug | |
1348 | - } | |
1349 | - ); | |
1350 | - } | |
1351 | - } | |
1352 | - } | |
1353 | - if (state == 'max') { | |
1354 | - $('#daBodyview').css('width', '100%') | |
1355 | - } | |
1356 | - } | |
1357 | - | |
1316 | + | |
1358 | 1317 | $scope.changeLayer = function () { |
1359 | 1318 | console.log('changeLayer'); |
1360 | 1319 | // alert('slide') | ... | ... |
400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js
... | ... | @@ -29,6 +29,50 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", |
29 | 29 | $rootScope.lastX; |
30 | 30 | $rootScope.lastY; |
31 | 31 | |
32 | + //jspanel functionality.. | |
33 | + $rootScope.openParent = function (slug) { | |
34 | + // debugger; | |
35 | + var openViews = $rootScope.openViews; | |
36 | + if (openViews.length > 0) { | |
37 | + $rootScope.openViews.splice(openViews.length - 1); | |
38 | + } | |
39 | + if (openViews.length > 0) { | |
40 | + var lastOpenMoudle = $rootScope.openViews[openViews.length - 1]; | |
41 | + } | |
42 | + $('#daImagePanel').remove(); | |
43 | + $location.url('/' + slug); | |
44 | + } | |
45 | + | |
46 | + //called on jsanel minimize | |
47 | + $rootScope.setState = function (state, title) { | |
48 | + debugger; | |
49 | + | |
50 | + | |
51 | + var alreadyOpenThisView = new jinqJs() | |
52 | + .from($rootScope.openViews) | |
53 | + .where("body-views == " + title) | |
54 | + .select(); | |
55 | + var k = 0; | |
56 | + if (alreadyOpenThisView != null) { | |
57 | + for (var i = 0; i < $rootScope.openViews.length; i++) { | |
58 | + k++; | |
59 | + if ($rootScope.openViews[i].body - views == title) { | |
60 | + $rootScope.openViews.splice((k - 1), 1); | |
61 | + | |
62 | + $rootScope.openViews.push( | |
63 | + { | |
64 | + "module": $rootScope.currentActiveModuleTitle, "body-views": title, "state": state, "BodyViewId": $rootScope.currentBodyViewId, | |
65 | + "slug": $rootScope.currentSlug | |
66 | + } | |
67 | + ); | |
68 | + } | |
69 | + } | |
70 | + } | |
71 | + if (state == 'max') { | |
72 | + $('#daBodyview').css('width', '100%') | |
73 | + } | |
74 | + } | |
75 | + | |
32 | 76 | |
33 | 77 | |
34 | 78 | $rootScope.ClearIframe = function () { |
... | ... | @@ -38,6 +82,8 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", |
38 | 82 | $rootScope.hideScrollbar(); |
39 | 83 | } |
40 | 84 | |
85 | + //ends | |
86 | + | |
41 | 87 | $rootScope.hideScrollbar = function () { |
42 | 88 | $(".sidebar").mCustomScrollbar({ |
43 | 89 | autoHideScrollbar: true, | ... | ... |
400-SOURCECODE/AIAHTML5.Web/libs/jquery/jquery_plugin/jsPanel/jspanel/jquery.jspanel.js
... | ... | @@ -75,7 +75,7 @@ var jsPanel = { |
75 | 75 | '<div class="jsPanel-hdr jsPanel-theme-default">' + |
76 | 76 | '<h3 class="jsPanel-title"></h3>' + |
77 | 77 | '<div class="jsPanel-hdr-r">' + |
78 | - '<div class="jsPanel-btn-close ng-click= openBodyView"><span class="jsglyph jsglyph-remove"></span></div>' + | |
78 | + '<div class="jsPanel-btn-close "><span class="jsglyph jsglyph-remove"></span></div>' + | |
79 | 79 | '<div class="jsPanel-btn-max"><span class="jsglyph jsglyph-maximize"></span></div>' + |
80 | 80 | '<div class="jsPanel-btn-norm"><span class="jsglyph jsglyph-normalize"></span></div>' + |
81 | 81 | '<div class="jsPanel-btn-min"><span id="minSpan" class="fa fa-minus"></span></div>' + |
... | ... | @@ -766,7 +766,7 @@ var jsPanel = { |
766 | 766 | |
767 | 767 | // loads content using jQuery.load() |
768 | 768 | load: function (panel) { |
769 | - // alert('pppp') | |
769 | + // alert('pppp') | |
770 | 770 | panel.content.load(panel.option.load.url, panel.option.load.data || undefined, function (responseText, textStatus, jqXHR) { |
771 | 771 | if ($.isFunction(panel.option.load.complete)) { |
772 | 772 | panel.option.load.complete.call(panel.content, responseText, textStatus, jqXHR, panel); |
... | ... | @@ -821,17 +821,19 @@ var jsPanel = { |
821 | 821 | //height: $(window).outerHeight() - parseInt(panel.option.maximizedMargin.top) - parseInt(panel.option.maximizedMargin.bottom) |
822 | 822 | }); |
823 | 823 | //nikita |
824 | - if (panel.outerHeight() >= 435 && panel.outerWidth() >= 650) { | |
825 | - // alert('if') | |
826 | - $('#canvasDiv').css('height', panel.outerHeight() - 75) | |
827 | - $('#canvasDiv').css('width', panel.outerWidth() - 100) | |
828 | - $('#canvasDiv').css('overflow', 'scroll') | |
829 | - } | |
830 | - else { | |
831 | - // alert('else') | |
832 | - $('#canvasDiv').css('height', panel.outerHeight() - 110) | |
833 | - $('#canvasDiv').css('width', panel.outerWidth() - 90) | |
834 | - $('#canvasDiv').css('overflow', 'scroll') | |
824 | + if ($('#canvasDiv') != null) { | |
825 | + if (panel.outerHeight() >= 435 && panel.outerWidth() >= 650) { | |
826 | + // alert('if') | |
827 | + $('#canvasDiv').css('height', panel.outerHeight() - 75) | |
828 | + $('#canvasDiv').css('width', panel.outerWidth() - 100) | |
829 | + $('#canvasDiv').css('overflow', 'scroll') | |
830 | + } | |
831 | + else { | |
832 | + // alert('else') | |
833 | + $('#canvasDiv').css('height', panel.outerHeight() - 110) | |
834 | + $('#canvasDiv').css('width', panel.outerWidth() - 90) | |
835 | + $('#canvasDiv').css('overflow', 'scroll') | |
836 | + } | |
835 | 837 | } |
836 | 838 | //nikita |
837 | 839 | if (!panel.option.controls.maxtoScreen || (panel.option.controls.maxtoScreen && panel.option.selector === 'body')) { |
... | ... | @@ -858,23 +860,25 @@ var jsPanel = { |
858 | 860 | } |
859 | 861 | |
860 | 862 | //nikita |
863 | + if ($('#canvasDiv') != null){ | |
861 | 864 | if (panel.outerHeight() >= 435 && panel.outerWidth() >= 650) { |
862 | 865 | //alert('if') |
863 | - // debugger; | |
866 | + // debugger; | |
864 | 867 | $('#canvasDiv').css('height', panel.outerHeight() - 85) |
865 | 868 | $('#canvasDiv').css('width', panel.outerWidth() - 90) |
866 | 869 | $('#canvasDiv').css('overflow', 'scroll') |
867 | 870 | } |
868 | 871 | else { |
869 | - // alert('else') | |
872 | + // alert('else') | |
870 | 873 | $('#canvasDiv').css('height', panel.outerHeight() - 105) |
871 | 874 | $('#canvasDiv').css('width', panel.outerWidth() - 80) |
872 | 875 | $('#canvasDiv').css('overflow', 'scroll') |
873 | 876 | |
874 | 877 | } |
878 | + } | |
875 | 879 | //nikita |
876 | - // debugger; | |
877 | - // $(".fa-minus").removeClass('display'); | |
880 | + // debugger; | |
881 | + // $(".fa-minus").removeClass('display'); | |
878 | 882 | $('#minSpan').css({ 'display': '' }); |
879 | 883 | }, |
880 | 884 | |
... | ... | @@ -1110,8 +1114,11 @@ var jsPanel = { |
1110 | 1114 | this.resizeContent(panel); |
1111 | 1115 | this.resizeTitle(panel); |
1112 | 1116 | } |
1113 | - $('#canvasDiv').css('height', $(window).outerHeight() - 120) | |
1114 | - $('#leftToolBar').css('height', $(window).outerHeight() - 120) | |
1117 | + if ($('#canvasDiv') != null) { | |
1118 | + $('#canvasDiv').css('height', $(window).outerHeight() - 120) | |
1119 | + $('#leftToolBar').css('height', $(window).outerHeight() - 120) | |
1120 | + | |
1121 | + } | |
1115 | 1122 | }, |
1116 | 1123 | |
1117 | 1124 | // reset dimensions of content section after resize and so on |
... | ... | @@ -1486,6 +1493,13 @@ var jsPanel = { |
1486 | 1493 | var sel = 'div[ng-controller="' + ctrlName + '"]'; |
1487 | 1494 | return angular.element(sel).scope(); |
1488 | 1495 | }, |
1496 | + | |
1497 | + getRootScope: function (controllerName) { | |
1498 | + debugger; | |
1499 | + var $body = angular.element(document.body); // 1 | |
1500 | + return $body.scope().$root; | |
1501 | + | |
1502 | +} | |
1489 | 1503 | }; |
1490 | 1504 | |
1491 | 1505 | console.log("jsPanel version: " + jsPanel.version); |
... | ... | @@ -1657,8 +1671,10 @@ console.log("jsPanel version: " + jsPanel.version); |
1657 | 1671 | // jsPanel.close(jsP, jsP.parentElmtTagname); |
1658 | 1672 | // } |
1659 | 1673 | //} |
1660 | - var $scope = jsPanel.getScope('DAController'); | |
1661 | - $scope.openParent(); | |
1674 | + | |
1675 | + | |
1676 | + var $scope = jsPanel.getRootScope('HomeController'); | |
1677 | + $scope.openParent(jsP.option.parentSlug); | |
1662 | 1678 | $scope.$apply(); |
1663 | 1679 | }); |
1664 | 1680 | |
... | ... | @@ -1674,14 +1690,20 @@ console.log("jsPanel version: " + jsPanel.version); |
1674 | 1690 | // debugger; |
1675 | 1691 | var headerTitle = $('.jsPanel-title'); |
1676 | 1692 | var title = headerTitle[0].innerHTML; |
1677 | - var $scope = jsPanel.getScope('DAController'); | |
1678 | - $scope.setState('min', title); | |
1679 | - | |
1680 | - var canvasDiv = document.getElementById('canvasDiv'); | |
1681 | - $scope.imageVerticalScrollPosition = canvasDiv.scrollTop; | |
1682 | - $scope.imageHorizontlScrollPosition = canvasDiv.scrollLeft; | |
1683 | - | |
1684 | - $scope.$apply(); | |
1693 | + | |
1694 | + var $rootscope = jsPanel.getRootScope('HomeController'); | |
1695 | + //$rootscope.openParent(jsP.option.parentSlug); | |
1696 | + $rootscope.setState('min', title); | |
1697 | + $rootscope.$apply(); | |
1698 | + | |
1699 | + var currentController = jsP.option.currentController; | |
1700 | + if (currentController == 'DAController') { | |
1701 | + var $scope = jsPanel.getScope(currentController); | |
1702 | + var canvasDiv = document.getElementById('canvasDiv'); | |
1703 | + $scope.imageVerticalScrollPosition = canvasDiv.scrollTop; | |
1704 | + $scope.imageHorizontlScrollPosition = canvasDiv.scrollLeft; | |
1705 | + $scope.$apply(); | |
1706 | + } | |
1685 | 1707 | }); |
1686 | 1708 | |
1687 | 1709 | // jsPanel maximize |
... | ... | @@ -1689,7 +1711,7 @@ console.log("jsPanel version: " + jsPanel.version); |
1689 | 1711 | // debugger; |
1690 | 1712 | e.preventDefault(); |
1691 | 1713 | jsPanel.maximize(jsP); |
1692 | - | |
1714 | + | |
1693 | 1715 | $('.jsPanel-btn-min').css('display', 'initial'); |
1694 | 1716 | $('.fa fa-minus').css('display', 'initial'); |
1695 | 1717 | |
... | ... | @@ -1697,24 +1719,27 @@ console.log("jsPanel version: " + jsPanel.version); |
1697 | 1719 | |
1698 | 1720 | var headerTitle = $('.jsPanel-title'); |
1699 | 1721 | var title = headerTitle[0].innerHTML; |
1700 | - var $scope = jsPanel.getScope('DAController'); | |
1701 | - $scope.setState('max', title); | |
1702 | - $scope.$apply(); | |
1722 | + var $rootscope = jsPanel.getRootScope('HomeController'); | |
1723 | + $rootscope.setState('max', title); | |
1724 | + $rootscope.$apply(); | |
1703 | 1725 | }); |
1704 | 1726 | |
1705 | 1727 | // jsPanel normalize |
1706 | 1728 | $('.jsPanel-btn-norm', jsP).on('click', function (e) { |
1707 | - // debugger; | |
1729 | + // debugger; | |
1708 | 1730 | e.preventDefault(); |
1709 | 1731 | jsPanel.normalize(jsP); |
1710 | 1732 | |
1711 | - var $scope = jsPanel.getScope('DAController'); | |
1733 | + var currentController = jsP.option.currentController; | |
1734 | + if (currentController == 'DAController') { | |
1735 | + var $scope = jsPanel.getScope(currentController); | |
1712 | 1736 | |
1713 | 1737 | |
1714 | - $('#canvasDiv').scrollLeft($scope.imageHorizontlScrollPosition) | |
1715 | - $('#canvasDiv').scrollTop($scope.imageVerticalScrollPosition) | |
1738 | + $('#canvasDiv').scrollLeft($scope.imageHorizontlScrollPosition) | |
1739 | + $('#canvasDiv').scrollTop($scope.imageVerticalScrollPosition) | |
1716 | 1740 | |
1717 | - $scope.$apply(); | |
1741 | + $scope.$apply(); | |
1742 | + } | |
1718 | 1743 | }); |
1719 | 1744 | |
1720 | 1745 | // jsPanel smallify |
... | ... | @@ -2122,16 +2147,18 @@ console.log("jsPanel version: " + jsPanel.version); |
2122 | 2147 | height: jsP.outerHeight() |
2123 | 2148 | }; |
2124 | 2149 | //nikita |
2125 | - if (jsP.outerHeight() >= 435 && jsP.outerWidth() >= 650) { | |
2126 | - // alert('resizestop') | |
2127 | - $('#canvasDiv').css('height', jsP.outerHeight() - 85) | |
2128 | - $('#canvasDiv').css('width', jsP.outerWidth() - 95) | |
2129 | - $('#canvasDiv').css('overflow', 'scroll') | |
2130 | - } | |
2131 | - else { | |
2132 | - $('#canvasDiv').css('height', jsP.outerHeight() - 110) | |
2133 | - $('#canvasDiv').css('width', jsP.outerWidth() - 85) | |
2134 | - $('#canvasDiv').css('overflow', 'scroll') | |
2150 | + if ($('#canvasDiv') != null) { | |
2151 | + if (jsP.outerHeight() >= 435 && jsP.outerWidth() >= 650) { | |
2152 | + // alert('resizestop') | |
2153 | + $('#canvasDiv').css('height', jsP.outerHeight() - 85) | |
2154 | + $('#canvasDiv').css('width', jsP.outerWidth() - 95) | |
2155 | + $('#canvasDiv').css('overflow', 'scroll') | |
2156 | + } | |
2157 | + else { | |
2158 | + $('#canvasDiv').css('height', jsP.outerHeight() - 110) | |
2159 | + $('#canvasDiv').css('width', jsP.outerWidth() - 85) | |
2160 | + $('#canvasDiv').css('overflow', 'scroll') | |
2161 | + } | |
2135 | 2162 | } |
2136 | 2163 | //nikita |
2137 | 2164 | // $('#leftToolBar').css('height', jsP.outerWidth()) |
... | ... | @@ -2320,8 +2347,9 @@ console.log("jsPanel version: " + jsPanel.version); |
2320 | 2347 | "theme": 'default', |
2321 | 2348 | "title": 'jsPanel', |
2322 | 2349 | "toolbarFooter": false, |
2323 | - "toolbarHeader": false | |
2324 | - | |
2350 | + "toolbarHeader": false, | |
2351 | + "currentController": '', | |
2352 | + "parentSlug":'' | |
2325 | 2353 | |
2326 | 2354 | }; |
2327 | 2355 | ... | ... |