diff --git a/app/scripts/config/directives/guiConfigEditorForm.js b/app/scripts/config/directives/guiConfigEditorForm.js index 47341ca3..7fa78760 100644 --- a/app/scripts/config/directives/guiConfigEditorForm.js +++ b/app/scripts/config/directives/guiConfigEditorForm.js @@ -17,7 +17,8 @@ }, templateUrl: $designService.getTemplate("config/gui/configEditorForm.html"), controller: function ($scope) { - var updateAttributes; + var updateAttributes, addTab, addFields, sortFieldsInGroups; + $scope.tabs = {}; $scope.click = function (id) { if (typeof $scope.parent.selectTab === "function") { @@ -27,7 +28,7 @@ } }; - var addTab = function(attr) { + addTab = function (attr) { if (attr.Type === "group") { if (typeof $scope.tabs[attr.Group] === "undefined") { $scope.tabs[attr.Group] = []; @@ -36,13 +37,32 @@ } }; - var addFields = function(attr) { + addFields = function (attr) { if (typeof $scope.attributeGroups[attr.Group] === "undefined") { $scope.attributeGroups[attr.Group] = []; } $scope.attributeGroups[attr.Group].push(attr); }; + sortFieldsInGroups = function () { + var sortByLabel, tab; + sortByLabel = function (a, b) { + if (a.Label.toString() < b.Label.toString()) { + return -1; + } + if (a.Label.toString() > b.Label.toString()) { + return 1; + } + + return 0; + }; + for (tab in $scope.attributeGroups) { + if ($scope.attributeGroups.hasOwnProperty(tab)) { + $scope.attributeGroups[tab].sort(sortByLabel); + } + } + }; + updateAttributes = function () { if ($scope.item === "undefined" || JSON.stringify({}) === JSON.stringify($scope.item)) { @@ -64,12 +84,11 @@ attr = setAttrValue($scope.attributes[i]); addFields(attr); - addTab(attr); } } - + sortFieldsInGroups(); }; $scope.$watchCollection("attributes", updateAttributes); diff --git a/app/scripts/config/service/config.js b/app/scripts/config/service/config.js index 7d0a4176..1591ded4 100644 --- a/app/scripts/config/service/config.js +++ b/app/scripts/config/service/config.js @@ -25,7 +25,16 @@ isLoaded = {}; getConfigGroups = function () { - return configGroups; + return configGroups.sort(function(a, b){ + if (a.Name.toString() < b.Name.toString()) { + return 1; + } + if (a.Name.toString() > b.Name.toString()) { + return -1; + } + + return 0; + }); }; getConfigTabs = function (group) { diff --git a/app/scripts/design/directives/guiPaginator.js b/app/scripts/design/directives/guiPaginator.js index 0c6a1ee2..eb136f94 100644 --- a/app/scripts/design/directives/guiPaginator.js +++ b/app/scripts/design/directives/guiPaginator.js @@ -14,7 +14,47 @@ scope: { 'parent': '=object' }, - templateUrl: $designService.getTemplate('design/gui/paginator.html') + templateUrl: $designService.getTemplate('design/gui/paginator.html'), + controller: ["$scope", + function ($scope) { + + $scope.pages = $scope.parent.getPages(); + + var countNeighbors = 2; + $scope.leftBreak = false; + $scope.rightBreak = false; + + $scope.isNeighbors = function (page) { + return Math.abs($scope.parent.paginator.page - page) <= countNeighbors; + }; + + $scope.hasLeftBreak = function () { + return $scope.leftBreak; + }; + + $scope.hasRightBreak = function () { + return $scope.rightBreak; + }; + + + $scope.$watch("parent.paginator.page", function () { + if (typeof $scope.parent.paginator === "undefined") { + return true; + } + + var leftBorder = $scope.parent.paginator.page - countNeighbors; + var rightBorder = $scope.parent.paginator.page + countNeighbors; + + if (leftBorder > $scope.parent.getPages()[0] + 1 ) { + $scope.leftBreak = true; + } + + if (rightBorder < $scope.parent.getPages()[$scope.parent.getPages().length-1]-1) { + $scope.rightBreak = true; + } + }, true); + } + ] }; }]); diff --git a/app/themes/default/scripts/main-chart.js b/app/themes/default/scripts/main-chart.js deleted file mode 100755 index 31c0fa65..00000000 --- a/app/themes/default/scripts/main-chart.js +++ /dev/null @@ -1,90 +0,0 @@ -var data7_1 = [ - [1354586000000, 253], - [1354587000000, 465], - [1354588000000, 498], - [1354589000000, 383], - [1354590000000, 280], - [1354591000000, 108], - [1354592000000, 120], - [1354593000000, 474], - [1354594000000, 623], - [1354595000000, 479], - [1354596000000, 788], - [1354597000000, 836] -]; -var data7_2 = [ - [1354586000000, 253], - [1354587000000, 465], - [1354588000000, 498], - [1354589000000, 383], - [1354590000000, 280], - [1354591000000, 108], - [1354592000000, 120], - [1354593000000, 474], - [1354594000000, 623], - [1354595000000, 479], - [1354596000000, 788], - [1354597000000, 836] -]; -$(function() { - $.plot($("#visitors-chart #visitors-container"), [{ - data: data7_1, - label: "Page View", - lines: { - fill: true - } - }, { - data: data7_2, - label: "Online User", - - points: { - show: true - }, - lines: { - show: true - }, - yaxis: 2 - } - ], - { - series: { - lines: { - show: true, - fill: false - }, - points: { - show: true, - lineWidth: 2, - fill: true, - fillColor: "#ffffff", - symbol: "circle", - radius: 5 - }, - shadowSize: 0 - }, - grid: { - hoverable: true, - clickable: true, - tickColor: "#f9f9f9", - borderWidth: 1, - borderColor: "#eeeeee" - }, - colors: ["#65CEA7", "#424F63"], - tooltip: true, - tooltipOpts: { - defaultTheme: false - }, - xaxis: { - mode: "time" - - - }, - yaxes: [{ - /* First y axis */ - }, { - /* Second y axis */ - position: "right" /* left or right */ - }] - } - ); -}); diff --git a/app/themes/default/views/design/gui/paginator.html b/app/themes/default/views/design/gui/paginator.html index 3b58a119..daa3310d 100644 --- a/app/themes/default/views/design/gui/paginator.html +++ b/app/themes/default/views/design/gui/paginator.html @@ -3,7 +3,23 @@