From a9086fdd998effc6c73eabf4378bb6ca458fc909 Mon Sep 17 00:00:00 2001 From: Ian Wendt Date: Thu, 17 Mar 2016 09:26:30 -0700 Subject: [PATCH 01/16] Close GH-258: [#115868757] Updated the api url in demo-prod config. --- config/demo-prod.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/demo-prod.json b/config/demo-prod.json index ffa1169e..f9789f1e 100644 --- a/config/demo-prod.json +++ b/config/demo-prod.json @@ -1,6 +1,6 @@ { "useStrict" : "use strict", - "apiUrl" : "https://api.demo.ottemo.io", + "apiUrl" : "https://api-demo.ottemo.io", "mediaPath" : "https://demo.ottemo.io/media/", "itemsPerPage" : "15" } \ No newline at end of file From 9e8fc7374c4df91c422512f0b722b7699b1fd157 Mon Sep 17 00:00:00 2001 From: Ian Wendt Date: Thu, 17 Mar 2016 09:58:27 -0700 Subject: [PATCH 02/16] Close GH-259: [#115874479] Updated shippable.yml and deploy.sh. --- deploy.sh | 2 +- shippable.yml | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/deploy.sh b/deploy.sh index bfeb36c4..2c056379 100644 --- a/deploy.sh +++ b/deploy.sh @@ -26,7 +26,7 @@ if [ "$BRANCH" == 'develop' ]; then HOST=mp-staging fi # gulp build on remote host - ssh ottemo@$REMOTE_HOST "cd $SRCDIR && npm install && gulp build --api=${HOST}" + ssh ottemo@$REMOTE_HOST "cd $SRCDIR && npm install && gulp build --env=staging --api=${HOST}" echo "" echo RESTORING DIST DIRECTORY. diff --git a/shippable.yml b/shippable.yml index 7fbca20e..a54f28fc 100644 --- a/shippable.yml +++ b/shippable.yml @@ -1,15 +1,17 @@ language: node_js node_js: - - 0.12 + - 5.4.0 + +cache: false -# build image -build_image: shippableimages/ubuntu1404_nodejs env: global: - SLACK_ORG=Ottemo PROJECT=Dashboard - secure: B+KCUkySYJbPkFEcsuhCiaYymVphNX6aOkB7yjLYVlwLyZ0AmPv6a3BKOhFZyy15te+4nEQV4bY4Q/n40ceFMEj5FDlXXOw+oP4DMBd2/GS8HUkH8PnOKplH3hOYnob91Kr6tpuDOHJ1gfukAqQSIkQkgJGCwDx6uzYDfOSgxDUTAgp8GqdXnl6arvZzpmuFic5IScWSU0G6novNVdMD21z1KPpgxckurtStOxHWgOc+N0QSQXzE3MpsIyCxhJNVSxizxKoXLaZ7uktAkPmsloyUPfIYj9zni+n7OgxHlrnUl4DJPQmN89TndP2NeQa7nlUgPfhq5N6Hxxx3M6INDw== +install: + # only build/deploy the develop branch branch: only: @@ -26,4 +28,4 @@ after_success: - python slack_notifier.py --org $SLACK_ORG --project $PROJECT --token $SLACK_TOKEN -s notifications: - email: false + email: false \ No newline at end of file From 56f17dded2646c13b7bfcd0839096445c0f1a51b Mon Sep 17 00:00:00 2001 From: Adam Knox Date: Mon, 21 Mar 2016 09:29:53 -0700 Subject: [PATCH 03/16] Close GH-257: order status tabs [#115525249]. --- src/app/_scripts/main.js | 5 - src/app/_styles/_bootswatch.scss | 2 + src/app/_styles/components.scss | 3 +- src/app/_styles/components/spacing.scss | 2 +- src/app/_styles/components/tables.scss | 14 +- src/app/_styles/components/tabs.scss | 4 + src/app/design/directives/filter/guiRange.js | 76 ++--- src/app/design/directives/filter/guiSelect.js | 2 +- src/app/design/directives/guiTableManager.js | 8 +- src/app/design/directives/otEnter.js | 16 + src/app/design/gui/filter/dateRange.html | 28 +- src/app/design/gui/filter/range.html | 28 +- src/app/design/gui/filter/select.html | 13 +- src/app/design/gui/filter/text.html | 10 +- src/app/design/gui/table.html | 41 ++- src/app/order/list.controller.js | 310 +++++++++--------- src/app/order/list.html | 114 ++++--- src/app/order/order.scss | 5 + 18 files changed, 369 insertions(+), 312 deletions(-) create mode 100644 src/app/_styles/components/tabs.scss create mode 100644 src/app/design/directives/otEnter.js diff --git a/src/app/_scripts/main.js b/src/app/_scripts/main.js index eb0f06f7..c1d9b2bb 100644 --- a/src/app/_scripts/main.js +++ b/src/app/_scripts/main.js @@ -8,11 +8,6 @@ $(document).ready(function () { $(this).tab('show'); }); - // show/hide filters - $(document).on('click', '.filters', function () { - $('#filters').toggle(0); - }); - // uploading files $(document).on('click', '.upl-btn', function () { $(this).prev('.upl-input').trigger('click'); diff --git a/src/app/_styles/_bootswatch.scss b/src/app/_styles/_bootswatch.scss index 878be385..cb9602eb 100644 --- a/src/app/_styles/_bootswatch.scss +++ b/src/app/_styles/_bootswatch.scss @@ -79,6 +79,8 @@ input, background-color: $gray-lighter; border-color: $nav-tabs-border-color; color: $gray; + height: 42px; + line-height: 2; } > li.disabled > a:hover { diff --git a/src/app/_styles/components.scss b/src/app/_styles/components.scss index 8a00cba5..53dfb8ce 100644 --- a/src/app/_styles/components.scss +++ b/src/app/_styles/components.scss @@ -5,4 +5,5 @@ @import 'components/navigation'; @import 'components/odometer'; @import 'components/spacing'; -@import 'components/tables'; \ No newline at end of file +@import 'components/tables'; +@import 'components/tabs'; \ No newline at end of file diff --git a/src/app/_styles/components/spacing.scss b/src/app/_styles/components/spacing.scss index 0cfc221d..b1b63c8a 100644 --- a/src/app/_styles/components/spacing.scss +++ b/src/app/_styles/components/spacing.scss @@ -1,6 +1,6 @@ // bootstrap 4 spacing helpers -$spacer: $grid-gutter-width; +$spacer: $grid-gutter-width / 2; $spacer-x: $spacer; $spacer-y: $spacer; diff --git a/src/app/_styles/components/tables.scss b/src/app/_styles/components/tables.scss index 7a0500f9..0267d516 100644 --- a/src/app/_styles/components/tables.scss +++ b/src/app/_styles/components/tables.scss @@ -1,9 +1,13 @@ .table .td__title { - margin-top: 0; + margin-top: 0; } .table-striped-even { - > tbody > tr:nth-of-type(even) { - background-color: $table-bg-accent; - } -} \ No newline at end of file + > tbody > tr:nth-of-type(even) { + background-color: $table-bg-accent; + } +} + +.th-clickable { + cursor: pointer; +} diff --git a/src/app/_styles/components/tabs.scss b/src/app/_styles/components/tabs.scss new file mode 100644 index 00000000..67c4e3b8 --- /dev/null +++ b/src/app/_styles/components/tabs.scss @@ -0,0 +1,4 @@ +.tab-content-empty { + margin-top: 15px; + text-align: center; +} \ No newline at end of file diff --git a/src/app/design/directives/filter/guiRange.js b/src/app/design/directives/filter/guiRange.js index 24bac6a1..d2ee458d 100644 --- a/src/app/design/directives/filter/guiRange.js +++ b/src/app/design/directives/filter/guiRange.js @@ -1,71 +1,49 @@ -angular.module("designModule") +angular.module('designModule') -.directive("guiFilterRange", ["$designService", function($designService) { +.directive('guiFilterRange', ['$designService', function($designService) { return { - restrict: "E", + restrict: 'E', scope: { - "parent": "=object", - "attribute": "=editorScope", - "item": "=item" + 'parent': '=object', + 'attribute': '=editorScope', + 'item': '=item' }, - templateUrl: $designService.getTemplate("design/gui/filter/range.html"), + templateUrl: '/views/design/gui/filter/range.html', - controller: ["$scope", function($scope) { + controller: ['$scope', function($scope) { - $scope.highInvalid = false; - $scope.lowInvalid = false; - $scope.low = ""; - $scope.high = ""; - var regExpNumber = /^\s*[0-9]*\s*$/; + // $scope.low = ''; + // $scope.high = ''; var isInit = false; - var checkOnValid = function() { - - if (!regExpNumber.test($scope.low)) { - $scope.lowInvalid = true; - } else { - $scope.lowInvalid = false; - } - - if (!regExpNumber.test($scope.high)) { - $scope.highInvalid = true; - } else { - $scope.highInvalid = false; - } - }; - $scope.submit = function() { var targetAttribute = $scope.attribute.Attribute; - checkOnValid(); - - if (!$scope.lowInvalid && !$scope.highInvalid) { - var newFilterValue = ''; - $scope.low = $scope.low.trim(); - $scope.high = $scope.high.trim(); - - if ($scope.low || $scope.high) { - newFilterValue = $scope.low + ".." + $scope.high; - } - - $scope.item[targetAttribute] = newFilterValue - $scope.parent.newFilters[targetAttribute] = $scope.item[targetAttribute]; + var newFilterValue = ''; + + if ($scope.low || $scope.high) { + newFilterValue = [ + $scope.low, + '..', + $scope.high + ].join(''); } + + $scope.item[targetAttribute] = newFilterValue; + $scope.parent.newFilters[targetAttribute] = $scope.item[targetAttribute]; }; - $scope.$watch("item", function() { - if (typeof $scope.item === "undefined") { + $scope.$watch('item', function() { + if (typeof $scope.item === 'undefined') { return false; } - if (isInit || typeof $scope.item[$scope.attribute.Attribute] === "undefined") { + if (isInit || typeof $scope.item[$scope.attribute.Attribute] === 'undefined') { return false; } - var value = $scope.item[$scope.attribute.Attribute]; - var regExp = new RegExp("(\\d*)\\.\\.(\\d*)$", "i"); - var values = value.match(regExp); + var values = $scope.item[$scope.attribute.Attribute].split('..'); if (null !== values) { - $scope.low = values[1]; - $scope.high = values[2]; + $scope.low = parseFloat(values[0]); + $scope.high = parseFloat(values[1]); isInit = true; } diff --git a/src/app/design/directives/filter/guiSelect.js b/src/app/design/directives/filter/guiSelect.js index 6523b4f3..3a571af4 100644 --- a/src/app/design/directives/filter/guiSelect.js +++ b/src/app/design/directives/filter/guiSelect.js @@ -58,7 +58,7 @@ angular.module("designModule") var options, field, setNewFilterValues; setNewFilterValues = function () { - if (-1 !== ['text', 'string'].indexOf($scope.item.dataType)) { + if (-1 !== ['text', 'string', 'varchar'].indexOf($scope.item.dataType)) { $scope.item[$scope.attribute.Attribute] = $scope.item[$scope.attribute.Attribute].replace(/~/g, ""); $scope.parent.newFilters[$scope.attribute.Attribute] = $scope.item[$scope.attribute.Attribute].replace(/~/g, "").split(" "); } else { diff --git a/src/app/design/directives/guiTableManager.js b/src/app/design/directives/guiTableManager.js index 138514bd..1d7d3062 100644 --- a/src/app/design/directives/guiTableManager.js +++ b/src/app/design/directives/guiTableManager.js @@ -64,7 +64,8 @@ angular.module("designModule") // name: isActive new: true, delete: true - } + }; + $scope.isFiltersVisible = false; // If we have any buttonData set on the directive, let it override our defaults angular.forEach($scope.buttonData, function(isActive, btnName) { @@ -368,7 +369,10 @@ angular.module("designModule") if (filters[key] instanceof Array) { removeEmpty(filters[key]); if (filters[key].length > 0) { - filtersArr.push(key.toLowerCase() + '=~' + filters[key].join()); + // I'm not sure why we are using the like comparison operator + // for everything, but we don't want it for order.status... + var op = (key === 'status') ? '=' : '=~' + filtersArr.push(key.toLowerCase() + op + filters[key].join()); } } else { filtersArr.push(key.toLowerCase() + '=' + filters[key]); diff --git a/src/app/design/directives/otEnter.js b/src/app/design/directives/otEnter.js new file mode 100644 index 00000000..6cfcd9b4 --- /dev/null +++ b/src/app/design/directives/otEnter.js @@ -0,0 +1,16 @@ +angular.module('designModule') + +.directive('otEnter', function() { + return function(scope, element, attrs) { + element.bind('keydown keypress', function(event) { + if (event.which === 13) { + scope.$apply(function() { + scope.$eval(attrs.otEnter); + }); + + event.preventDefault(); + } + }); + }; +}); + diff --git a/src/app/design/gui/filter/dateRange.html b/src/app/design/gui/filter/dateRange.html index e775d19d..b22d9008 100644 --- a/src/app/design/gui/filter/dateRange.html +++ b/src/app/design/gui/filter/dateRange.html @@ -1,16 +1,20 @@ -
- -
- -

Invalid format. Select correct date.

+
+
+
- -
- -

Invalid format. Select correct date.

+ +
+
- apply + +

Invalid format. Select correct date.

+ + apply
diff --git a/src/app/design/gui/filter/range.html b/src/app/design/gui/filter/range.html index f1650d92..97c37a3f 100644 --- a/src/app/design/gui/filter/range.html +++ b/src/app/design/gui/filter/range.html @@ -1,18 +1,22 @@ -
- -
- -

Invalid format. Only numbers.

+
+
+
- -
- -

Invalid format. Only numbers.

+
+
- Apply +

Invalid format. Only numbers.

+ + Apply
diff --git a/src/app/design/gui/filter/select.html b/src/app/design/gui/filter/select.html index 596948f9..2f6c4ba2 100644 --- a/src/app/design/gui/filter/select.html +++ b/src/app/design/gui/filter/select.html @@ -1,5 +1,8 @@ - \ No newline at end of file + + diff --git a/src/app/design/gui/filter/text.html b/src/app/design/gui/filter/text.html index 90f79570..65c1d57d 100644 --- a/src/app/design/gui/filter/text.html +++ b/src/app/design/gui/filter/text.html @@ -1,3 +1,7 @@ - \ No newline at end of file + + diff --git a/src/app/design/gui/table.html b/src/app/design/gui/table.html index 89932eb1..c46410f9 100644 --- a/src/app/design/gui/table.html +++ b/src/app/design/gui/table.html @@ -1,51 +1,56 @@
-
+
-
- -
-
+
- +
- - -
- -
-
+ +
- +
- - - - + + diff --git a/src/app/order/list.controller.js b/src/app/order/list.controller.js index 8b6a4436..2939df2b 100644 --- a/src/app/order/list.controller.js +++ b/src/app/order/list.controller.js @@ -1,173 +1,165 @@ -angular.module("orderModule") - -.controller("orderListController", [ -"$rootScope", -"$scope", -"$location", -"$routeParams", -"$q", -"$dashboardListService", -"$orderApiService", -"COUNT_ITEMS_PER_PAGE", -function ($rootScope, $scope, $location, $routeParams, $q, DashboardListService, $orderApiService, COUNT_ITEMS_PER_PAGE) { - var getOrdersList, serviceList, getOrderCount, getAttributeList, showColumns; - serviceList = new DashboardListService(); - showColumns = { - _id : {type: 'select-link', label : 'Order ID', filter: 'text'}, - status : {}, - customer_email : {}, - customer_name : {}, - grand_total : {label : 'Total', filter : 'range', type : 'price'}, - created_at : {label : 'Date', type : 'date'} - }; - - // REFACTOR: I only want to work with the selected ids - // instead of an object of ids where the value was the selected state - $scope.selectedIds = []; - $scope.idsSelectedRows = {}; - $scope.$watch('idsSelectedRows', function(newVal, oldVal){ - var ids = []; - angular.forEach($scope.idsSelectedRows, function(active, id) { - if (active) { - ids.push(id); +angular.module('orderModule') + +.controller('orderListController', [ + '$scope', + '$location', + '$dashboardListService', + '$orderApiService', + function( + $scope, + $location, + DashboardListService, + $orderApiService + ) { + + var serviceList = new DashboardListService(); + var showColumns = { + _id: { + type: 'select-link', + label: 'Order ID', + filter: 'text' + }, + status: {}, + customer_email: {}, + customer_name: {}, + grand_total: { + label: 'Total', + filter: 'range', + type: 'price' + }, + created_at: { + label: 'Date', + type: 'date' } - }); - $scope.selectedIds = ids; - }, true); - - /** - * Gets list of orders - */ - getOrdersList = function () { - var params = $location.search(); - params["extra"] = serviceList.getExtraFields(); - - $orderApiService.orderList(params).$promise.then( - function (response) { - var result = response.result || []; - $scope.orders = serviceList.getList(result) - } - ); - }; - - getOrderCount = function() { - $orderApiService.getCount($location.search(), {}).$promise.then( - function (response) { - if (response.error === null) { - $scope.count = response.result; - } else { - $scope.count = 0; - } - } - ); - }; - - getAttributeList = function() { - $orderApiService.getAttributes().$promise.then( - function (response) { - var result = response.result || []; - serviceList.init('orders'); - $scope.attributes = result; - serviceList.setAttributes($scope.attributes); - $scope.fields = serviceList.getFields(showColumns); - getOrdersList(); + }; + + var searchDefaults = { + status: 'pending,new', + sort: '^created_at', + limit: '0,50', + }; + + // REFACTOR: I only want to work with the selected ids + // instead of an object of ids where the value was the selected state + $scope.selectedIds = []; + $scope.idsSelectedRows = {}; + + $scope.actions = { + isOpen: false, + export: angular.appConfigValue('general.app.foundation_url') + '/export/quickbooks', + printUrl: printUrl, + packingSlipUrl: packingSlipUrl, + }; + + $scope.tabs = { + isActive: isTabActive, + setStatus: setStatusFilter, + processedCount: 0, + }; + + $scope.select = select; + $scope.create = create; + + activate(); + + /////////////////////////////////////// + + function activate() { + $scope.$watch('idsSelectedRows', function(newVal, oldVal) { + var ids = []; + angular.forEach($scope.idsSelectedRows, function(active, id) { + if (active) { + ids.push(id); + } + }); + $scope.selectedIds = ids; + }, true); + + setSearchDefaults(); + + getOrderCount(); + getAttributeList(); + getProcessedOrderCount(); + } + + function setSearchDefaults() { + if (JSON.stringify({}) === JSON.stringify($location.search())) { + $location.search(searchDefaults).replace(); } - ); - }; - - /** - * Handler event when selecting the order in the list - * - * @param id - */ - $scope.select = function (id) { - $location.path("/orders/" + id).search(''); - }; - - /** - * - */ - $scope.create = function () { - $location.path("/orders/new"); - }; - - var hasSelectedRows = function () { - return $scope.selectedIds.length; - }; - - - $scope.actions = { - isOpen: false, - export: angular.appConfigValue('general.app.foundation_url') +'/export/quickbooks' - }; - - $scope.actions.printUrl = function() { - return '/orders/print?ids=' + $scope.selectedIds.join(','); - } + } - $scope.actions.packingSlipUrl = function() { - return '/orders/print?price=0&ids=' + $scope.selectedIds.join(','); - } + function getOrdersList() { + var params = $location.search(); + params.extra = serviceList.getExtraFields(); - /** - * Removes order by ID - * - */ - $scope.remove = function () { - if (!hasSelectedRows()) { - return true; + $orderApiService.orderList(params).$promise + .then(function(response) { + var result = response.result || []; + $scope.orders = serviceList.getList(result); + }); } - var i, answer, _remove; - answer = window.confirm("You really want to remove this order(s)?"); - _remove = function (id) { - var defer = $q.defer(); - - $orderApiService.remove({"orderID": id}, - function (response) { - if (response.result === "ok") { - defer.resolve(id); - } else { - defer.resolve(false); - } + function getProcessedOrderCount() { + var params = {}; + angular.copy(searchDefaults, params); + params.status = 'processed'; + + $orderApiService.getCount(params).$promise + .then(function(response) { + $scope.tabs.processedCount = response.result || 0; + }); + } + + function getOrderCount() { + $orderApiService.getCount($location.search()).$promise + .then(function(response) { + $scope.count = (response.error === null) ? response.result : 0; + }); + } + + function getAttributeList() { + $orderApiService.getAttributes().$promise.then( + function(response) { + var result = response.result || []; + serviceList.init('orders'); + $scope.attributes = result; + serviceList.setAttributes($scope.attributes); + $scope.fields = serviceList.getFields(showColumns); + getOrdersList(); } ); + } - return defer.promise; - }; - if (answer) { - $('[ng-click="parent.remove()"]').addClass('disabled').append('').siblings('.btn').addClass('disabled'); - var callback = function (response) { - if (response) { - for (i = 0; i < $scope.orders.length; i += 1) { - if ($scope.orders[i].ID === response) { - $scope.orders.splice(i, 1); - } - } - } - }; - for (var id in $scope.idsSelectedRows) { - if ($scope.idsSelectedRows.hasOwnProperty(id) && true === $scope.idsSelectedRows[id]) { - _remove(id).then(callback); - } - } + function select(id) { + $location.path('/orders/' + id).search(''); + } + + function create() { + $location.path('/orders/new'); } - $('[ng-click="parent.remove()"]').removeClass('disabled').children('i').remove(); - $('[ng-click="parent.remove()"]').siblings('.btn').removeClass('disabled'); - }; + function hasSelectedRows() { + return $scope.selectedIds.length; + } + function printUrl() { + return '/orders/print?ids=' + $scope.selectedIds.join(','); + } - $scope.init = (function () { - // test if it is an empty object - if (JSON.stringify({}) === JSON.stringify($location.search())) { - $location.search({ - sort: '^created_at', - limit: '0,50' - }).replace(); - return; + function packingSlipUrl() { + return '/orders/print?price=0&ids=' + $scope.selectedIds.join(','); } - getOrderCount(); - getAttributeList(); - })(); -}]); + + function isTabActive(compareStatus) { + var search = $location.search(); + return compareStatus === search.status; + } + + function setStatusFilter(newStatus) { + // Use the default search params as a starting point + searchDefaults.status = newStatus; + $location.search(searchDefaults); + } + } +]); + diff --git a/src/app/order/list.html b/src/app/order/list.html index 42ac87b8..fcd9f07c 100644 --- a/src/app/order/list.html +++ b/src/app/order/list.html @@ -1,4 +1,41 @@ - + @@ -69,8 +69,8 @@

Visits

- - + + From cbe1281b53041952488827068881363e93a9dd3d Mon Sep 17 00:00:00 2001 From: Adam Knox Date: Tue, 22 Mar 2016 07:07:50 -0700 Subject: [PATCH 06/16] Close ottemo/dashboard#263: config form presentation tweaks. --- .../config/directives/guiConfigEditorForm.js | 30 ++++++------ src/app/config/gui/configEditorForm.html | 35 ++++++++------ src/app/design/gui/formBuilder.html | 47 +++++++++++++++---- 3 files changed, 73 insertions(+), 39 deletions(-) diff --git a/src/app/config/directives/guiConfigEditorForm.js b/src/app/config/directives/guiConfigEditorForm.js index 385ec37e..9f1c0a57 100644 --- a/src/app/config/directives/guiConfigEditorForm.js +++ b/src/app/config/directives/guiConfigEditorForm.js @@ -41,22 +41,22 @@ angular.module("designModule") }; 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; - } + // 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); - } - } + // return 0; + // }; + // for (tab in $scope.attributeGroups) { + // if ($scope.attributeGroups.hasOwnProperty(tab)) { + // $scope.attributeGroups[tab].sort(sortByLabel); + // } + // } }; updateAttributes = function () { diff --git a/src/app/config/gui/configEditorForm.html b/src/app/config/gui/configEditorForm.html index 775508fb..e84d27b2 100644 --- a/src/app/config/gui/configEditorForm.html +++ b/src/app/config/gui/configEditorForm.html @@ -1,21 +1,26 @@
- - -
-
- -
+ -
-
-
Save
+ +
+ +
+
+ +
+
+
+
+
Save
+
diff --git a/src/app/design/gui/formBuilder.html b/src/app/design/gui/formBuilder.html index 9eec7f0f..6c52df2d 100644 --- a/src/app/design/gui/formBuilder.html +++ b/src/app/design/gui/formBuilder.html @@ -9,8 +9,17 @@
- - + + +

This field is required.

@@ -39,10 +48,21 @@
- - + + +

This field is required.

@@ -126,9 +146,18 @@
- - + + +

This field is required.

From 39482717ec598450cb7a08e52382e2c75407a0d4 Mon Sep 17 00:00:00 2001 From: Adam Knox Date: Tue, 22 Mar 2016 07:17:43 -0700 Subject: [PATCH 07/16] Close ottemo/dashboard#252: [#114515715] refactor getTemplate and getImage code. --- config/kg-prod.json | 2 +- config/mp-prod.json | 2 +- config/mp-staging.json | 2 +- config/rk-prod.json | 2 +- config/rk-staging.json | 2 +- .../config/directives/guiConfigEditorForm.js | 4 +- src/app/dashboard/controllers.js | 2 +- .../design/{service/api.js => api.service.js} | 0 .../editor/guiArrayModelSelector.js | 7 +-- .../design/directives/editor/guiBoolean.js | 56 +++++++++---------- .../directives/editor/guiCategorySelector.js | 5 +- .../design/directives/editor/guiDatetime.js | 4 +- src/app/design/directives/editor/guiHtml.js | 20 ++++--- .../design/directives/editor/guiJsonEditor.js | 4 +- .../directives/editor/guiModelSelector.js | 4 +- .../directives/editor/guiMultiSelect.js | 7 ++- .../directives/editor/guiMultilineText.js | 16 +++--- .../directives/editor/guiNotEditable.js | 18 +++--- .../directives/editor/guiPageSelector.js | 5 +- .../design/directives/editor/guiPassword.js | 12 ++-- .../directives/editor/guiPictureManager.js | 10 ++-- src/app/design/directives/editor/guiPrice.js | 30 +++++----- .../directives/editor/guiProductSelector.js | 10 ++-- .../directives/editor/guiProductsSelector.js | 11 ++-- src/app/design/directives/editor/guiSelect.js | 6 +- src/app/design/directives/editor/guiText.js | 19 +++---- .../directives/editor/guiVisitorSelector.js | 8 +-- .../design/directives/filter/guiDateRange.js | 4 +- src/app/design/directives/filter/guiSelect.js | 7 ++- src/app/design/directives/filter/guiText.js | 7 ++- .../directives/guiAttributesEditorForm.js | 7 ++- .../directives/guiAttributesEditorFormTabs.js | 8 +-- src/app/design/directives/guiFormBuilder.js | 27 ++++----- src/app/design/directives/guiInputFile.js | 17 +++--- src/app/design/directives/guiListManager.js | 7 +-- .../design/directives/guiMessageManager.js | 28 +++++----- src/app/design/directives/guiPaginator.js | 52 +++++++++-------- src/app/design/directives/guiTableManager.js | 10 ++-- .../design/directives/guiTableManagerPopup.js | 9 +-- src/app/design/image.service.js | 19 +++++++ src/app/design/init.js | 12 +--- src/app/design/service/design.js | 15 ----- src/app/design/service/image.js | 30 ---------- src/app/index.html | 4 +- src/app/login/login.html | 3 +- src/app/login/service/login.js | 3 +- src/app/product/controller/edit.js | 2 +- .../directive/guiCustomOptionsManager.js | 4 +- 48 files changed, 253 insertions(+), 290 deletions(-) rename src/app/design/{service/api.js => api.service.js} (100%) create mode 100644 src/app/design/image.service.js delete mode 100644 src/app/design/service/design.js delete mode 100644 src/app/design/service/image.js diff --git a/config/kg-prod.json b/config/kg-prod.json index 6134cae1..25b05f3b 100644 --- a/config/kg-prod.json +++ b/config/kg-prod.json @@ -1,6 +1,6 @@ { "useStrict" : "", "apiUrl" : "https://api.karigran.com", - "mediaPath" : "media/", + "mediaPath" : "https://karigran.com/media/", "itemsPerPage" : "15" } diff --git a/config/mp-prod.json b/config/mp-prod.json index f6dfac55..2bd40bac 100644 --- a/config/mp-prod.json +++ b/config/mp-prod.json @@ -1,6 +1,6 @@ { "useStrict" : "", "apiUrl" : "https://api.poconovapes.com", - "mediaPath" : "media/", + "mediaPath" : "https://poconovapes.com/media/", "itemsPerPage" : "15" } \ No newline at end of file diff --git a/config/mp-staging.json b/config/mp-staging.json index 54833507..28418235 100644 --- a/config/mp-staging.json +++ b/config/mp-staging.json @@ -1,6 +1,6 @@ { "useStrict" : "use strict", - "apiUrl" : "http://api.mp.staging.ottemo.io", + "apiUrl" : "http://api.mp.staging.ottemo.io", "mediaPath" : "http://mp.staging.ottemo.io/media/", "itemsPerPage" : "15" } \ No newline at end of file diff --git a/config/rk-prod.json b/config/rk-prod.json index 68b68dbe..e316d4bf 100644 --- a/config/rk-prod.json +++ b/config/rk-prod.json @@ -1,6 +1,6 @@ { "useStrict" : "", "apiUrl" : "https://api.richkidsbrand.com", - "mediaPath" : "media/", + "mediaPath" : "https://richkidsbrand.com/media/", "itemsPerPage" : "15" } diff --git a/config/rk-staging.json b/config/rk-staging.json index 463cf38b..66113338 100644 --- a/config/rk-staging.json +++ b/config/rk-staging.json @@ -1,6 +1,6 @@ { "useStrict" : "use strict", - "apiUrl" : "http://api.rk.staging.ottemo.io", + "apiUrl" : "http://api.rk.staging.ottemo.io", "mediaPath" : "http://rk.staging.ottemo.io/media/", "itemsPerPage" : "15" } diff --git a/src/app/config/directives/guiConfigEditorForm.js b/src/app/config/directives/guiConfigEditorForm.js index 9f1c0a57..64aaefe8 100644 --- a/src/app/config/directives/guiConfigEditorForm.js +++ b/src/app/config/directives/guiConfigEditorForm.js @@ -3,7 +3,7 @@ angular.module("designModule") /** * Directive used for automatic attributes editor form creation */ -.directive("guiConfigEditorForm", ["$designService", function ($designService) { +.directive("guiConfigEditorForm", [function () { return { restrict: "E", scope: { @@ -11,7 +11,7 @@ angular.module("designModule") "item": "=item", "attributes": "=attributesList" }, - templateUrl: $designService.getTemplate("config/gui/configEditorForm.html"), + templateUrl: "/views/config/gui/configEditorForm.html", controller: function ($scope) { var updateAttributes, addTab, addFields, sortFieldsInGroups; diff --git a/src/app/dashboard/controllers.js b/src/app/dashboard/controllers.js index 95a65ef2..f72054fc 100644 --- a/src/app/dashboard/controllers.js +++ b/src/app/dashboard/controllers.js @@ -203,7 +203,7 @@ angular.module("dashboardModule") //TODO: delete this when images are attached to products function getProductImage(image) { - return $designImageService.getFullImagePath("", image); + return $designImageService.getImage(image); }; } diff --git a/src/app/design/service/api.js b/src/app/design/api.service.js similarity index 100% rename from src/app/design/service/api.js rename to src/app/design/api.service.js diff --git a/src/app/design/directives/editor/guiArrayModelSelector.js b/src/app/design/directives/editor/guiArrayModelSelector.js index 9aa5f0af..cd2aa98e 100644 --- a/src/app/design/directives/editor/guiArrayModelSelector.js +++ b/src/app/design/directives/editor/guiArrayModelSelector.js @@ -3,13 +3,12 @@ angular.module("designModule") * Directive used for automatic attribute editor creation */ .directive("guiArrayModelSelector", [ - "$designService", "$designApiService", "$designImageService", - function ($designService, $designApiService, $designImageService) { + function ($designApiService, $designImageService) { return { restrict: "E", - templateUrl: $designService.getTemplate("design/gui/editor/arrayModelSelector.html"), + templateUrl: "/views/design/gui/editor/arrayModelSelector.html", scope: { "attribute": "=editorScope", @@ -170,7 +169,7 @@ angular.module("designModule") * @returns {string} - full path to image */ $scope.getImage = function (image) { - return $designImageService.getFullImagePath("", image); + return $designImageService.getImage(image); }; } diff --git a/src/app/design/directives/editor/guiBoolean.js b/src/app/design/directives/editor/guiBoolean.js index 22171556..1f1e6f74 100644 --- a/src/app/design/directives/editor/guiBoolean.js +++ b/src/app/design/directives/editor/guiBoolean.js @@ -1,36 +1,36 @@ -angular.module("designModule") +angular.module('designModule') -.directive("guiBoolean", ["$designService", function($designService) { - return { - restrict: "E", - templateUrl: $designService.getTemplate("design/gui/editor/select.html"), +.directive('guiBoolean', [function() { + return { + restrict: 'E', + templateUrl: '/views/design/gui/editor/select.html', - scope: { - "attribute": "=editorScope", - "item": "=item" - }, + scope: { + 'attribute': '=editorScope', + 'item': '=item' + }, - controller: function($scope) { - $scope.options = [{ - Id: false, - Name: "false" - }, { - Id: true, - Name: "true" - }]; + controller: function($scope) { + $scope.options = [{ + Id: false, + Name: 'false' + }, { + Id: true, + Name: 'true' + }]; - $scope.$watch("item", init); - $scope.$watch("attribute", init); + $scope.$watch('item', init); + $scope.$watch('attribute', init); - function init() { - if (typeof $scope.attribute === "undefined" || - typeof $scope.item === "undefined" - ) { - return false; - } - } + function init() { + if (typeof $scope.attribute === 'undefined' || + typeof $scope.item === 'undefined' + ) { + return false; + } + } - } - }; + } + }; }]); diff --git a/src/app/design/directives/editor/guiCategorySelector.js b/src/app/design/directives/editor/guiCategorySelector.js index 032284f6..b479285c 100644 --- a/src/app/design/directives/editor/guiCategorySelector.js +++ b/src/app/design/directives/editor/guiCategorySelector.js @@ -5,10 +5,9 @@ angular.module("designModule") .directive("guiCategorySelector", [ "$location", "$routeParams", - "$designService", "$dashboardListService", "$categoryApiService", - function ($location, $routeParams, $designService, DashboardListService, $categoryApiService) { + function ($location, $routeParams, DashboardListService, $categoryApiService) { var serviceList = new DashboardListService(), showColumns; showColumns = { 'name' : {'type' : 'select-link', 'label' : 'Name'}, @@ -17,7 +16,7 @@ angular.module("designModule") return { restrict: "E", - templateUrl: $designService.getTemplate("design/gui/editor/categorySelector.html"), + templateUrl: "/views/design/gui/editor/categorySelector.html", scope: { "attribute": "=editorScope", diff --git a/src/app/design/directives/editor/guiDatetime.js b/src/app/design/directives/editor/guiDatetime.js index 736524c3..78662672 100644 --- a/src/app/design/directives/editor/guiDatetime.js +++ b/src/app/design/directives/editor/guiDatetime.js @@ -3,14 +3,14 @@ angular.module("designModule") * Directive used for automatic attribute editor creation */ -.directive("guiDatetime", ["$designService", function ($designService) { +.directive("guiDatetime", [function () { return { restrict: "E", scope: { "attribute": "=editorScope", "item": "=item" }, - templateUrl: $designService.getTemplate("design/gui/editor/datetime.html"), + templateUrl: "/views/design/gui/editor/datetime.html", controller: [ "$scope", diff --git a/src/app/design/directives/editor/guiHtml.js b/src/app/design/directives/editor/guiHtml.js index d5b68f59..544f8a2c 100644 --- a/src/app/design/directives/editor/guiHtml.js +++ b/src/app/design/directives/editor/guiHtml.js @@ -1,14 +1,16 @@ -angular.module("designModule") /** -* Directive used for automatic attribute editor creation -*/ -.directive("guiHtml", ["$designService", function ($designService) { + * Directive used for automatic attribute editor creation + */ +angular.module('designModule') + +.directive('guiHtml', [function() { return { - restrict: "E", + restrict: 'E', scope: { - "attribute": "=editorScope", - "item": "=item" + 'attribute': '=editorScope', + 'item': '=item' }, - templateUrl: $designService.getTemplate("design/gui/editor/html.html") + templateUrl: '/views/design/gui/editor/html.html' }; -}]); \ No newline at end of file +}]); + diff --git a/src/app/design/directives/editor/guiJsonEditor.js b/src/app/design/directives/editor/guiJsonEditor.js index 863125c9..e746efb0 100644 --- a/src/app/design/directives/editor/guiJsonEditor.js +++ b/src/app/design/directives/editor/guiJsonEditor.js @@ -2,13 +2,13 @@ angular.module("designModule") /** * Directive used for automatic attribute editor creation */ -.directive("guiJsonEditor", ["$designService", function ($designService) { +.directive("guiJsonEditor", [function () { return { restrict: "E", scope: { "data": "=data" }, - templateUrl: $designService.getTemplate("design/gui/editor/json.html"), + templateUrl: "/views/design/gui/editor/json.html", controller: ["$scope", function ($scope) { $scope.items = [ diff --git a/src/app/design/directives/editor/guiModelSelector.js b/src/app/design/directives/editor/guiModelSelector.js index 5e15b424..5baac23c 100644 --- a/src/app/design/directives/editor/guiModelSelector.js +++ b/src/app/design/directives/editor/guiModelSelector.js @@ -3,10 +3,10 @@ angular.module("designModule") /** * Directive used for automatic attribute editor creation */ - .directive("guiModelSelector", ["$designService", "$designApiService", function ($designService, $designApiService) { + .directive("guiModelSelector", ["$designApiService", function ($designApiService) { return { restrict: "E", - templateUrl: $designService.getTemplate("design/gui/editor/modelSelector.html"), + templateUrl: "/views/design/gui/editor/modelSelector.html", scope: { "attribute": "=editorScope", diff --git a/src/app/design/directives/editor/guiMultiSelect.js b/src/app/design/directives/editor/guiMultiSelect.js index 4b9999db..af33f849 100644 --- a/src/app/design/directives/editor/guiMultiSelect.js +++ b/src/app/design/directives/editor/guiMultiSelect.js @@ -1,11 +1,12 @@ -angular.module("designModule") /** * Directive used for automatic attribute editor creation */ -.directive("guiMultiSelect", ["$designService", function ($designService) { +angular.module("designModule") + +.directive("guiMultiSelect", [function () { return { restrict: "E", - templateUrl: $designService.getTemplate("design/gui/editor/multi-select.html"), + templateUrl: "/views/design/gui/editor/multi-select.html", scope: { "attribute": "=editorScope", diff --git a/src/app/design/directives/editor/guiMultilineText.js b/src/app/design/directives/editor/guiMultilineText.js index 90a96c75..3827c0cb 100644 --- a/src/app/design/directives/editor/guiMultilineText.js +++ b/src/app/design/directives/editor/guiMultilineText.js @@ -1,14 +1,16 @@ -angular.module("designModule") /** * Directive used for automatic attribute editor creation */ -.directive("guiMultilineText", ["$designService", function ($designService) { +angular.module('designModule') + +.directive('guiMultilineText', [function() { return { - restrict: "E", + restrict: 'E', scope: { - "attribute": "=editorScope", - "item": "=item" + 'attribute': '=editorScope', + 'item': '=item' }, - templateUrl: $designService.getTemplate("design/gui/editor/multilineText.html") + templateUrl: '/views/design/gui/editor/multilineText.html' }; -}]); \ No newline at end of file +}]); + diff --git a/src/app/design/directives/editor/guiNotEditable.js b/src/app/design/directives/editor/guiNotEditable.js index a30813ab..96db767a 100644 --- a/src/app/design/directives/editor/guiNotEditable.js +++ b/src/app/design/directives/editor/guiNotEditable.js @@ -1,18 +1,20 @@ -angular.module("designModule") /** * Directive used for automatic attribute editor creation */ -.directive("guiNotEditable", ["$designService", function ($designService) { +angular.module('designModule') + +.directive('guiNotEditable', [function() { return { - restrict: "E", + restrict: 'E', scope: { - "attribute": "=editorScope", - "item": "=item" + 'attribute': '=editorScope', + 'item': '=item' }, - templateUrl: $designService.getTemplate("design/gui/editor/notEditable.html"), + templateUrl: '/views/design/gui/editor/notEditable.html', - controller: ["$scope", function() { + controller: ['$scope', function() { }] }; -}]); \ No newline at end of file +}]); + diff --git a/src/app/design/directives/editor/guiPageSelector.js b/src/app/design/directives/editor/guiPageSelector.js index a064cdd6..a10b7662 100644 --- a/src/app/design/directives/editor/guiPageSelector.js +++ b/src/app/design/directives/editor/guiPageSelector.js @@ -5,10 +5,9 @@ angular.module("designModule") .directive("guiPageSelector", [ "$location", "$routeParams", - "$designService", "$dashboardListService", "$cmsApiService", - function ($location, $routeParams, $designService, DashboardListService, $cmsApiService) { + function ($location, $routeParams, DashboardListService, $cmsApiService) { var serviceList = new DashboardListService(), showColumns; showColumns = { 'identifier' : {'type' : 'select-link'}, @@ -18,7 +17,7 @@ angular.module("designModule") return { restrict: "E", - templateUrl: $designService.getTemplate("design/gui/editor/pageSelector.html"), + templateUrl: "/views/design/gui/editor/pageSelector.html", scope: { "attribute": "=editorScope", diff --git a/src/app/design/directives/editor/guiPassword.js b/src/app/design/directives/editor/guiPassword.js index 5c32778a..65b51c5f 100644 --- a/src/app/design/directives/editor/guiPassword.js +++ b/src/app/design/directives/editor/guiPassword.js @@ -1,13 +1,13 @@ -angular.module("designModule") +angular.module('designModule') -.directive("guiPassword", ["$designService", function($designService) { +.directive('guiPassword', [function() { return { - restrict: "EA", + restrict: 'EA', scope: { - "attribute": "=editorScope", - "item": "=item" + 'attribute': '=editorScope', + 'item': '=item' }, - templateUrl: $designService.getTemplate("design/gui/editor/password.html") + templateUrl: '/views/design/gui/editor/password.html' }; }]); diff --git a/src/app/design/directives/editor/guiPictureManager.js b/src/app/design/directives/editor/guiPictureManager.js index e2e83cf6..c66cbe48 100644 --- a/src/app/design/directives/editor/guiPictureManager.js +++ b/src/app/design/directives/editor/guiPictureManager.js @@ -1,12 +1,12 @@ -angular.module("designModule") /** * Directive used for automatic attribute editor creation */ -.directive("guiPictureManager", ["$designService", "$designImageService", function ($designService, $designImageService) { +angular.module("designModule") + +.directive("guiPictureManager", ["$designImageService", function ($designImageService) { return { restrict: "E", -// transclude: true, - templateUrl: $designService.getTemplate("design/gui/editor/pictureManager.html"), + templateUrl: "/views/design/gui/editor/pictureManager.html", scope: { "parent": "=parent", @@ -44,7 +44,7 @@ angular.module("designModule") }); $scope.getImage = function (filename) { - return $designImageService.getFullImagePath($scope.imagesPath, filename); + return $designImageService.getImage($scope.imagesPath + filename); }; $scope.selectImage = function (filename) { diff --git a/src/app/design/directives/editor/guiPrice.js b/src/app/design/directives/editor/guiPrice.js index 0a5019b6..7af82490 100644 --- a/src/app/design/directives/editor/guiPrice.js +++ b/src/app/design/directives/editor/guiPrice.js @@ -1,24 +1,25 @@ -angular.module("designModule") /** -* Directive used for automatic attribute editor creation -*/ -.directive("guiPrice", ["$designService", function ($designService) { + * Directive used for automatic attribute editor creation + */ +angular.module('designModule') + +.directive('guiPrice', [function() { return { - restrict: "E", + restrict: 'E', scope: { - "attribute": "=editorScope", - "item": "=item" + 'attribute': '=editorScope', + 'item': '=item' }, - templateUrl: $designService.getTemplate("design/gui/editor/text.html"), + templateUrl: '/views/design/gui/editor/text.html', - controller: ["$scope", function ($scope) { + controller: ['$scope', function($scope) { - var priceRegExp = new RegExp("^\\d*\\.*\\d{0,2}$", ""); + var priceRegExp = new RegExp("^\\d*\\.*\\d{0,2}$", ''); - $scope.$watch("item", function (newVal, oldVal) { + $scope.$watch('item', function(newVal, oldVal) { - if(typeof newVal[$scope.attribute.Attribute] === "undefined") { - newVal[$scope.attribute.Attribute] = ""; + if (typeof newVal[$scope.attribute.Attribute] === 'undefined') { + newVal[$scope.attribute.Attribute] = ''; } else if (!priceRegExp.test(newVal[$scope.attribute.Attribute])) { newVal[$scope.attribute.Attribute] = oldVal[$scope.attribute.Attribute]; } @@ -26,4 +27,5 @@ angular.module("designModule") }, true); }] }; -}]); \ No newline at end of file +}]); + diff --git a/src/app/design/directives/editor/guiProductSelector.js b/src/app/design/directives/editor/guiProductSelector.js index 28adcd89..bc5b1042 100644 --- a/src/app/design/directives/editor/guiProductSelector.js +++ b/src/app/design/directives/editor/guiProductSelector.js @@ -1,16 +1,16 @@ -angular.module("designModule") /** * Directive used for automatic attribute editor creation */ +angular.module("designModule") + .directive("guiProductSelector", [ "$location", "$routeParams", -"$designService", "$dashboardListService", "$productApiService", "$designImageService", "COUNT_ITEMS_PER_PAGE", -function ($location, $routeParams, $designService, DashboardListService, $productApiService, $designImageService, COUNT_ITEMS_PER_PAGE) { +function ($location, $routeParams, DashboardListService, $productApiService, $designImageService, COUNT_ITEMS_PER_PAGE) { var serviceList = new DashboardListService(), showColumns; showColumns = { 'name' : {'type' : 'select-link', 'label' : 'Name'}, @@ -21,7 +21,7 @@ function ($location, $routeParams, $designService, DashboardListService, $produc return { restrict: "E", - templateUrl: $designService.getTemplate("design/gui/editor/productSelector.html"), + templateUrl: "/views/design/gui/editor/productSelector.html", scope: { "attribute": "=editorScope", @@ -208,7 +208,7 @@ function ($location, $routeParams, $designService, DashboardListService, $produc * @returns {string} - full path to image */ $scope.getImage = function (image) { - return $designImageService.getFullImagePath("", image); + return $designImageService.getImage(image); }; $scope.expand = function () { diff --git a/src/app/design/directives/editor/guiProductsSelector.js b/src/app/design/directives/editor/guiProductsSelector.js index 4a193bd2..ca77aa1b 100644 --- a/src/app/design/directives/editor/guiProductsSelector.js +++ b/src/app/design/directives/editor/guiProductsSelector.js @@ -1,17 +1,16 @@ -angular.module("designModule") - /** * Directive used for automatic attribute editor creation */ +angular.module("designModule") + .directive("guiProductsSelector", [ "$location", "$routeParams", -"$designService", "$dashboardListService", "$productApiService", "$designImageService", "COUNT_ITEMS_PER_PAGE", -function ($location, $routeParams, $designService, DashboardListService, $productApiService, $designImageService, COUNT_ITEMS_PER_PAGE) { +function ($location, $routeParams, DashboardListService, $productApiService, $designImageService, COUNT_ITEMS_PER_PAGE) { var serviceList = new DashboardListService(), showColumns; showColumns = { 'name' : {'type' : 'select-link', 'label' : 'Name'}, @@ -22,7 +21,7 @@ function ($location, $routeParams, $designService, DashboardListService, $produc return { restrict: "E", - templateUrl: $designService.getTemplate("design/gui/editor/productsSelector.html"), + templateUrl: "/views/design/gui/editor/productsSelector.html", scope: { "attribute": "=editorScope", @@ -196,7 +195,7 @@ function ($location, $routeParams, $designService, DashboardListService, $produc * @returns {string} - full path to image */ $scope.getImage = function (image) { - return $designImageService.getFullImagePath("", image); + return $designImageService.getImage(image); }; $scope.expand = function () { diff --git a/src/app/design/directives/editor/guiSelect.js b/src/app/design/directives/editor/guiSelect.js index 8a0c6172..9c53c171 100644 --- a/src/app/design/directives/editor/guiSelect.js +++ b/src/app/design/directives/editor/guiSelect.js @@ -1,12 +1,12 @@ -angular.module("designModule") /** * Directive used for automatic attribute editor creation */ +angular.module("designModule") -.directive("guiSelect", ["$designService", function ($designService) { +.directive("guiSelect", [function () { return { restrict: "E", - templateUrl: $designService.getTemplate("design/gui/editor/select.html"), + templateUrl: "/views/design/gui/editor/select.html", scope: { "attribute": "=editorScope", diff --git a/src/app/design/directives/editor/guiText.js b/src/app/design/directives/editor/guiText.js index e9213c3e..8cf401e8 100644 --- a/src/app/design/directives/editor/guiText.js +++ b/src/app/design/directives/editor/guiText.js @@ -1,19 +1,18 @@ -angular.module("designModule") - /** * Directive used for automatic attribute editor creation */ +angular.module('designModule') -.directive("guiText", ["$designService", function ($designService) { +.directive('guiText', [function() { return { - restrict: "E", + restrict: 'E', scope: { - "attribute": "=editorScope", - "item": "=item" + 'attribute': '=editorScope', + 'item': '=item' }, - templateUrl: $designService.getTemplate("design/gui/editor/text.html"), + templateUrl: '/views/design/gui/editor/text.html', - controller: ["$scope", function() { - }] + controller: ['$scope', function() {}] }; -}]); \ No newline at end of file +}]); + diff --git a/src/app/design/directives/editor/guiVisitorSelector.js b/src/app/design/directives/editor/guiVisitorSelector.js index 738cd644..848f0d09 100644 --- a/src/app/design/directives/editor/guiVisitorSelector.js +++ b/src/app/design/directives/editor/guiVisitorSelector.js @@ -1,16 +1,16 @@ -angular.module("designModule") /** * Directive used for automatic attribute editor creation */ +angular.module("designModule") + .directive("guiVisitorSelector", [ "$location", "$routeParams", -"$designService", "$dashboardListService", "$visitorApiService", "$designImageService", "COUNT_ITEMS_PER_PAGE", -function ($location, $routeParams, $designService, DashboardListService, $visitorApiService, $designImageService, COUNT_ITEMS_PER_PAGE) { +function ($location, $routeParams, DashboardListService, $visitorApiService, $designImageService, COUNT_ITEMS_PER_PAGE) { var serviceList = new DashboardListService(), showColumns; showColumns = { 'name' : {'type' : 'select-link', 'label' : 'Name'}, @@ -22,7 +22,7 @@ function ($location, $routeParams, $designService, DashboardListService, $visito return { restrict: "E", - templateUrl: $designService.getTemplate("design/gui/editor/visitorSelector.html"), + templateUrl: "/views/design/gui/editor/visitorSelector.html", scope: { "attribute": "=editorScope", diff --git a/src/app/design/directives/filter/guiDateRange.js b/src/app/design/directives/filter/guiDateRange.js index 6fcf1485..1e6dcd84 100644 --- a/src/app/design/directives/filter/guiDateRange.js +++ b/src/app/design/directives/filter/guiDateRange.js @@ -1,6 +1,6 @@ angular.module("designModule") -.directive("guiFilterDateRange", ["$designService", function($designService) { +.directive("guiFilterDateRange", [function() { return { restrict: "E", scope: { @@ -8,7 +8,7 @@ angular.module("designModule") "attribute": "=editorScope", "item": "=item" }, - templateUrl: $designService.getTemplate("design/gui/filter/dateRange.html"), + templateUrl: "/views/design/gui/filter/dateRange.html", controller: ["$scope", function($scope) { $scope.highInvalid = false; diff --git a/src/app/design/directives/filter/guiSelect.js b/src/app/design/directives/filter/guiSelect.js index 3a571af4..6c76ec3a 100644 --- a/src/app/design/directives/filter/guiSelect.js +++ b/src/app/design/directives/filter/guiSelect.js @@ -1,11 +1,12 @@ -angular.module("designModule") /** * Directive used for automatic attribute editor creation */ -.directive("guiFilterSelect", ["$designService", function ($designService) { +angular.module("designModule") + +.directive("guiFilterSelect", [function () { return { restrict: "E", - templateUrl: $designService.getTemplate("design/gui/filter/select.html"), + templateUrl: "/views/design/gui/filter/select.html", scope: { "parent": "=object", diff --git a/src/app/design/directives/filter/guiText.js b/src/app/design/directives/filter/guiText.js index 3e19c6bb..bdbfc8ec 100644 --- a/src/app/design/directives/filter/guiText.js +++ b/src/app/design/directives/filter/guiText.js @@ -1,8 +1,9 @@ -angular.module("designModule") /** * Directive used for automatic attribute editor creation */ -.directive("guiFilterText", ["$designService", function ($designService) { +angular.module("designModule") + +.directive("guiFilterText", [function () { return { restrict: "E", scope: { @@ -10,7 +11,7 @@ angular.module("designModule") "attribute": "=editorScope", "item": "=item" }, - templateUrl: $designService.getTemplate("design/gui/filter/text.html"), + templateUrl: "/views/design/gui/filter/text.html", controller: ["$scope", function ($scope) { diff --git a/src/app/design/directives/guiAttributesEditorForm.js b/src/app/design/directives/guiAttributesEditorForm.js index 7a83b6a6..cd58a603 100644 --- a/src/app/design/directives/guiAttributesEditorForm.js +++ b/src/app/design/directives/guiAttributesEditorForm.js @@ -1,10 +1,11 @@ -angular.module("designModule") /** * Directive used for automatic attributes editor form creation * * Form to edit as accordion */ -.directive("guiAttributesEditorForm", ["$designService", function ($designService) { +angular.module("designModule") + +.directive("guiAttributesEditorForm", [function () { return { restrict: "E", scope: { @@ -12,7 +13,7 @@ angular.module("designModule") "item": "=item", "attributes": "=attributesList" }, - templateUrl: $designService.getTemplate("design/gui/attributesEditorForm.html"), + templateUrl: "/views/design/gui/attributesEditorForm.html", controller: function ($scope) { var updateAttributes; updateAttributes = function () { diff --git a/src/app/design/directives/guiAttributesEditorFormTabs.js b/src/app/design/directives/guiAttributesEditorFormTabs.js index 63c28775..06c7c4df 100644 --- a/src/app/design/directives/guiAttributesEditorFormTabs.js +++ b/src/app/design/directives/guiAttributesEditorFormTabs.js @@ -1,11 +1,11 @@ -angular.module("designModule") - /** * Directive used for automatic attributes editor form creation * * Form to edit with tabs */ -.directive("guiAttributesEditorFormTabs", ["$designService", "$dashboardUtilsService", function ($designService, $dashboardUtilsService) { +angular.module("designModule") + +.directive("guiAttributesEditorFormTabs", ["$dashboardUtilsService", function ($dashboardUtilsService) { return { restrict: "E", scope: { @@ -13,7 +13,7 @@ angular.module("designModule") "item": "=item", "attributes": "=attributesList" }, - templateUrl: $designService.getTemplate("design/gui/attributesEditorFormTabs.html"), + templateUrl: "/views/design/gui/attributesEditorFormTabs.html", controller: function ($scope) { var updateAttributes; diff --git a/src/app/design/directives/guiFormBuilder.js b/src/app/design/directives/guiFormBuilder.js index c0d6a5fb..e325cc73 100644 --- a/src/app/design/directives/guiFormBuilder.js +++ b/src/app/design/directives/guiFormBuilder.js @@ -1,23 +1,24 @@ -angular.module("designModule") /** -* Directive used for automatic attributes editor form creation -* -*/ -.directive("guiFormBuilder", ["$designService", function ($designService) { + * Directive used for automatic attributes editor form creation + */ +angular.module('designModule') + +.directive('guiFormBuilder', [function() { return { - restrict: "E", + restrict: 'E', scope: { - "parent": "=object", - "item": "=item", - "attributes": "=attributes" + 'parent': '=object', + 'item': '=item', + 'attributes': '=attributes' }, - templateUrl: $designService.getTemplate("design/gui/formBuilder.html"), - controller: ["$scope", - function ($scope) { + templateUrl: '/views/design/gui/formBuilder.html', + controller: ['$scope', + function($scope) { if (typeof $scope.parent === 'undefined') { $scope.parent = {}; } } ] }; -}]); \ No newline at end of file +}]); + diff --git a/src/app/design/directives/guiInputFile.js b/src/app/design/directives/guiInputFile.js index a72b2fa7..ef7a82ef 100644 --- a/src/app/design/directives/guiInputFile.js +++ b/src/app/design/directives/guiInputFile.js @@ -1,9 +1,9 @@ -angular.module('designModule') - // Directive for file input value binding // Hides file input and wraps it within button element // to provide better possibilities for styling -.directive('guiInputFile', ['$designService', function ($designService) { +angular.module('designModule') + +.directive('guiInputFile', [function() { return { restrict: 'E', scope: { @@ -12,7 +12,7 @@ angular.module('designModule') 'name': '=inputName', // file input name attribute 'onChange': '&' // On change event listener }, - templateUrl: $designService.getTemplate("design/gui/inputFile.html"), + templateUrl: '/views/design/gui/inputFile.html', replace: true, transclude: true, @@ -24,7 +24,9 @@ angular.module('designModule') // Update scope.file when file input changes scope.file = event.target.files[0]; // Run onChange listener - if (scope.onChange) scope.onChange(); + if (scope.onChange) { + scope.onChange(); + } }); }); @@ -39,5 +41,6 @@ angular.module('designModule') fileInput.trigger('click'); }); } - } -}]); \ No newline at end of file + }; +}]); + diff --git a/src/app/design/directives/guiListManager.js b/src/app/design/directives/guiListManager.js index b889b2e3..80f802af 100644 --- a/src/app/design/directives/guiListManager.js +++ b/src/app/design/directives/guiListManager.js @@ -1,5 +1,3 @@ -angular.module("designModule") - /** * Directive used for automatic attributes editor form creation * @@ -19,8 +17,9 @@ angular.module("designModule") * $scope.hasImage {boolean} - Returns an indication the list has images or not * $scope.getListType {string} - Returns the necessary class for list */ +angular.module("designModule") -.directive("guiListManager", ["$designService", function ($designService) { +.directive("guiListManager", [function () { return { restrict: "E", scope: { @@ -29,7 +28,7 @@ angular.module("designModule") "addNewDisable": "=addNewDisable", "mapping": "=mapping" }, - templateUrl: $designService.getTemplate("design/gui/list.html"), + templateUrl: "/views/design/gui/list.html", controller: function ($scope) { var assignMapping = function (mapping) { diff --git a/src/app/design/directives/guiMessageManager.js b/src/app/design/directives/guiMessageManager.js index 3ac1495f..847ee54d 100644 --- a/src/app/design/directives/guiMessageManager.js +++ b/src/app/design/directives/guiMessageManager.js @@ -1,29 +1,27 @@ +angular.module('designModule') -angular.module("designModule") - -.directive("guiMessageManager", ["$designService", "$timeout", function ($designService, $timeout) { - +.directive('guiMessageManager', ['$timeout', function($timeout) { return { - restrict: "E", + restrict: 'E', scope: { - "obj": "=item" + 'obj': '=item' }, - templateUrl: $designService.getTemplate("design/gui/guiMessageManager.html"), - link: function ($scope) { + templateUrl: '/views/design/gui/guiMessageManager.html', + link: function($scope) { var timeout; $scope.isShow = false; - $scope.$watch("obj", function () { + $scope.$watch('obj', function() { - if (typeof $scope.obj !== "undefined") { + if (typeof $scope.obj !== 'undefined') { $scope.msg = $scope.obj.message; - $scope.type = $scope.obj.type || "success"; + $scope.type = $scope.obj.type || 'success'; $scope.cssClass = 'alert-' + $scope.type; $scope.isShow = true; timeout = $scope.obj.timeout; - if(timeout > 0) { - $timeout(function () { + if (timeout > 0) { + $timeout(function() { $scope.close(); }, 2000); } @@ -31,12 +29,12 @@ angular.module("designModule") }); - $scope.close = function () { + $scope.close = function() { $scope.isShow = false; $scope.msg = false; }; } }; - }]); + diff --git a/src/app/design/directives/guiPaginator.js b/src/app/design/directives/guiPaginator.js index 00fdde51..659cf350 100644 --- a/src/app/design/directives/guiPaginator.js +++ b/src/app/design/directives/guiPaginator.js @@ -3,45 +3,43 @@ * setPage(page) * getPages() */ +angular.module('designModule') -angular.module("designModule") - -.directive('guiPaginator', ['$location', '$designService', function ($location, $designService) { +.directive('guiPaginator', ['$location', function($location) { return { restrict: 'E', scope: { 'parent': '=object' }, - templateUrl: $designService.getTemplate('design/gui/paginator.html'), - controller: ["$scope", - function ($scope) { + templateUrl: '/views/design/gui/paginator.html', + controller: ['$scope', function($scope) { - var countNeighbors = 4; - $scope.leftBreak = false; - $scope.rightBreak = false; + var countNeighbors = 4; + $scope.leftBreak = false; + $scope.rightBreak = false; - $scope.isNeighbors = function (page) { - return Math.abs($scope.parent.paginator.page - page) <= countNeighbors; - }; + $scope.isNeighbors = function(page) { + return Math.abs($scope.parent.paginator.page - page) <= countNeighbors; + }; - $scope.$watch("parent.paginator.page", function () { - if (typeof $scope.parent.paginator === "undefined") { - return true; - } + $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; + var leftBorder = $scope.parent.paginator.page - countNeighbors; + var rightBorder = $scope.parent.paginator.page + countNeighbors; - if (leftBorder > 2 ) { - $scope.leftBreak = true; - } + if (leftBorder > 2) { + $scope.leftBreak = true; + } - if (rightBorder < $scope.parent.paginator.countPages - 1 ) { - $scope.rightBreak = true; - } + if (rightBorder < $scope.parent.paginator.countPages - 1) { + $scope.rightBreak = true; + } - }, true); - } - ] + }, true); + }] }; }]); + diff --git a/src/app/design/directives/guiTableManager.js b/src/app/design/directives/guiTableManager.js index 1d7d3062..66d17c93 100644 --- a/src/app/design/directives/guiTableManager.js +++ b/src/app/design/directives/guiTableManager.js @@ -1,14 +1,12 @@ -angular.module("designModule") - /** * Directive used for automatic attributes editor form creation -* */ +angular.module("designModule") + .directive("guiTableManager", [ "$location", - "$designService", "COUNT_ITEMS_PER_PAGE", - function ($location, $designService, COUNT_ITEMS_PER_PAGE) { + function ($location, COUNT_ITEMS_PER_PAGE) { return { restrict: "E", scope: { @@ -17,7 +15,7 @@ angular.module("designModule") "buttonData": "=buttons", "mapping": "=mapping" }, - templateUrl: $designService.getTemplate("design/gui/table.html"), + templateUrl: "/views/design/gui/table.html", controller: function ($scope) { // Variables var isInit, isSelectedAll, activeFilters; diff --git a/src/app/design/directives/guiTableManagerPopup.js b/src/app/design/directives/guiTableManagerPopup.js index 9758dec2..f5b88d1a 100644 --- a/src/app/design/directives/guiTableManagerPopup.js +++ b/src/app/design/directives/guiTableManagerPopup.js @@ -1,15 +1,12 @@ -angular.module("designModule") - /** * Directive used for automatic attributes editor form creation -* */ +angular.module("designModule") .directive("guiTableManagerPopup", [ "$location", - "$designService", "COUNT_ITEMS_PER_PAGE", - function ($location, $designService, COUNT_ITEMS_PER_PAGE) { + function ($location, COUNT_ITEMS_PER_PAGE) { return { restrict: "E", scope: { @@ -18,7 +15,7 @@ angular.module("designModule") "buttonData": "=buttons", "mapping": "=mapping" }, - templateUrl: $designService.getTemplate("design/gui/table-popup.html"), + templateUrl: "/views/design/gui/table-popup.html", controller: function ($scope) { // Variables var isInit, isSelectedAll, activeFilters; diff --git a/src/app/design/image.service.js b/src/app/design/image.service.js new file mode 100644 index 00000000..a565c6bb --- /dev/null +++ b/src/app/design/image.service.js @@ -0,0 +1,19 @@ +angular.module('designModule') + +.factory('$designImageService', [ + 'MEDIA_BASE_PATH', + function (MEDIA_BASE_PATH) { + + var service = { + getImage: getImage, + }; + + return service; + + //////////////////// + + function getImage(filename) { + return MEDIA_BASE_PATH + filename; + } + } +]); \ No newline at end of file diff --git a/src/app/design/init.js b/src/app/design/init.js index ed9b7b49..8c5d7d62 100644 --- a/src/app/design/init.js +++ b/src/app/design/init.js @@ -5,14 +5,4 @@ angular.module('designModule',[]) // non-angularized libs .constant('moment', window.moment) -.constant('_', window._) - -.run(['$designService', '$rootScope', function ($designService, $rootScope) { - - /** - * Global functions you can use in any angular template - */ - $rootScope.getTemplate = $designService.getTemplate; - $rootScope.getImg = $designService.getImage; - -}]); +.constant('_', window._); diff --git a/src/app/design/service/design.js b/src/app/design/service/design.js deleted file mode 100644 index 878b7545..00000000 --- a/src/app/design/service/design.js +++ /dev/null @@ -1,15 +0,0 @@ -angular.module("designModule") -/** -* $designService allows to do operations over very top HTML page -*/ -.service("$designService", [function () { - - return { - getTemplate: function (templateName) { - return '/views/' + templateName; - }, - getImage: function (img) { - return "/images/" + img; - } - } -}]); \ No newline at end of file diff --git a/src/app/design/service/image.js b/src/app/design/service/image.js deleted file mode 100644 index 6e2e7327..00000000 --- a/src/app/design/service/image.js +++ /dev/null @@ -1,30 +0,0 @@ -angular.module("designModule") -/* - * $designImageService implementation - */ -.service("$designImageService", [ - "$designService", - "MEDIA_BASE_PATH", - "PRODUCT_DEFAULT_IMG", - function ($designService, MEDIA_BASE_PATH, PRODUCT_DEFAULT_IMG) { - var getFullImagePath; - - getFullImagePath = function (path, filename) { - var src, imgRegExp; - imgRegExp = new RegExp(".gif|png|jpg|jpeg|ico$", "i"); - - if (typeof path === "undefined" || typeof filename === "undefined" || filename === "" || !imgRegExp.test(filename)) { - src = $designService.getImage(PRODUCT_DEFAULT_IMG); - } else { - src = MEDIA_BASE_PATH + path + filename; - } - - - return src; - }; - - return { - getFullImagePath: getFullImagePath - }; - } -]); \ No newline at end of file diff --git a/src/app/index.html b/src/app/index.html index 95624418..bbee72c5 100644 --- a/src/app/index.html +++ b/src/app/index.html @@ -26,7 +26,7 @@ - +
@@ -34,7 +34,7 @@
- +
diff --git a/src/app/login/login.html b/src/app/login/login.html index 5c9b4c0b..2daee8b3 100644 --- a/src/app/login/login.html +++ b/src/app/login/login.html @@ -6,8 +6,7 @@
logo + src="/images/logo-login.png">

diff --git a/src/app/login/service/login.js b/src/app/login/service/login.js index 01a4a1ed..4b84e79b 100644 --- a/src/app/login/service/login.js +++ b/src/app/login/service/login.js @@ -4,8 +4,7 @@ angular.module("loginModule") '$resource', '$loginApiService', '$q', - '$designService', - function ($resource, $loginApiService, $q, $designService) { + function ($resource, $loginApiService, $q) { /** Variables */ var login, isAdmin, isLoggedIn, deferIsLoggedIn , mapFields, deferLogOut; diff --git a/src/app/product/controller/edit.js b/src/app/product/controller/edit.js index d672c606..b939fa87 100644 --- a/src/app/product/controller/edit.js +++ b/src/app/product/controller/edit.js @@ -287,6 +287,6 @@ function ($scope, $routeParams, $location, $q, $productApiService, $designImageS * @returns {string} - full path to image */ $scope.getImage = function (image) { - return $designImageService.getFullImagePath("", image); + return $designImageService.getImage(image); }; }]); diff --git a/src/app/product/directive/guiCustomOptionsManager.js b/src/app/product/directive/guiCustomOptionsManager.js index 321a2f72..9adfdbe1 100644 --- a/src/app/product/directive/guiCustomOptionsManager.js +++ b/src/app/product/directive/guiCustomOptionsManager.js @@ -1,6 +1,6 @@ angular.module("productModule") -.directive("guiCustomOptionsManager", ["$designService", function ($designService) { +.directive("guiCustomOptionsManager", [function () { return { restrict: "E", scope: { @@ -8,7 +8,7 @@ angular.module("productModule") "attribute": "=editorScope", "item": "=item" }, - templateUrl: $designService.getTemplate("product/gui/custom_options_manager.html"), + templateUrl: "/views/product/gui/custom_options_manager.html", controller: function ($scope) { var isInit, initData, modifyData, normalizeJSON, getOptions, getOptionLength, cloneRow; From 198157a47c7ade49c60d4366491ecbac617902ac Mon Sep 17 00:00:00 2001 From: Adam Knox Date: Tue, 22 Mar 2016 11:20:47 -0400 Subject: [PATCH 08/16] :bug: merge conflict --- src/app/design/directives/filter/guiRange.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/app/design/directives/filter/guiRange.js b/src/app/design/directives/filter/guiRange.js index d2ee458d..28ef54c0 100644 --- a/src/app/design/directives/filter/guiRange.js +++ b/src/app/design/directives/filter/guiRange.js @@ -1,6 +1,6 @@ angular.module('designModule') -.directive('guiFilterRange', ['$designService', function($designService) { +.directive('guiFilterRange', function() { return { restrict: 'E', scope: { @@ -10,7 +10,7 @@ angular.module('designModule') }, templateUrl: '/views/design/gui/filter/range.html', - controller: ['$scope', function($scope) { + controller: function($scope) { // $scope.low = ''; // $scope.high = ''; @@ -50,7 +50,7 @@ angular.module('designModule') $scope.parent.newFilters[$scope.attribute.Attribute] = $scope.item[$scope.attribute.Attribute]; }, true); - }] + } }; -}]); +}); From 99369d2c3965a3025eacf844c031d7f336ad43f8 Mon Sep 17 00:00:00 2001 From: Adam Knox Date: Tue, 22 Mar 2016 14:48:06 -0400 Subject: [PATCH 09/16] order status tabs; move around, add cancelled --- src/app/order/list.controller.js | 2 +- src/app/order/list.html | 21 +++++++++++++-------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/app/order/list.controller.js b/src/app/order/list.controller.js index 2939df2b..4377eefa 100644 --- a/src/app/order/list.controller.js +++ b/src/app/order/list.controller.js @@ -34,7 +34,7 @@ angular.module('orderModule') }; var searchDefaults = { - status: 'pending,new', + status: 'processed', sort: '^created_at', limit: '0,50', }; diff --git a/src/app/order/list.html b/src/app/order/list.html index fcd9f07c..0e561acd 100644 --- a/src/app/order/list.html +++ b/src/app/order/list.html @@ -46,25 +46,30 @@

From 6da8845de9fadeb527e66a85d26139ac9032f40e Mon Sep 17 00:00:00 2001 From: Adam Knox Date: Wed, 23 Mar 2016 15:17:12 -0700 Subject: [PATCH 10/16] Close GH-264: add ship tracking details [#115631809]. --- src/app/_styles/components/lists.scss | 4 ++++ src/app/order/edit.html | 22 +++++++++++++++------- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/app/_styles/components/lists.scss b/src/app/_styles/components/lists.scss index 90df0d37..8ae594ef 100644 --- a/src/app/_styles/components/lists.scss +++ b/src/app/_styles/components/lists.scss @@ -7,4 +7,8 @@ dd { margin-left: 85px; } +} + +.panel-list { + padding-left: 20px; } \ No newline at end of file diff --git a/src/app/order/edit.html b/src/app/order/edit.html index 41de122a..fd74fe40 100644 --- a/src/app/order/edit.html +++ b/src/app/order/edit.html @@ -130,15 +130,25 @@

Billing Address

Order Details

ID: {{order._id}}
+
Order Date: {{order.created_at | otStoreDate}}
-
- Shipping Method:
{{order.shipping_info.shipping_method_name}} -
- Shipping Notes: {{order.shipping_info.notes || 'n/a'}} + Shipping Info: +
+
Payment Method:
-
    +
    • {{order.payment_info.payment_method_name}}
    • {{order.payment_info.creditCardType}} xxx-{{order.payment_info.creditCardNumbers}} @@ -147,8 +157,6 @@

      Order Details

      Transaction ID: {{order.payment_info.transactionID || 'n/a'}}
    - -
    Order Date: {{order.created_at | otStoreDate}}
From 4ad7b3218616f18ecd6715fc65a9d41b31fe558c Mon Sep 17 00:00:00 2001 From: Adam Knox Date: Fri, 25 Mar 2016 08:17:30 -0700 Subject: [PATCH 11/16] Close GH-265: update gulp usage notes. --- gulp.config.js | 53 +++++++--- gulpfile.js | 255 ++++++++++++++++++++++++++++----------------- package.json | 10 +- src/app/index.html | 5 +- 4 files changed, 204 insertions(+), 119 deletions(-) diff --git a/gulp.config.js b/gulp.config.js index 59e2f5be..56fc264e 100644 --- a/gulp.config.js +++ b/gulp.config.js @@ -1,67 +1,86 @@ +/*jshint node:true */ + module.exports = function() { var src = './src/'; var app = src + 'app/'; + var email = src +'email/'; + var temp = './tmp/'; var config = { + // Reserved and written to in gulpfile.js + env: '', + settings: '', /************** Paths ****************/ build: 'dist/', + + // App fonts: app + '_fonts/**/*.{otf,svg,eot,ttf,woff,woff2}', html: { - all: app + '**/*.html', - root: app + '*.html' + root: app + '*.html', + nonRoot: [ + app + '**/*.html', + '!' + email + '**/*', + '!' + app + '*.html', + ], }, media: [ // Ignore media, declaring the _images folder directly moves all of its contents // without the container folder getting in the way - '!' + app + '_fonts/*', app + '_images/**/*.{png,gif,jpg,jpeg,ico,svg,mp4,ogv,webm,pdf}', app + '**/*.{png,gif,jpg,jpeg,ico,svg,mp4,ogv,webm,pdf}', + '!' + app + '_fonts/*', ], misc: app + '*.{htaccess,ico,xml}', robots: { default: app + 'robots.txt', - prod: app + 'robots.txt' + prod: app + 'robots.txt', }, styles: { root: app + 'app.scss', all: [ app + '**/*.scss', - app + '**/*.css' - ] + app + '**/*.css', + ], }, scripts: { app: [ - '!' + app + '_lib/**/*', // don't grab libs - temp + 'config.js', // this is a built file - app + '_scripts/*.js', + temp + 'config.js', // this is a built file app + '**/init.js', - app + '**/*.js' + app + '**/*.js', + '!' + app + '_lib/**/*', // don't clobber lib ], lib: [ - // We only grab libs that are minified - // so feel free to include non-minified reference files app + '_lib/jquery.min.js', app + '_lib/angular.min.js', - app + '_lib/**/*.min.js' - ] + app + '_lib/**/*.min.js', + ], }, + + // Emails + email: [ + // ignore built files + email + '*.html', + '!' + email + '*.inline.html', + ], + + // Temp temp: temp, /************** Settings ****************/ node: { port: '9000', - lrPort: '35729' // not used? + lrPort: '35729', // not used? }, sassSettings: { // outputStyle: 'compressed', // precision: 8, }, uglifySettings: { - mangle: false - } + mangle: false, + }, }; return config; diff --git a/gulpfile.js b/gulpfile.js index 90ffaf50..676e65f6 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -1,4 +1,7 @@ +/*jshint node: true */ + var args = require('yargs').argv; +var colors = require('chalk'); var config = require('./gulp.config')(); var del = require('del'); var fs = require('fs'); @@ -11,90 +14,99 @@ var $ = require('gulp-load-plugins')({ /** * yargs variables can be passed in to alter the behavior of tasks - * - * --env=(prod|staging|local) - * Applies revision thumbprints, minifies media, uses relavent robots... - * Forces the api to production - * - * --api=(local|kg-staging|kg-prod|rk-staging|rk-prod|ub-staging|ub-prod) - * Sets the config.js variables, primarily the api to connect to */ +gulp.task('default', ['help']); +gulp.task('help', function() { + logHead('Options'); + logBody([ + '--env=[prod|staging|local]', + ' Controls applying revision thumbprints, minifying media, choosing robots.txt', + ' `prod` forces the api to production', + ' Defaults to local', + '', + '--config=[demo-prod|demo-staging|kg-prod|kg-staging|mp-prod|mp-staging|rk-prod|rk-staging|local]', + ' Sets which config file to use. `/config/*.json`', + ' Settings include; useStrict, apiUrl, fbAppId, googleClientId, googleAnalyticsId', + ' Defaults to `kg-staging`', + ], 1); + + logHead('Example Usage'); + logBody('Make a production build',1); + logBody('`gulp build --env=prod --config=kg-prod`', 2, 'cyan'); + logBody(''); + logBody('Start a development server',1); + logBody('`gulp serve`', 2, 'cyan'); + logBody(''); + logBody('Start a development server using a local api server',1); + logBody('`gulp serve --config=local`', 2, 'cyan'); + + return $.taskListing.withFilters(null, 'default')(); +}); -activate(); ////////////////////////////// -function activate() { +gulp.task('readArgs', function readArgs(cb) { // Read the args, and set defaults config.env = args.env || 'local'; - config.api = args.api || 'kg-staging'; + config.configFile = args.config || 'kg-staging'; // The `env` arg drives whether or not this is production config.isEnvProduction = (config.env === 'prod'); config.isEnvStaging = (config.env === 'staging'); config.isEnvLocal = (config.env === 'local'); + logHead('Argument Feedback'); if (config.isEnvProduction) { - if (config.api.indexOf('-prod') === -1) { - log('You must select a production api when setting env to production'); - config.api = ''; // making this blank causes @readConfig to bomb out, which is maybe good - //TODO: PREVENT THE BUILD? + if (config.configFile.indexOf('-prod') === -1) { + // making this blank causes @readConfig to bomb out, which is maybe good + logBody('--config argument must end in `-prod` when --env=prod', 1, 'red'); + config.configFile = ''; } } - // Assign the application settings from the config folder - config.appSettings = readConfig(config.api); + logBody([ + '--env=' + config.env, + '--config=' + config.configFile, + '', + ], 1, 'cyan'); - giveArgumentFeedback(); -} + // Assign the application settings from the config folder + // this read is sync + config.settings = readConfig(config.configFile); -/** - * Log some feedback related to the args we just processed - */ -function giveArgumentFeedback() { - var bar = '+-----------------------------------+'; - log(bar); - log('Environment Settings'); - log('env = ' + config.env); - log('api = ' + config.api); - log(bar); -} + cb(); +}); /** * Read the settings from the right file */ -function readConfig(api) { - return JSON.parse(fs.readFileSync('./config/' + api + '.json', 'utf8')); +function readConfig(configFile) { + return JSON.parse(fs.readFileSync('./config/' + configFile + '.json', 'utf8')); } -/** - * List the tasks available - */ -gulp.task('help', $.taskListing.withFilters(null, 'default')); -gulp.task('default', ['help']); - /** * Build the app * This is typically used when getting ready to deploy the app * `gulp build --env=prod` */ -gulp.task('build', function() { - runSequence('clean', 'config', 'compile', 'revision'); +gulp.task('build', function build(cb) { + runSequence('clean', 'readArgs', 'config', 'compile', 'revision', cb); }); /** * Build and start a server * This is typically used for local development work - * `gulp serve` or `gulp serve --api=local` + * `gulp serve` or `gulp serve --config=local` */ -gulp.task('serve', ['build'], function() { +gulp.task('serve', ['build'], function serve() { gulp.start('serve_watch'); }); /** * Vet the code */ -gulp.task('vet', function() { +gulp.task('vet', function vet() { return gulp.src(config.scripts.app) .pipe($.jshint()) .pipe($.jshint.reporter('jshint-stylish')); @@ -103,7 +115,7 @@ gulp.task('vet', function() { /** * Remove all build / temp files */ -gulp.task('clean', function(done) { +gulp.task('clean', function clean(done) { del([config.build], done); }); @@ -111,15 +123,17 @@ gulp.task('clean', function(done) { * Replace the config placeholders with the correct value for the variable * from the config files in /config. Then move the file to a tmp folder * - * `gulp build --api=(prod|staging|local)` + * `gulp build --config=(prod|staging|local)` */ gulp.task('config', function() { + var replacePattern = { + patterns: [{ + json: config.settings + }] + }; + return gulp.src('config/config.js') - .pipe($.replaceTask({ - patterns: [{ - json: config.appSettings - }] - })) + .pipe($.replaceTask(replacePattern)) .pipe(gulp.dest(config.temp)); }); @@ -133,7 +147,8 @@ gulp.task('compile', [ 'compile_scripts', 'compile_styles', 'compile_media', - 'compile_fonts' + 'compile_fonts', + 'compile_emails', ]); /** @@ -141,12 +156,12 @@ gulp.task('compile', [ */ gulp.task('compile_scripts', ['compile_scripts_app', 'compile_scripts_lib']); -gulp.task('compile_scripts_app', function() { +gulp.task('compile_scripts_app', function compile_scripts_app() { // REFACTOR: This makes dev/staging/production different... :-1: // uglify + concat breaks sourcemaps so don't use it unless we are on production // https://github.com/terinjokes/gulp-uglify/issues/105 - if (config.isEnvProduction) { + if (config.isEnvProduction || config.isEnvStaging) { return gulp.src(config.scripts.app) .pipe($.plumber(handleError)) .pipe($.uglify(config.uglifySettings)) @@ -156,12 +171,11 @@ gulp.task('compile_scripts_app', function() { } else { return gulp.src(config.scripts.app) .pipe($.concat('main.js')) - .pipe(gulp.dest(config.build + 'scripts')) - .pipe($.livereload()); + .pipe(gulp.dest(config.build + 'scripts')); } }); -gulp.task('compile_scripts_lib', function() { +gulp.task('compile_scripts_lib', function compile_scripts_lib() { return gulp.src(config.scripts.lib) .pipe($.concat('lib.js')) .pipe(gulp.dest(config.build + 'scripts')); @@ -173,13 +187,20 @@ gulp.task('compile_scripts_lib', function() { gulp.task('compile_html', ['compile_html_root', 'compile_html_nonroot']); gulp.task('compile_html_root', function() { + var replacePattern = { + patterns: [{ + json: config.settings + }] + }; + return gulp.src(config.html.root) + .pipe($.replaceTask(replacePattern)) .pipe($.changed(config.build)) .pipe(gulp.dest(config.build)); }); -gulp.task('compile_html_nonroot', function() { - return gulp.src(['!' + config.html.root, config.html.all]) +gulp.task('compile_html_nonroot', function compile_html_nonroot() { + return gulp.src(config.html.nonRoot) .pipe($.changed(config.build + 'views/')) .pipe(gulp.dest(config.build + 'views/')); }); @@ -188,7 +209,7 @@ gulp.task('compile_html_nonroot', function() { * Compile the robots.txt file * --env=(prod|*) */ -gulp.task('compile_robots', function() { +gulp.task('compile_robots', function compile_robots() { var robotPath = config.isEnvProduction ? config.robots.prod : config.robots.default; return gulp.src(robotPath) .pipe($.rename('robots.txt')) @@ -198,7 +219,7 @@ gulp.task('compile_robots', function() { /** * Compile oddball files */ -gulp.task('compile_misc', function() { +gulp.task('compile_misc', function compile_misc() { return gulp.src(config.misc) .pipe(gulp.dest(config.build)); }); @@ -207,65 +228,78 @@ gulp.task('compile_misc', function() { * Compile styles * SASS -> CSS -> app.min.css */ -gulp.task('compile_styles', function() { +gulp.task('compile_styles', function compile_styles() { // REFACTOR: autoprefixer seems to not play well with sass + sourcemaps return gulp.src(config.styles.root) .pipe($.sourcemaps.init()) .pipe($.plumber(handleError)) - .pipe($.sass.sync(config.sassSettings)) + .pipe($.sass(config.sassSettings)) .pipe($.rename({ suffix: '.min' })) - // .pipe($.autoprefixer('last 2 version', 'safari 5', 'ie 8', 'ie 9', 'opera 12.1', 'ios 6', 'android 4')) + // .pipe($.autoprefixer('last 2 version', 'safari 5', 'ie 9', 'opera 12.1', 'ios 6', 'android 4')) .pipe($.plumber.stop()) .pipe($.sourcemaps.write('./maps')) - .pipe(gulp.dest(config.build + 'styles/')) - .pipe($.livereload()); + .pipe(gulp.dest(config.build + 'styles/')); }); /** * Move and minify images / mixed-media */ -gulp.task('compile_media', function() { +gulp.task('compile_media', function compile_media() { var mediaBuild = config.build + 'images/'; + var isMinifyActive = config.isEnvProduction || config.isEnvStaging; return gulp.src(config.media) .pipe($.changed(mediaBuild)) - .pipe($.if(config.isEnvProduction, $.imagemin())) + .pipe($.if(isMinifyActive, $.imagemin())) .pipe(gulp.dest(mediaBuild)); }); /** * Move fonts */ -gulp.task('compile_fonts', function() { +gulp.task('compile_fonts', function compile_fonts() { return gulp.src(config.fonts) .pipe(gulp.dest(config.build + 'fonts/')); }); /** - * Watch files for changes and compile + * Inline css for emails */ -gulp.task('serve_watch', function() { - $.livereload.listen({ - basePath: config.build - }); +gulp.task('compile_emails', function compile_emails() { + return gulp.src(config.email) + .pipe($.inlineCss()) + .pipe($.rename({ + suffix: '.inline' + })) + .pipe(gulp.dest('./src/email')); +}); +/** + * Watch files for changes and compile + */ +gulp.task('serve_watch', function serve_watch() { gulp.start('serve_server'); - gulp.watch(config.html.all, ['compile_html']); - gulp.watch(config.styles.all, ['compile_styles']); - gulp.watch(config.scripts.lib, ['compile_scripts_lib']); - gulp.watch(config.scripts.ie, ['compile_scripts_ie']); - gulp.watch(config.scripts.app, ['compile_scripts_app']); + // App + gulp.watch(config.html.root, ['compile_html_root']); + gulp.watch(config.html.nonRoot, ['compile_html_nonroot']); + gulp.watch(config.styles.all, ['compile_styles']); + gulp.watch(config.scripts.lib, ['compile_scripts_lib']); + gulp.watch(config.scripts.ie, ['compile_scripts_ie']); + gulp.watch(config.scripts.app, ['compile_scripts_app']); + + // Emails + gulp.watch(config.email, ['compile_emails']); }); /** * Starts a server in the build directory */ -gulp.task('serve_server', function() { +gulp.task('serve_server', function serve_server() { var express = require('express'); var path = require('path'); var app = express(); @@ -275,29 +309,28 @@ gulp.task('serve_server', function() { .use(express.static(staticFolder)); app.listen(config.node.port, function() { - var bar = '+-----------------------------------+'; - log(bar); - log('Server Started'); - log('Dashboard: http://localhost:' + config.node.port); - log('Foundation: ' + config.appSettings['apiUrl']); - log(bar); + logHead('Server Started'); + logBody([ + 'Storefront: http://localhost:' + config.node.port, + 'Foundation: ' + config.settings['apiUrl'], + '', + ]); return gulp; }); }); /** - * Thumbprint js, css - * Only fires for production + * Thumbprint js, css for prod and staging * --env=(prod|*) */ -gulp.task('revision', function() { - if (config.isEnvProduction) { +gulp.task('revision', function revision() { + if (config.isEnvProduction || config.isEnvStaging) { var revAll = new $.revAll({ - dontUpdateReference: [/^((?!.js|.css).)*$/g], - dontRenameFile: [/^((?!.js|.css).)*$/g] + dontUpdateReference: ['.html'], + dontRenameFile: ['.html'] }); - return gulp.src(config.build + '**') + return gulp.src(config.build + '**/*.{js,css,html}') .pipe(revAll.revision()) .pipe(gulp.dest(config.build)); } @@ -306,14 +339,44 @@ gulp.task('revision', function() { //////////////////////////////// function handleError(err) { - log('# Error in ' + err.plugin); + logHead('Error'); + logBody('Plugin: ' + err.plugin); if (err.fileName) { - log('File: '+ err.fileName +':'+ err.lineNumber); + logBody('File: ' + err.fileName + ':' + err.lineNumber); } - log('Error Message: ' + err.message); + logBody('Message: ' + err.message); + $.util.beep(); } -function log(msg) { - $.util.log($.util.colors.magenta(msg)); +function logHead(msg) { + var bar = '------------------------------'; + console.log(''); + console.log(colors.gray(msg)); + console.log(bar); +} + +function logBody(msgs, prefixCount, strColor) { + if (typeof prefixCount === 'undefined') { + prefixCount = 1; + } + var prefix = repeat(' ', prefixCount); + msgs = (typeof msgs === 'string') ? [msgs] : msgs; + + msgs.forEach(function(msg) { + if (strColor) { + msg = colors.styles[strColor].open + msg + colors.styles[strColor].close; + } + console.log(prefix + msg); + }); +} + +function repeat(str, num) { + var resp = ''; + if (num) { + for (var i = 0; i < num; i++) { + resp += str; + } + } + return resp; } diff --git a/package.json b/package.json index 1d0e7224..095c6503 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ }, "license": "MIT", "devDependencies": { + "chalk": "^1.1.1", "connect-modrewrite": "^0.8.1", "del": "^0.1.3", "express": "^4.12.3", @@ -17,7 +18,8 @@ "gulp-changed": "^1.0.0", "gulp-concat": "^2.5.2", "gulp-if": "^2.0.0", - "gulp-imagemin": "^1.2.1", + "gulp-imagemin": "^2.0.0", + "gulp-inline-css": "^3.0.1", "gulp-jshint": "^1.10.0", "gulp-livereload": "^3.8.0", "gulp-load-plugins": "^1.2.0", @@ -27,12 +29,12 @@ "gulp-rename": "^1.2.2", "gulp-replace-task": "^0.11.0", "gulp-rev-all": "^0.8.21", - "gulp-sass": "^2.0.1", + "gulp-sass": "^2.0.4", "gulp-sourcemaps": "^1.5.2", "gulp-task-listing": "^1.0.1", - "gulp-uglify": "^0.3.2", + "gulp-uglify": "^1.4.1", "gulp-util": "^3.0.6", - "jshint-stylish": "^2.0.1", + "jshint-stylish": "^2.1.0", "run-sequence": "^1.1.0", "yargs": "^3.29.0" }, diff --git a/src/app/index.html b/src/app/index.html index bbee72c5..725d4dd1 100644 --- a/src/app/index.html +++ b/src/app/index.html @@ -43,13 +43,14 @@ From 1a24b19a4638f97a205435763a8c2dc829c567e8 Mon Sep 17 00:00:00 2001 From: Ian Wendt Date: Fri, 25 Mar 2016 08:31:20 -0700 Subject: [PATCH 12/16] Close GH-267: [#115639597] Updated deploy.sh with new gulp format. --- deploy.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deploy.sh b/deploy.sh index 2c056379..5038cdd0 100644 --- a/deploy.sh +++ b/deploy.sh @@ -26,7 +26,7 @@ if [ "$BRANCH" == 'develop' ]; then HOST=mp-staging fi # gulp build on remote host - ssh ottemo@$REMOTE_HOST "cd $SRCDIR && npm install && gulp build --env=staging --api=${HOST}" + ssh ottemo@$REMOTE_HOST "cd $SRCDIR && npm install && gulp build --env=staging --config=${HOST}" echo "" echo RESTORING DIST DIRECTORY. From 1931dbc074647d9e06d4e47e68fd51a04a39c8be Mon Sep 17 00:00:00 2001 From: CyberCookie Date: Fri, 25 Mar 2016 13:55:23 -0400 Subject: [PATCH 13/16] Close ottemo/dashboard#266: [114516265] custom service names refactored. --- src/app/category/controller/edit.js | 22 +++++----- src/app/category/controller/list.js | 14 +++---- src/app/category/service/api.js | 4 +- src/app/cms/controller/blockEdit.js | 24 +++++------ src/app/cms/controller/blockList.js | 14 +++---- src/app/cms/controller/pageEdit.js | 24 +++++------ src/app/cms/controller/pageList.js | 14 +++---- src/app/cms/service/api.js | 2 +- src/app/config/controller/configEdit.js | 24 +++++------ src/app/config/service/api.js | 2 +- src/app/config/service/config.js | 12 +++--- src/app/config/service/timezone.js | 6 +-- src/app/dashboard/controllers.js | 12 +++--- src/app/dashboard/init.js | 8 ++-- src/app/dashboard/menu/controller.js | 6 +-- src/app/dashboard/service/api.js | 4 +- src/app/dashboard/service/list.js | 4 +- src/app/dashboard/service/statistic.js | 6 +-- src/app/dashboard/service/utils.js | 2 +- src/app/design/api.service.js | 4 +- .../editor/guiArrayModelSelector.js | 10 ++--- .../directives/editor/guiCategorySelector.js | 12 +++--- .../directives/editor/guiModelSelector.js | 4 +- .../directives/editor/guiPageSelector.js | 12 +++--- .../directives/editor/guiPictureManager.js | 4 +- .../directives/editor/guiProductSelector.js | 16 ++++---- .../directives/editor/guiProductsSelector.js | 16 ++++---- .../directives/editor/guiVisitorSelector.js | 14 +++---- .../directives/guiAttributesEditorFormTabs.js | 4 +- src/app/design/image.service.js | 2 +- src/app/discounts/controller/edit.js | 14 +++---- src/app/discounts/controller/list.js | 6 +-- src/app/discounts/service/api.js | 2 +- src/app/impex/controller.js | 18 ++++----- src/app/impex/service/api.js | 2 +- src/app/login/controller/login.js | 14 +++---- src/app/login/controller/logout.js | 8 ++-- src/app/login/init.js | 4 +- src/app/login/service/api.js | 4 +- src/app/login/service/login.js | 10 ++--- src/app/order/api.service.js | 2 +- src/app/order/edit.controller.js | 16 ++++---- src/app/order/list.controller.js | 14 +++---- src/app/order/print.controller.js | 10 ++--- src/app/product/controller/attributeEdit.js | 24 +++++------ src/app/product/controller/attributeList.js | 8 ++-- src/app/product/controller/edit.js | 40 +++++++++---------- src/app/product/controller/list.js | 20 +++++----- src/app/product/service/api.js | 4 +- src/app/seo/controller/edit.js | 26 ++++++------ src/app/seo/controller/editSeo.js | 32 +++++++-------- src/app/seo/controller/list.js | 10 ++--- src/app/seo/service/api.js | 2 +- src/app/seo/service/seo.js | 24 +++++------ src/app/subscriptions/controller/edit.js | 12 +++--- src/app/subscriptions/controller/list.js | 10 ++--- src/app/subscriptions/service/api.js | 2 +- src/app/visitor/controller/addressEdit.js | 18 ++++----- src/app/visitor/controller/addressList.js | 14 +++---- src/app/visitor/controller/attributeEdit.js | 18 ++++----- src/app/visitor/controller/attributeList.js | 8 ++-- src/app/visitor/controller/visitorEdit.js | 32 +++++++-------- src/app/visitor/controller/visitorEmail.js | 12 +++--- src/app/visitor/controller/visitorList.js | 14 +++---- src/app/visitor/service/api.js | 4 +- 65 files changed, 380 insertions(+), 380 deletions(-) diff --git a/src/app/category/controller/edit.js b/src/app/category/controller/edit.js index e30f75f4..027aa3c6 100644 --- a/src/app/category/controller/edit.js +++ b/src/app/category/controller/edit.js @@ -5,10 +5,10 @@ angular.module("categoryModule") "$routeParams", "$location", "$q", -"$categoryApiService", -"$dashboardUtilsService", +"categoryApiService", +"dashboardUtilsService", "_", -function ($scope, $routeParams, $location, $q, $categoryApiService, $dashboardUtilsService, _) { +function ($scope, $routeParams, $location, $q, categoryApiService, dashboardUtilsService, _) { var categoryId, rememberProducts, oldProducts, getDefaultCategory; // Initialize SEO if (typeof $scope.initSeo === "function") { @@ -45,13 +45,13 @@ function ($scope, $routeParams, $location, $q, $categoryApiService, $dashboardUt /** * Gets list all attributes of category */ - $categoryApiService.attributesInfo().$promise.then(function (response) { + categoryApiService.attributesInfo().$promise.then(function (response) { var result = response.result || []; $scope.attributes = result; }); if (null !== categoryId) { - $categoryApiService.getCategory({"categoryID": categoryId}).$promise.then(function (response) { + categoryApiService.getCategory({"categoryID": categoryId}).$promise.then(function (response) { var result = response.result || {}; $scope.category = result; $scope.category.parent = $scope.category['parent_id']; @@ -75,7 +75,7 @@ function ($scope, $routeParams, $location, $q, $categoryApiService, $dashboardUt if (products_to_remove.length){ _.each(products_to_remove, function(productID){ - promises.push($categoryApiService.removeProduct({ + promises.push(categoryApiService.removeProduct({ categoryID: categoryId, productID: productID })) @@ -84,7 +84,7 @@ function ($scope, $routeParams, $location, $q, $categoryApiService, $dashboardUt if (products_to_add.length){ _.each(products_to_add, function(productID){ - promises.push($categoryApiService.addProduct({ + promises.push(categoryApiService.addProduct({ categoryId: categoryId, productId: productID })) @@ -111,7 +111,7 @@ function ($scope, $routeParams, $location, $q, $categoryApiService, $dashboardUt saveSuccess = function (response) { if (response.error === null) { $scope.category = response.result || getDefaultCategory(); - $scope.message = $dashboardUtilsService.getMessage(null, 'success', 'Category was created successfully'); + $scope.message = dashboardUtilsService.getMessage(null, 'success', 'Category was created successfully'); defer.resolve(true); } $('[ng-click="save()"]').removeClass('disabled').children('i').remove(); @@ -127,7 +127,7 @@ function ($scope, $routeParams, $location, $q, $categoryApiService, $dashboardUt updateSuccess = function (response) { if (response.error === null) { $scope.category = response.result || getDefaultCategory(); - $scope.message = $dashboardUtilsService.getMessage(null, 'success', 'Product was updated successfully'); + $scope.message = dashboardUtilsService.getMessage(null, 'success', 'Product was updated successfully'); defer.resolve(true); $('[ng-click="save()"]').removeClass('disabled').children('i').remove(); $('[ng-click="save()"]').siblings('.btn').removeClass('disabled'); @@ -148,7 +148,7 @@ function ($scope, $routeParams, $location, $q, $categoryApiService, $dashboardUt if ($scope.category.name !== '') { delete $scope.category.products; - $categoryApiService.save($scope.category).$promise + categoryApiService.save($scope.category).$promise .then(saveSuccess, saveError) .then(function(){ $scope.category.products = $scope.category.product_ids; @@ -160,7 +160,7 @@ function ($scope, $routeParams, $location, $q, $categoryApiService, $dashboardUt // Clean the associated product list off, before posting up delete $scope.category.products; - $categoryApiService.update($scope.category).$promise + categoryApiService.update($scope.category).$promise .then(updateSuccess, updateError) .then(function(){ $scope.category.products = $scope.category.product_ids; diff --git a/src/app/category/controller/list.js b/src/app/category/controller/list.js index 6da84a3f..ae2aaed4 100644 --- a/src/app/category/controller/list.js +++ b/src/app/category/controller/list.js @@ -5,10 +5,10 @@ angular.module("categoryModule") "$location", "$routeParams", "$q", -"$dashboardListService", -"$categoryApiService", +"dashboardListService", +"categoryApiService", "COUNT_ITEMS_PER_PAGE", -function ($scope, $location, $routeParams, $q, DashboardListService, $categoryApiService, COUNT_ITEMS_PER_PAGE) { +function ($scope, $location, $routeParams, $q, DashboardListService, categoryApiService, COUNT_ITEMS_PER_PAGE) { var serviceList, getCategoriesList, getCategoryCount, getAttributeList, showColumns; // Initialize SEO @@ -30,7 +30,7 @@ function ($scope, $location, $routeParams, $q, DashboardListService, $categoryAp getCategoriesList = function () { var params = $location.search(); params["extra"] = serviceList.getExtraFields(); - $categoryApiService.categoryList(params).$promise.then( + categoryApiService.categoryList(params).$promise.then( function (response) { var result, i; $scope.categoriesTmp = []; @@ -46,7 +46,7 @@ function ($scope, $location, $routeParams, $q, DashboardListService, $categoryAp * Gets count of categories */ getCategoryCount = function () { - $categoryApiService.getCount($location.search()).$promise.then( + categoryApiService.getCount($location.search()).$promise.then( function (response) { if (response.error === null) { $scope.count = response.result; @@ -58,7 +58,7 @@ function ($scope, $location, $routeParams, $q, DashboardListService, $categoryAp }; getAttributeList = function () { - $categoryApiService.attributesInfo().$promise.then( + categoryApiService.attributesInfo().$promise.then( function (response) { var result = response.result || []; serviceList.init('categories'); @@ -111,7 +111,7 @@ function ($scope, $location, $routeParams, $q, DashboardListService, $categoryAp _remove = function (id) { var defer = $q.defer(); - $categoryApiService.remove({"categoryID": id}, + categoryApiService.remove({"categoryID": id}, function (response) { if (response.result === "ok") { defer.resolve(id); diff --git a/src/app/category/service/api.js b/src/app/category/service/api.js index ec573933..934e6aac 100644 --- a/src/app/category/service/api.js +++ b/src/app/category/service/api.js @@ -1,8 +1,8 @@ angular.module("categoryModule") /* -* $productApiService interaction service +* productApiService interaction service */ -.service("$categoryApiService", ["$resource", "REST_SERVER_URI", function ($resource, REST_SERVER_URI) { +.service("categoryApiService", ["$resource", "REST_SERVER_URI", function ($resource, REST_SERVER_URI) { return $resource(REST_SERVER_URI, {}, { "attributesInfo": { method: "GET", diff --git a/src/app/cms/controller/blockEdit.js b/src/app/cms/controller/blockEdit.js index 8d23c9ac..612ad6c4 100644 --- a/src/app/cms/controller/blockEdit.js +++ b/src/app/cms/controller/blockEdit.js @@ -5,15 +5,15 @@ angular.module("cmsModule") "$routeParams", "$location", "$q", -"$cmsApiService", -"$dashboardUtilsService", +"cmsApiService", +"dashboardUtilsService", function ( $scope, $routeParams, $location, $q, - $cmsApiService, - $dashboardUtilsService + cmsApiService, + dashboardUtilsService ) { // Retrieve block id from url @@ -25,7 +25,7 @@ function ( } // Get block attributes - $cmsApiService.blockAttributes().$promise.then( + cmsApiService.blockAttributes().$promise.then( function (response) { $scope.attributes = response.result; } @@ -42,7 +42,7 @@ function ( if (blockId === 'new') { $scope.block = getDefaultBlock(); } else { - $cmsApiService.blockGet({"blockID": blockId}).$promise.then( + cmsApiService.blockGet({"blockID": blockId}).$promise.then( function (response) { // If we pass incorrect block ID // we don't have an error from server @@ -72,7 +72,7 @@ function ( // If block._id !== null update existing block if ($scope.block._id !== null) { - var promise = $cmsApiService.blockUpdate($scope.block).$promise; + var promise = cmsApiService.blockUpdate($scope.block).$promise; promise.then(updateSuccess, updateError); // Enable buttons in any case @@ -83,7 +83,7 @@ function ( // else save new block } else { - var promise = $cmsApiService.blockAdd($scope.block).$promise; + var promise = cmsApiService.blockAdd($scope.block).$promise; promise.then(saveSuccess, saveError); // Enable buttons in any case @@ -99,13 +99,13 @@ function ( // Update block data $scope.block = response.result; // Show message - $scope.message = $dashboardUtilsService.getMessage(null, 'success', 'Block was updated successfully'); + $scope.message = dashboardUtilsService.getMessage(null, 'success', 'Block was updated successfully'); defer.resolve(response); } function updateError(response) { - $scope.message = $dashboardUtilsService.getMessage(response); + $scope.message = dashboardUtilsService.getMessage(response); defer.reject(response); } @@ -113,13 +113,13 @@ function ( // Update block data $scope.block = response.result; // Show message - $scope.message = $dashboardUtilsService.getMessage(null, 'success', 'Block was created successfully'); + $scope.message = dashboardUtilsService.getMessage(null, 'success', 'Block was created successfully'); defer.resolve(response); } function saveError(response) { - $scope.message = $dashboardUtilsService.getMessage(response); + $scope.message = dashboardUtilsService.getMessage(response); defer.reject(response); } }; diff --git a/src/app/cms/controller/blockList.js b/src/app/cms/controller/blockList.js index 4c5dd8ab..bcf6f354 100644 --- a/src/app/cms/controller/blockList.js +++ b/src/app/cms/controller/blockList.js @@ -5,10 +5,10 @@ angular.module("cmsModule") "$location", "$routeParams", "$q", -"$dashboardListService", -"$cmsApiService", +"dashboardListService", +"cmsApiService", "COUNT_ITEMS_PER_PAGE", -function ($scope, $location, $routeParams, $q, DashboardListService, $cmsApiService, COUNT_ITEMS_PER_PAGE) { +function ($scope, $location, $routeParams, $q, DashboardListService, cmsApiService, COUNT_ITEMS_PER_PAGE) { var serviceList, getBlockCount, getAttributeList, getBlocksList, showColumns; serviceList = new DashboardListService(); showColumns = { @@ -25,7 +25,7 @@ function ($scope, $location, $routeParams, $q, DashboardListService, $cmsApiServ getBlocksList = function () { var params = $location.search(); params["extra"] = serviceList.getExtraFields(); - $cmsApiService.blockList(params).$promise.then( + cmsApiService.blockList(params).$promise.then( function (response) { var result, i; $scope.blocksTmp = []; @@ -41,7 +41,7 @@ function ($scope, $location, $routeParams, $q, DashboardListService, $cmsApiServ * Gets list of blocks */ getBlockCount = function () { - $cmsApiService.blockCount($location.search()).$promise.then( + cmsApiService.blockCount($location.search()).$promise.then( function (response) { if (response.error === null) { $scope.count = response.result; @@ -53,7 +53,7 @@ function ($scope, $location, $routeParams, $q, DashboardListService, $cmsApiServ }; getAttributeList = function () { - $cmsApiService.blockAttributes().$promise.then( + cmsApiService.blockAttributes().$promise.then( function (response) { var result = response.result || []; serviceList.init('blocks'); @@ -105,7 +105,7 @@ function ($scope, $location, $routeParams, $q, DashboardListService, $cmsApiServ _remove = function (id) { var defer = $q.defer(); - $cmsApiService.blockRemove({"blockID": id}, + cmsApiService.blockRemove({"blockID": id}, function (response) { if (response.result === "ok") { defer.resolve(id); diff --git a/src/app/cms/controller/pageEdit.js b/src/app/cms/controller/pageEdit.js index 6abcba98..5e6f594a 100644 --- a/src/app/cms/controller/pageEdit.js +++ b/src/app/cms/controller/pageEdit.js @@ -6,15 +6,15 @@ angular.module("cmsModule") "$routeParams", "$location", "$q", -"$cmsApiService", -"$dashboardUtilsService", +"cmsApiService", +"dashboardUtilsService", function ( $scope, $routeParams, $location, $q, - $cmsApiService, - $dashboardUtilsService + cmsApiService, + dashboardUtilsService ) { // Initialize SEO @@ -29,7 +29,7 @@ function ( } // Get page attributes - $cmsApiService.pageAttributes().$promise.then( + cmsApiService.pageAttributes().$promise.then( function (response) { $scope.attributes = response.result; } @@ -46,7 +46,7 @@ function ( if (pageId === 'new') { $scope.page = getDefaultPage(); } else { - $cmsApiService.pageGet({"pageID": pageId}).$promise.then( + cmsApiService.pageGet({"pageID": pageId}).$promise.then( function (response) { // If we pass incorrect page ID // we don't have an error from server @@ -76,7 +76,7 @@ function ( // If page._id !== null update existing page if ($scope.page._id !== null) { - var promise = $cmsApiService.pageUpdate($scope.page).$promise; + var promise = cmsApiService.pageUpdate($scope.page).$promise; promise.then(updateSuccess, updateError); // Enable buttons in any case @@ -87,7 +87,7 @@ function ( // else save new page } else { - var promise = $cmsApiService.pageAdd($scope.page).$promise; + var promise = cmsApiService.pageAdd($scope.page).$promise; promise.then(saveSuccess, saveError); // Enable buttons in any case @@ -103,13 +103,13 @@ function ( // Update page data $scope.page = response.result; // Show message - $scope.message = $dashboardUtilsService.getMessage(null, 'success', 'Page was updated successfully'); + $scope.message = dashboardUtilsService.getMessage(null, 'success', 'Page was updated successfully'); defer.resolve(response); } function updateError(response) { - $scope.message = $dashboardUtilsService.getMessage(response); + $scope.message = dashboardUtilsService.getMessage(response); defer.reject(response); } @@ -117,13 +117,13 @@ function ( // Update page data $scope.page = response.result; // Show message - $scope.message = $dashboardUtilsService.getMessage(null, 'success', 'Page was created successfully'); + $scope.message = dashboardUtilsService.getMessage(null, 'success', 'Page was created successfully'); defer.resolve(response); } function saveError(response) { - $scope.message = $dashboardUtilsService.getMessage(response); + $scope.message = dashboardUtilsService.getMessage(response); defer.reject(response); } }; diff --git a/src/app/cms/controller/pageList.js b/src/app/cms/controller/pageList.js index b2f2c760..009d47e5 100644 --- a/src/app/cms/controller/pageList.js +++ b/src/app/cms/controller/pageList.js @@ -5,10 +5,10 @@ angular.module("cmsModule") "$location", "$routeParams", "$q", -"$dashboardListService", -"$cmsApiService", +"dashboardListService", +"cmsApiService", "COUNT_ITEMS_PER_PAGE", -function ($scope, $location, $routeParams, $q, DashboardListService, $cmsApiService, COUNT_ITEMS_PER_PAGE) { +function ($scope, $location, $routeParams, $q, DashboardListService, cmsApiService, COUNT_ITEMS_PER_PAGE) { var serviceList, getPageCount, getAttributeList, getPagesList, showColumns; serviceList = new DashboardListService(); showColumns = { @@ -30,7 +30,7 @@ function ($scope, $location, $routeParams, $q, DashboardListService, $cmsApiServ getPagesList = function () { var params = $location.search(); params["extra"] = serviceList.getExtraFields(); - $cmsApiService.pageList(params).$promise.then( + cmsApiService.pageList(params).$promise.then( function (response) { var result, i; $scope.pagesTmp = []; @@ -46,7 +46,7 @@ function ($scope, $location, $routeParams, $q, DashboardListService, $cmsApiServ * Gets list of pages */ getPageCount = function () { - $cmsApiService.pageCount($location.search()).$promise.then( + cmsApiService.pageCount($location.search()).$promise.then( function (response) { if (response.error === null) { $scope.count = response.result; @@ -58,7 +58,7 @@ function ($scope, $location, $routeParams, $q, DashboardListService, $cmsApiServ }; getAttributeList = function () { - $cmsApiService.pageAttributes().$promise.then( + cmsApiService.pageAttributes().$promise.then( function (response) { var result = response.result || []; serviceList.init('pages'); @@ -111,7 +111,7 @@ function ($scope, $location, $routeParams, $q, DashboardListService, $cmsApiServ _remove = function (id) { var defer = $q.defer(); - $cmsApiService.pageRemove({"pageID": id}, + cmsApiService.pageRemove({"pageID": id}, function (response) { if (response.result === "ok") { defer.resolve(id); diff --git a/src/app/cms/service/api.js b/src/app/cms/service/api.js index 05f51c92..204b0556 100644 --- a/src/app/cms/service/api.js +++ b/src/app/cms/service/api.js @@ -1,6 +1,6 @@ angular.module("cmsModule") -.service("$cmsApiService", ["$resource", "REST_SERVER_URI", function ($resource, REST_SERVER_URI) { +.service("cmsApiService", ["$resource", "REST_SERVER_URI", function ($resource, REST_SERVER_URI) { return $resource(REST_SERVER_URI, {}, { "blockAdd": { diff --git a/src/app/config/controller/configEdit.js b/src/app/config/controller/configEdit.js index 46ffffe0..e8b57af6 100644 --- a/src/app/config/controller/configEdit.js +++ b/src/app/config/controller/configEdit.js @@ -3,10 +3,10 @@ angular.module("configModule") .controller("configEditController", [ "$scope", "$routeParams", - "$configApiService", - "$configService", - "$dashboardUtilsService", - function ($scope, $routeParams, $configApiService, $configService, $dashboardUtilsService) { + "configApiService", + "configService", + "dashboardUtilsService", + function ($scope, $routeParams, configApiService, configService, dashboardUtilsService) { $scope.items = {}; $scope.currentGroup = $routeParams.group; @@ -14,13 +14,13 @@ angular.module("configModule") var activeTab; $scope.init = function () { - $configService.init().then( + configService.init().then( function () { var regExp, parts, tabs; regExp = new RegExp("(\\w+)\\.(\\w+).*", "i"); tabs = {}; - $scope.sections = $configService.getConfigTabs($scope.currentGroup); + $scope.sections = configService.getConfigTabs($scope.currentGroup); for (var i = 0; i < $scope.sections.length; i += 1) { var attr = $scope.sections[i]; @@ -37,9 +37,9 @@ angular.module("configModule") if (parts instanceof Array) { $scope.currentPath = parts[2]; - $configService.load($scope.currentPath).then( + configService.load($scope.currentPath).then( function () { - $scope.items = $configService.getItems($scope.currentPath); + $scope.items = configService.getItems($scope.currentPath); } ); } @@ -49,17 +49,17 @@ angular.module("configModule") $scope.selectTab = function (path) { $scope.currentPath = path; - $configService.load($scope.currentPath).then( + configService.load($scope.currentPath).then( function () { - $scope.items = $configService.getItems($scope.currentPath); + $scope.items = configService.getItems($scope.currentPath); } ); }; $scope.save = function () { - $configService.save($scope.currentPath).then( + configService.save($scope.currentPath).then( function () { - $scope.message = $dashboardUtilsService.getMessage(null, 'success', 'config was saved successfully'); + $scope.message = dashboardUtilsService.getMessage(null, 'success', 'config was saved successfully'); } ); }; diff --git a/src/app/config/service/api.js b/src/app/config/service/api.js index 837ea2b5..f8b83098 100644 --- a/src/app/config/service/api.js +++ b/src/app/config/service/api.js @@ -1,6 +1,6 @@ angular.module("configModule") -.service("$configApiService", ["$resource", "REST_SERVER_URI", +.service("configApiService", ["$resource", "REST_SERVER_URI", function($resource, REST_SERVER_URI) { return $resource(REST_SERVER_URI, {}, { "getGroups": { diff --git a/src/app/config/service/config.js b/src/app/config/service/config.js index 5c2f681c..261214e5 100644 --- a/src/app/config/service/config.js +++ b/src/app/config/service/config.js @@ -2,10 +2,10 @@ angular.module("configModule") /** * */ -.service("$configService", [ - "$configApiService", +.service("configService", [ + "configApiService", "$q", - function ($configApiService, $q) { + function (configApiService, $q) { // Variables var isInit, configGroups, configTabs, items, itemsOld, isLoaded; @@ -88,7 +88,7 @@ angular.module("configModule") configTabs = {}; configGroups = []; - $configApiService.getGroups().$promise.then( + configApiService.getGroups().$promise.then( function (response) { var result, attr; result = response.result || []; @@ -127,7 +127,7 @@ angular.module("configModule") } if ((typeof isLoaded[path] === "undefined" && !force) || force) { - $configApiService.getInfo({"path": path}).$promise.then( + configApiService.getInfo({"path": path}).$promise.then( function (response) { var addAttributeInTab = function (attr) { @@ -184,7 +184,7 @@ angular.module("configModule") var _save = function (field) { var defer = $q.defer(); - $configApiService.setPath({ + configApiService.setPath({ "path": field, "value": items[path][field] }).$promise.then(function (response) { diff --git a/src/app/config/service/timezone.js b/src/app/config/service/timezone.js index c08551ce..11a65952 100644 --- a/src/app/config/service/timezone.js +++ b/src/app/config/service/timezone.js @@ -1,7 +1,7 @@ angular.module('configModule') -.factory('timezoneService', ['$configApiService', '$q', - function($configApiService, $q) { +.factory('timezoneService', ['configApiService', '$q', + function(configApiService, $q) { var service = { init: init, storeTz : 0 @@ -14,7 +14,7 @@ angular.module('configModule') function init() { // Cache the store tz - $configApiService.getPath({path: 'general.store.timezone'}).$promise + configApiService.getPath({path: 'general.store.timezone'}).$promise .then(function(response) { service.storeTz = response.result.substr(3); }); diff --git a/src/app/dashboard/controllers.js b/src/app/dashboard/controllers.js index f72054fc..044127f6 100644 --- a/src/app/dashboard/controllers.js +++ b/src/app/dashboard/controllers.js @@ -3,17 +3,17 @@ angular.module("dashboardModule") .controller("dashboardController", [ "$scope", "$location", - "$dashboardStatisticService", - "$designImageService", - "$dashboardUtilsService", + "dashboardStatisticService", + "designImageService", + "dashboardUtilsService", "$timeout", "moment", function( $scope, $location, $statistic, - $designImageService, - $dashboardUtilsService, + designImageService, + dashboardUtilsService, $timeout, moment ) { @@ -203,7 +203,7 @@ angular.module("dashboardModule") //TODO: delete this when images are attached to products function getProductImage(image) { - return $designImageService.getImage(image); + return designImageService.getImage(image); }; } diff --git a/src/app/dashboard/init.js b/src/app/dashboard/init.js index 410eab67..848353de 100644 --- a/src/app/dashboard/init.js +++ b/src/app/dashboard/init.js @@ -65,10 +65,10 @@ angular.module("dashboardModule", [ $httpProvider.interceptors.push(otInterceptor); - function checkLoggedIn($q,$log,$loginLoginService){ + function checkLoggedIn($q,$log,loginLoginService){ var def = $q.defer(); - $loginLoginService.init().then(function(auth){ + loginLoginService.init().then(function(auth){ if (auth) def.resolve(auth) @@ -87,7 +87,7 @@ angular.module("dashboardModule", [ route.resolve = route.resolve || {}; angular.extend(route.resolve, { - isLoggedIn: ['$q','$log', '$loginLoginService', checkLoggedIn] + isLoggedIn: ['$q','$log', 'loginLoginService', checkLoggedIn] }) return $routeProvider.when(path,route); @@ -120,7 +120,7 @@ angular.module("dashboardModule", [ "$rootScope", "$route", "$http", - "$dashboardListService", + "dashboardListService", "$location", "$log", function ($rootScope, $route, $http, DashboardListService,$location,$log) { diff --git a/src/app/dashboard/menu/controller.js b/src/app/dashboard/menu/controller.js index d4a22b1d..d4c79c9c 100644 --- a/src/app/dashboard/menu/controller.js +++ b/src/app/dashboard/menu/controller.js @@ -3,11 +3,11 @@ angular.module('dashboardModule') .controller('dashboardMenuController', [ '$scope', 'menuService', - '$loginLoginService', + 'loginLoginService', '$rootScope', - function($scope, menuService, $loginLoginService, $rootScope) { + function($scope, menuService, loginLoginService, $rootScope) { - $scope.userName = $loginLoginService.getFullName() || 'root'; + $scope.userName = loginLoginService.getFullName() || 'root'; $scope.items = menuService.items; $scope.closeAll = menuService.closeAll; diff --git a/src/app/dashboard/service/api.js b/src/app/dashboard/service/api.js index 4e4b9e67..0c9e3a5f 100644 --- a/src/app/dashboard/service/api.js +++ b/src/app/dashboard/service/api.js @@ -1,8 +1,8 @@ angular.module("dashboardModule") /** -* $dashboardApiService interaction service +* dashboardApiService interaction service */ -.service("$dashboardApiService", ["$resource", "REST_SERVER_URI", function ($resource, REST_SERVER_URI) { +.service("dashboardApiService", ["$resource", "REST_SERVER_URI", function ($resource, REST_SERVER_URI) { return $resource(REST_SERVER_URI, {}, { "getReferrers": { diff --git a/src/app/dashboard/service/list.js b/src/app/dashboard/service/list.js index a297cbd6..228a0454 100644 --- a/src/app/dashboard/service/list.js +++ b/src/app/dashboard/service/list.js @@ -1,8 +1,8 @@ angular.module("dashboardModule") /** -* $dashboardListService implementation +* dashboardListService implementation */ -.service("$dashboardListService", ["$routeParams", function ($routeParams) { +.service("dashboardListService", ["$routeParams", function ($routeParams) { return function () { // Variables var ID, filters, attributes, fields, isInitFields; diff --git a/src/app/dashboard/service/statistic.js b/src/app/dashboard/service/statistic.js index df120a59..aae8527f 100644 --- a/src/app/dashboard/service/statistic.js +++ b/src/app/dashboard/service/statistic.js @@ -1,9 +1,9 @@ angular.module("dashboardModule") /** -* $dashboardStatisticService implementation +* dashboardStatisticService implementation */ -.service("$dashboardStatisticService", [ -"$dashboardApiService", +.service("dashboardStatisticService", [ +"dashboardApiService", "$q", "moment", function ($api, $q, moment) { diff --git a/src/app/dashboard/service/utils.js b/src/app/dashboard/service/utils.js index 7e2b315c..71068dfb 100644 --- a/src/app/dashboard/service/utils.js +++ b/src/app/dashboard/service/utils.js @@ -1,6 +1,6 @@ angular.module("dashboardModule") -.service("$dashboardUtilsService", function() { +.service("dashboardUtilsService", function() { /** * Extends String object diff --git a/src/app/design/api.service.js b/src/app/design/api.service.js index 6ee8efbc..e924b1dd 100644 --- a/src/app/design/api.service.js +++ b/src/app/design/api.service.js @@ -1,8 +1,8 @@ angular.module("designModule") /* - * $productApiService interaction service + * productApiService interaction service */ -.service("$designApiService", ["$resource", "REST_SERVER_URI", function ($resource, REST_SERVER_URI) { +.service("designApiService", ["$resource", "REST_SERVER_URI", function ($resource, REST_SERVER_URI) { return $resource(REST_SERVER_URI, {}, { "attributesModel": { method: "GET", diff --git a/src/app/design/directives/editor/guiArrayModelSelector.js b/src/app/design/directives/editor/guiArrayModelSelector.js index cd2aa98e..af676ecb 100644 --- a/src/app/design/directives/editor/guiArrayModelSelector.js +++ b/src/app/design/directives/editor/guiArrayModelSelector.js @@ -3,9 +3,9 @@ angular.module("designModule") * Directive used for automatic attribute editor creation */ .directive("guiArrayModelSelector", [ - "$designApiService", - "$designImageService", - function ($designApiService, $designImageService) { + "designApiService", + "designImageService", + function (designApiService, designImageService) { return { restrict: "E", templateUrl: "/views/design/gui/editor/arrayModelSelector.html", @@ -154,7 +154,7 @@ angular.module("designModule") parseOptions($scope.attribute.Options); - $designApiService.attributesModel(getParams(options.model, $scope.item)).$promise.then( + designApiService.attributesModel(getParams(options.model, $scope.item)).$promise.then( function (response) { var result = response.result || []; $scope.items = result; @@ -169,7 +169,7 @@ angular.module("designModule") * @returns {string} - full path to image */ $scope.getImage = function (image) { - return $designImageService.getImage(image); + return designImageService.getImage(image); }; } diff --git a/src/app/design/directives/editor/guiCategorySelector.js b/src/app/design/directives/editor/guiCategorySelector.js index b479285c..bd7a5360 100644 --- a/src/app/design/directives/editor/guiCategorySelector.js +++ b/src/app/design/directives/editor/guiCategorySelector.js @@ -5,9 +5,9 @@ angular.module("designModule") .directive("guiCategorySelector", [ "$location", "$routeParams", - "$dashboardListService", - "$categoryApiService", - function ($location, $routeParams, DashboardListService, $categoryApiService) { + "dashboardListService", + "categoryApiService", + function ($location, $routeParams, DashboardListService, categoryApiService) { var serviceList = new DashboardListService(), showColumns; showColumns = { 'name' : {'type' : 'select-link', 'label' : 'Name'}, @@ -83,7 +83,7 @@ angular.module("designModule") var getCategoriesList = function () { var params = $scope.search; params["extra"] = serviceList.getExtraFields(); - $categoryApiService.categoryList(params).$promise.then( + categoryApiService.categoryList(params).$promise.then( function (response) { var result, i; $scope.categoriesTmp = []; @@ -100,7 +100,7 @@ angular.module("designModule") /** * Gets count of categories */ - $categoryApiService.getCount($scope.search).$promise.then( + categoryApiService.getCount($scope.search).$promise.then( function (response) { if (response.error === null) { $scope.count = response.result; @@ -110,7 +110,7 @@ angular.module("designModule") } ); - $categoryApiService.attributesInfo().$promise.then( + categoryApiService.attributesInfo().$promise.then( function (response) { var result = response.result || []; serviceList.init('categories'); diff --git a/src/app/design/directives/editor/guiModelSelector.js b/src/app/design/directives/editor/guiModelSelector.js index 5baac23c..f523e844 100644 --- a/src/app/design/directives/editor/guiModelSelector.js +++ b/src/app/design/directives/editor/guiModelSelector.js @@ -3,7 +3,7 @@ angular.module("designModule") /** * Directive used for automatic attribute editor creation */ - .directive("guiModelSelector", ["$designApiService", function ($designApiService) { + .directive("guiModelSelector", ["designApiService", function (designApiService) { return { restrict: "E", templateUrl: "/views/design/gui/editor/modelSelector.html", @@ -86,7 +86,7 @@ angular.module("designModule") return true; } - $designApiService.attributesModel(params).$promise.then( + designApiService.attributesModel(params).$promise.then( function (response) { try { var result = response.result || []; diff --git a/src/app/design/directives/editor/guiPageSelector.js b/src/app/design/directives/editor/guiPageSelector.js index a10b7662..fcd1f336 100644 --- a/src/app/design/directives/editor/guiPageSelector.js +++ b/src/app/design/directives/editor/guiPageSelector.js @@ -5,9 +5,9 @@ angular.module("designModule") .directive("guiPageSelector", [ "$location", "$routeParams", - "$dashboardListService", - "$cmsApiService", - function ($location, $routeParams, DashboardListService, $cmsApiService) { + "dashboardListService", + "cmsApiService", + function ($location, $routeParams, DashboardListService, cmsApiService) { var serviceList = new DashboardListService(), showColumns; showColumns = { 'identifier' : {'type' : 'select-link'}, @@ -83,7 +83,7 @@ angular.module("designModule") var getPagesList = function () { var params = $scope.search; params["extra"] = serviceList.getExtraFields(); - $cmsApiService.pageList(params).$promise.then( + cmsApiService.pageList(params).$promise.then( function (response) { var result, i; $scope.pagesTmp = []; @@ -100,7 +100,7 @@ angular.module("designModule") /** * Gets count of pages */ - $cmsApiService.pageCount($scope.search).$promise.then( + cmsApiService.pageCount($scope.search).$promise.then( function (response) { if (response.error === null) { $scope.count = response.result; @@ -110,7 +110,7 @@ angular.module("designModule") } ); - $cmsApiService.pageAttributes().$promise.then( + cmsApiService.pageAttributes().$promise.then( function (response) { var result = response.result || []; serviceList.init('pages'); diff --git a/src/app/design/directives/editor/guiPictureManager.js b/src/app/design/directives/editor/guiPictureManager.js index c66cbe48..60612524 100644 --- a/src/app/design/directives/editor/guiPictureManager.js +++ b/src/app/design/directives/editor/guiPictureManager.js @@ -3,7 +3,7 @@ */ angular.module("designModule") -.directive("guiPictureManager", ["$designImageService", function ($designImageService) { +.directive("guiPictureManager", ["designImageService", function (designImageService) { return { restrict: "E", templateUrl: "/views/design/gui/editor/pictureManager.html", @@ -44,7 +44,7 @@ angular.module("designModule") }); $scope.getImage = function (filename) { - return $designImageService.getImage($scope.imagesPath + filename); + return designImageService.getImage($scope.imagesPath + filename); }; $scope.selectImage = function (filename) { diff --git a/src/app/design/directives/editor/guiProductSelector.js b/src/app/design/directives/editor/guiProductSelector.js index bc5b1042..3f8273fb 100644 --- a/src/app/design/directives/editor/guiProductSelector.js +++ b/src/app/design/directives/editor/guiProductSelector.js @@ -6,11 +6,11 @@ angular.module("designModule") .directive("guiProductSelector", [ "$location", "$routeParams", -"$dashboardListService", -"$productApiService", -"$designImageService", +"dashboardListService", +"productApiService", +"designImageService", "COUNT_ITEMS_PER_PAGE", -function ($location, $routeParams, DashboardListService, $productApiService, $designImageService, COUNT_ITEMS_PER_PAGE) { +function ($location, $routeParams, DashboardListService, productApiService, designImageService, COUNT_ITEMS_PER_PAGE) { var serviceList = new DashboardListService(), showColumns; showColumns = { 'name' : {'type' : 'select-link', 'label' : 'Name'}, @@ -105,7 +105,7 @@ function ($location, $routeParams, DashboardListService, $productApiService, $de var getProductsList = function () { var params = $scope.search; params["extra"] = serviceList.getExtraFields(); - $productApiService.productList(params).$promise.then( + productApiService.productList(params).$promise.then( function (response) { var result, i; $scope.productsTmp = []; @@ -126,7 +126,7 @@ function ($location, $routeParams, DashboardListService, $productApiService, $de * Gets list of products */ var getProductCount = function () { - $productApiService.getCount($scope.search, {}).$promise.then(function (response) { + productApiService.getCount($scope.search, {}).$promise.then(function (response) { if (response.error === null) { $scope.count = response.result; } else { @@ -136,7 +136,7 @@ function ($location, $routeParams, DashboardListService, $productApiService, $de }; var getAttributeList = function () { - $productApiService.attributesInfo().$promise.then(function (response) { + productApiService.attributesInfo().$promise.then(function (response) { var result = response.result || []; serviceList.init('products'); $scope.attributes = result; @@ -208,7 +208,7 @@ function ($location, $routeParams, DashboardListService, $productApiService, $de * @returns {string} - full path to image */ $scope.getImage = function (image) { - return $designImageService.getImage(image); + return designImageService.getImage(image); }; $scope.expand = function () { diff --git a/src/app/design/directives/editor/guiProductsSelector.js b/src/app/design/directives/editor/guiProductsSelector.js index ca77aa1b..b2625314 100644 --- a/src/app/design/directives/editor/guiProductsSelector.js +++ b/src/app/design/directives/editor/guiProductsSelector.js @@ -6,11 +6,11 @@ angular.module("designModule") .directive("guiProductsSelector", [ "$location", "$routeParams", -"$dashboardListService", -"$productApiService", -"$designImageService", +"dashboardListService", +"productApiService", +"designImageService", "COUNT_ITEMS_PER_PAGE", -function ($location, $routeParams, DashboardListService, $productApiService, $designImageService, COUNT_ITEMS_PER_PAGE) { +function ($location, $routeParams, DashboardListService, productApiService, designImageService, COUNT_ITEMS_PER_PAGE) { var serviceList = new DashboardListService(), showColumns; showColumns = { 'name' : {'type' : 'select-link', 'label' : 'Name'}, @@ -121,7 +121,7 @@ function ($location, $routeParams, DashboardListService, $productApiService, $de var getProductsList = function () { var params = $scope.search; params["extra"] = serviceList.getExtraFields(); - $productApiService.productList(params).$promise.then( + productApiService.productList(params).$promise.then( function (response) { var result, i; $scope.productsTmp = []; @@ -142,7 +142,7 @@ function ($location, $routeParams, DashboardListService, $productApiService, $de * Gets list of products */ var getProductCount = function () { - $productApiService.getCount($scope.search, {}).$promise.then(function (response) { + productApiService.getCount($scope.search, {}).$promise.then(function (response) { if (response.error === null) { $scope.count = response.result; } else { @@ -152,7 +152,7 @@ function ($location, $routeParams, DashboardListService, $productApiService, $de }; var getAttributeList = function () { - $productApiService.attributesInfo().$promise.then(function (response) { + productApiService.attributesInfo().$promise.then(function (response) { var result = response.result || []; serviceList.init('products'); $scope.attributes = result; @@ -195,7 +195,7 @@ function ($location, $routeParams, DashboardListService, $productApiService, $de * @returns {string} - full path to image */ $scope.getImage = function (image) { - return $designImageService.getImage(image); + return designImageService.getImage(image); }; $scope.expand = function () { diff --git a/src/app/design/directives/editor/guiVisitorSelector.js b/src/app/design/directives/editor/guiVisitorSelector.js index 848f0d09..cc4467e4 100644 --- a/src/app/design/directives/editor/guiVisitorSelector.js +++ b/src/app/design/directives/editor/guiVisitorSelector.js @@ -6,11 +6,11 @@ angular.module("designModule") .directive("guiVisitorSelector", [ "$location", "$routeParams", -"$dashboardListService", -"$visitorApiService", -"$designImageService", +"dashboardListService", +"visitorApiService", +"designImageService", "COUNT_ITEMS_PER_PAGE", -function ($location, $routeParams, DashboardListService, $visitorApiService, $designImageService, COUNT_ITEMS_PER_PAGE) { +function ($location, $routeParams, DashboardListService, visitorApiService, designImageService, COUNT_ITEMS_PER_PAGE) { var serviceList = new DashboardListService(), showColumns; showColumns = { 'name' : {'type' : 'select-link', 'label' : 'Name'}, @@ -96,7 +96,7 @@ function ($location, $routeParams, DashboardListService, $visitorApiService, $de var getVisitorsList = function () { var params = $scope.search; params["extra"] = serviceList.getExtraFields(); - $visitorApiService.visitorList(params).$promise.then( + visitorApiService.visitorList(params).$promise.then( function (response) { var result, i; $scope.visitorsTmp = []; @@ -111,7 +111,7 @@ function ($location, $routeParams, DashboardListService, $visitorApiService, $de /** * Gets list of visitors */ - $visitorApiService.getCountVisitors($scope.search, {}).$promise.then( + visitorApiService.getCountVisitors($scope.search, {}).$promise.then( function (response) { if (response.error === null) { $scope.count = response.result; @@ -121,7 +121,7 @@ function ($location, $routeParams, DashboardListService, $visitorApiService, $de } ); - $visitorApiService.attributesInfo().$promise.then( + visitorApiService.attributesInfo().$promise.then( function (response) { var result = response.result || []; serviceList.init('visitors'); diff --git a/src/app/design/directives/guiAttributesEditorFormTabs.js b/src/app/design/directives/guiAttributesEditorFormTabs.js index 06c7c4df..86a6d61b 100644 --- a/src/app/design/directives/guiAttributesEditorFormTabs.js +++ b/src/app/design/directives/guiAttributesEditorFormTabs.js @@ -5,7 +5,7 @@ */ angular.module("designModule") -.directive("guiAttributesEditorFormTabs", ["$dashboardUtilsService", function ($dashboardUtilsService) { +.directive("guiAttributesEditorFormTabs", ["dashboardUtilsService", function (dashboardUtilsService) { return { restrict: "E", scope: { @@ -30,7 +30,7 @@ angular.module("designModule") if ($scope.otEditForm.$valid) { $scope.parent.save(); } else { - $scope.parent.message = $dashboardUtilsService.getMessage(null, "warning", "Form is invalid"); + $scope.parent.message = dashboardUtilsService.getMessage(null, "warning", "Form is invalid"); } }; diff --git a/src/app/design/image.service.js b/src/app/design/image.service.js index a565c6bb..17b00d06 100644 --- a/src/app/design/image.service.js +++ b/src/app/design/image.service.js @@ -1,6 +1,6 @@ angular.module('designModule') -.factory('$designImageService', [ +.factory('designImageService', [ 'MEDIA_BASE_PATH', function (MEDIA_BASE_PATH) { diff --git a/src/app/discounts/controller/edit.js b/src/app/discounts/controller/edit.js index 3f9266a4..ff630080 100644 --- a/src/app/discounts/controller/edit.js +++ b/src/app/discounts/controller/edit.js @@ -2,10 +2,10 @@ angular.module("discountsModule") .controller("editController", [ "$scope", - "$discountsService", + "discountsService", "$routeParams", "$location", - function($scope, $discountsService, $routeParams, $location) { + function($scope, discountsService, $routeParams, $location) { var isEditPage = !!$routeParams.id; @@ -21,12 +21,12 @@ angular.module("discountsModule") function activate() { if (isEditPage) { - $discountsService.one($routeParams.id) + discountsService.one($routeParams.id) .then(function(discount) { $scope.discount = discount; }); } else { - $scope.discount = $discountsService.defaults(); + $scope.discount = discountsService.defaults(); } } @@ -38,15 +38,15 @@ angular.module("discountsModule") function save() { if (isEditPage) { - $discountsService.put($scope.discount); + discountsService.put($scope.discount); } else { - $discountsService.post($scope.discount) + discountsService.post($scope.discount) .then(goToDiscount); } } function remove() { - $discountsService.remove($scope.discount._id) + discountsService.remove($scope.discount._id) .then(function(){ $location.path('/discounts'); }); diff --git a/src/app/discounts/controller/list.js b/src/app/discounts/controller/list.js index 4fbad248..5b004c79 100644 --- a/src/app/discounts/controller/list.js +++ b/src/app/discounts/controller/list.js @@ -2,9 +2,9 @@ angular.module("discountsModule") .controller("listController", [ "$scope", - "$discountsService", - function($scope, $discountsService){ - $discountsService.getList().then(function(discounts) { + "discountsService", + function($scope, discountsService){ + discountsService.getList().then(function(discounts) { $scope.discounts = discounts; }); } diff --git a/src/app/discounts/service/api.js b/src/app/discounts/service/api.js index 33e7d958..4ca19c24 100644 --- a/src/app/discounts/service/api.js +++ b/src/app/discounts/service/api.js @@ -9,7 +9,7 @@ angular.module("discountsModule") * percent * times */ -.service("$discountsService", [ +.service("discountsService", [ "$http", "REST_SERVER_URI", "moment", diff --git a/src/app/impex/controller.js b/src/app/impex/controller.js index 6ed658f1..43bd8c01 100644 --- a/src/app/impex/controller.js +++ b/src/app/impex/controller.js @@ -5,17 +5,17 @@ angular.module("impexModule") "$timeout", "$interval", "$sce", -"$impexApiService", -"$dashboardUtilsService", +"impexApiService", +"dashboardUtilsService", "REST_SERVER_URI", -function ($scope, $timeout, $interval, $sce, $impexApiService, $dashboardUtilsService, REST_SERVER_URI) { +function ($scope, $timeout, $interval, $sce, impexApiService, dashboardUtilsService, REST_SERVER_URI) { $scope.init = function () { - $impexApiService.getModels().$promise.then(function (response) { + impexApiService.getModels().$promise.then(function (response) { if(response.error === null) { $scope.modelList = response.result; } else { - $scope.message = $dashboardUtilsService.getMessage(response.error); + $scope.message = dashboardUtilsService.getMessage(response.error); } }); @@ -31,7 +31,7 @@ $scope.startImportTrack = function() { $scope.importTrackInterval = $interval(function() { - $impexApiService.importStatus().$promise.then(function(response) { + impexApiService.importStatus().$promise.then(function(response) { if (!response.result.position) return; $scope.importProgress = Math.round(response.result.position / response.result.size * 100); @@ -83,14 +83,14 @@ $scope.import = function(method) { $scope.startImportTrack(); - $impexApiService[apiMethodName](methodOptions, postData).$promise + impexApiService[apiMethodName](methodOptions, postData).$promise .then(function(response) { $scope.importMethod = null; $scope.cancelImportTrack(); $scope.message = (response.error === null) ? - $dashboardUtilsService.getMessage(null, 'success', response.result) : - $dashboardUtilsService.getMessage(response); + dashboardUtilsService.getMessage(null, 'success', response.result) : + dashboardUtilsService.getMessage(response); }); }; diff --git a/src/app/impex/service/api.js b/src/app/impex/service/api.js index b9d9379b..d0f72dd7 100644 --- a/src/app/impex/service/api.js +++ b/src/app/impex/service/api.js @@ -1,6 +1,6 @@ angular.module("impexModule") -.service("$impexApiService", ["$resource", "REST_SERVER_URI", function ($resource, REST_SERVER_URI) { +.service("impexApiService", ["$resource", "REST_SERVER_URI", function ($resource, REST_SERVER_URI) { return $resource(REST_SERVER_URI, {}, { "importBatch": { method: "POST", diff --git a/src/app/login/controller/login.js b/src/app/login/controller/login.js index 5a684d51..e45ac0a5 100644 --- a/src/app/login/controller/login.js +++ b/src/app/login/controller/login.js @@ -5,25 +5,25 @@ angular.module("loginModule") '$route', '$location', '$routeParams', -'$loginApiService', -'$loginLoginService', -'$dashboardUtilsService', -function ($scope, $route, $location, $routeParams, $loginApiService, $loginLoginService, $dashboardUtilsService) { +'loginApiService', +'loginLoginService', +'dashboardUtilsService', +function ($scope, $route, $location, $routeParams, loginApiService, loginLoginService, dashboardUtilsService) { $scope.loginCredentials = {}; $scope.login = function () { - $loginApiService.login($scope.loginCredentials).$promise.then(function (response) { + loginApiService.login($scope.loginCredentials).$promise.then(function (response) { if (response.result === 'ok') { window.location.assign("/"); } else { - $scope.message = $dashboardUtilsService.getMessage(response); + $scope.message = dashboardUtilsService.getMessage(response); } }); }; $scope.isLoggedIn = function () { - return $loginLoginService.isLoggedIn(); + return loginLoginService.isLoggedIn(); }; }]); diff --git a/src/app/login/controller/logout.js b/src/app/login/controller/logout.js index 10a4c9ec..ab35f718 100644 --- a/src/app/login/controller/logout.js +++ b/src/app/login/controller/logout.js @@ -2,12 +2,12 @@ angular.module("loginModule") .controller("loginLogoutController", [ "$scope", -"$loginLoginService", +"loginLoginService", "$location", -function ($scope, $loginLoginService, $location) { +function ($scope, loginLoginService, $location) { - if ($loginLoginService.isLoggedIn()) { - $loginLoginService.logout().then( + if (loginLoginService.isLoggedIn()) { + loginLoginService.logout().then( function () { $location.path("/login"); } diff --git a/src/app/login/init.js b/src/app/login/init.js index f82bfccd..52e7c437 100644 --- a/src/app/login/init.js +++ b/src/app/login/init.js @@ -14,10 +14,10 @@ angular.module("loginModule", ["ngRoute", "ngResource"]) templateUrl: "/views/login/login.html", controller: "loginLoginController", resolve: { - 'auth' : function($loginLoginService,$q,$location){ + 'auth' : function(loginLoginService,$q,$location){ var def = $q.defer(); - $loginLoginService.init().then(function(auth){ + loginLoginService.init().then(function(auth){ if (auth) { $location.url('/'); diff --git a/src/app/login/service/api.js b/src/app/login/service/api.js index a1ec2e8a..cbad690d 100644 --- a/src/app/login/service/api.js +++ b/src/app/login/service/api.js @@ -1,10 +1,10 @@ angular.module("loginModule") /** - * $loginApiService interaction service + * loginApiService interaction service */ -.service("$loginApiService", ["$resource", "REST_SERVER_URI", function ($resource, REST_SERVER_URI) { +.service("loginApiService", ["$resource", "REST_SERVER_URI", function ($resource, REST_SERVER_URI) { return $resource(REST_SERVER_URI, {}, { "login": { diff --git a/src/app/login/service/login.js b/src/app/login/service/login.js index 4b84e79b..db2c061c 100644 --- a/src/app/login/service/login.js +++ b/src/app/login/service/login.js @@ -1,10 +1,10 @@ angular.module("loginModule") -.service('$loginLoginService', [ +.service('loginLoginService', [ '$resource', - '$loginApiService', + 'loginApiService', '$q', - function ($resource, $loginApiService, $q) { + function ($resource, loginApiService, $q) { /** Variables */ var login, isAdmin, isLoggedIn, deferIsLoggedIn , mapFields, deferLogOut; @@ -67,7 +67,7 @@ angular.module("loginModule") return deferIsLoggedIn.promise; } - $loginApiService.info().$promise.then( + loginApiService.info().$promise.then( function (response) { if (response.error === null) { isAdmin = response.result['is_admin'] || false; @@ -94,7 +94,7 @@ angular.module("loginModule") logout = function () { deferLogOut = $q.defer(); - $loginApiService.logout().$promise.then(function(res){ + loginApiService.logout().$promise.then(function(res){ if (res.error === null){ isLoggedIn = false; login = getDefaultLogin(); diff --git a/src/app/order/api.service.js b/src/app/order/api.service.js index 14bde511..3a741e86 100644 --- a/src/app/order/api.service.js +++ b/src/app/order/api.service.js @@ -1,6 +1,6 @@ angular.module("orderModule") -.service("$orderApiService", ["$resource", "REST_SERVER_URI", function ($resource, REST_SERVER_URI) { +.service("orderApiService", ["$resource", "REST_SERVER_URI", function ($resource, REST_SERVER_URI) { return $resource(REST_SERVER_URI, {}, { "orderList": { method: "GET", diff --git a/src/app/order/edit.controller.js b/src/app/order/edit.controller.js index 8592109a..40cb51e6 100644 --- a/src/app/order/edit.controller.js +++ b/src/app/order/edit.controller.js @@ -5,9 +5,9 @@ angular.module("orderModule") "$routeParams", "$location", "$q", -"$orderApiService", -"$dashboardUtilsService", -function ($scope, $routeParams, $location, $q, $orderApiService, $dashboardUtilsService) { +"orderApiService", +"dashboardUtilsService", +function ($scope, $routeParams, $location, $q, orderApiService, dashboardUtilsService) { var orderId, getDefaultOrder, oldString; orderId = $routeParams.id; @@ -78,7 +78,7 @@ function ($scope, $routeParams, $location, $q, $orderApiService, $dashboardUtils /** * Gets list all attributes of order */ - $orderApiService.getAttributes().$promise.then( + orderApiService.getAttributes().$promise.then( function (response) { var result = response.result || []; $scope.attributes = result; @@ -86,7 +86,7 @@ function ($scope, $routeParams, $location, $q, $orderApiService, $dashboardUtils ); if (null !== orderId) { - $orderApiService.getOrder({"orderID": orderId}).$promise.then( + orderApiService.getOrder({"orderID": orderId}).$promise.then( function (response) { var result = response.result || {}; $scope.order = result; @@ -107,11 +107,11 @@ function ($scope, $routeParams, $location, $q, $orderApiService, $dashboardUtils delete $scope.order.notes; // if you submit notes it will replace all notes if (orderId !== null && JSON.stringify(oldString) !== JSON.stringify($scope.order)) { - $orderApiService.update({"orderID": orderId}, $scope.order).$promise.then(function (response) { + orderApiService.update({"orderID": orderId}, $scope.order).$promise.then(function (response) { // Success if (response.error === null) { - $scope.message = $dashboardUtilsService.getMessage(null , 'success', 'Order was updated successfully'); + $scope.message = dashboardUtilsService.getMessage(null , 'success', 'Order was updated successfully'); // Update the notes list with whatever is on the server. // we get the whole order back, so we could set the entire thing @@ -124,7 +124,7 @@ function ($scope, $routeParams, $location, $q, $orderApiService, $dashboardUtils } } } else { - $scope.message = $dashboardUtilsService.getMessage(response); + $scope.message = dashboardUtilsService.getMessage(response); } $('[ng-click="save()"]').removeClass('disabled').children('i').remove(); $('[ng-click="save()"]').siblings('.btn').removeClass('disabled'); diff --git a/src/app/order/list.controller.js b/src/app/order/list.controller.js index 4377eefa..7bab855e 100644 --- a/src/app/order/list.controller.js +++ b/src/app/order/list.controller.js @@ -3,13 +3,13 @@ angular.module('orderModule') .controller('orderListController', [ '$scope', '$location', - '$dashboardListService', - '$orderApiService', + 'dashboardListService', + 'orderApiService', function( $scope, $location, DashboardListService, - $orderApiService + orderApiService ) { var serviceList = new DashboardListService(); @@ -92,7 +92,7 @@ angular.module('orderModule') var params = $location.search(); params.extra = serviceList.getExtraFields(); - $orderApiService.orderList(params).$promise + orderApiService.orderList(params).$promise .then(function(response) { var result = response.result || []; $scope.orders = serviceList.getList(result); @@ -104,21 +104,21 @@ angular.module('orderModule') angular.copy(searchDefaults, params); params.status = 'processed'; - $orderApiService.getCount(params).$promise + orderApiService.getCount(params).$promise .then(function(response) { $scope.tabs.processedCount = response.result || 0; }); } function getOrderCount() { - $orderApiService.getCount($location.search()).$promise + orderApiService.getCount($location.search()).$promise .then(function(response) { $scope.count = (response.error === null) ? response.result : 0; }); } function getAttributeList() { - $orderApiService.getAttributes().$promise.then( + orderApiService.getAttributes().$promise.then( function(response) { var result = response.result || []; serviceList.init('orders'); diff --git a/src/app/order/print.controller.js b/src/app/order/print.controller.js index ca18f276..687f62bc 100644 --- a/src/app/order/print.controller.js +++ b/src/app/order/print.controller.js @@ -5,9 +5,9 @@ angular.module('orderModule') '$location', '$q', '$timeout', - '$orderApiService', - '$cmsApiService', - function($scope, $location, $q, $timeout, $orderApiService, $cmsApiService) { + 'orderApiService', + 'cmsApiService', + function($scope, $location, $q, $timeout, orderApiService, cmsApiService) { $scope.options = { showPrice: 0 @@ -39,7 +39,7 @@ angular.module('orderModule') function fetchOrders(ids) { var allPromises = []; angular.forEach(ids, function(id) { - var promise = $orderApiService.getOrder({ + var promise = orderApiService.getOrder({ 'orderID': id }).$promise .then(function(resp) { @@ -71,7 +71,7 @@ angular.module('orderModule') 'extra': 'content', }; - $cmsApiService.blockList(params).$promise + cmsApiService.blockList(params).$promise .then(function(resp) { // Normalize response if (resp.result) { diff --git a/src/app/product/controller/attributeEdit.js b/src/app/product/controller/attributeEdit.js index 38b2a802..92c2a245 100644 --- a/src/app/product/controller/attributeEdit.js +++ b/src/app/product/controller/attributeEdit.js @@ -4,9 +4,9 @@ angular.module("productModule") "$scope", "$routeParams", "$location", -"$productApiService", -"$dashboardUtilsService", -function ($scope, $routeParams, $location, $productApiService, $dashboardUtilsService) { +"productApiService", +"dashboardUtilsService", +function ($scope, $routeParams, $location, productApiService, dashboardUtilsService) { var editableFields, requiredFields, formDisable, formEnable, attr, formValidate; attr = $routeParams.attr; @@ -50,7 +50,7 @@ function ($scope, $routeParams, $location, $productApiService, $dashboardUtilsSe /** * Gets list all attributes of product */ - $productApiService.attributesInfo().$promise.then( + productApiService.attributesInfo().$promise.then( function (response) { var result, i; result = response.result || []; @@ -85,11 +85,11 @@ function ($scope, $routeParams, $location, $productApiService, $dashboardUtilsSe if ($scope.attribute.hasOwnProperty(field)) { value = $scope.attribute[field] || ""; if (!value.match(requiredFields[field])) { - $scope.message = $dashboardUtilsService.getMessage(null, 'warning', 'The field '+ field +' invalid'); + $scope.message = dashboardUtilsService.getMessage(null, 'warning', 'The field '+ field +' invalid'); return false; } } else { - $scope.message = $dashboardUtilsService.getMessage(null, 'warning', 'The field '+ field +' is not specified'); + $scope.message = dashboardUtilsService.getMessage(null, 'warning', 'The field '+ field +' is not specified'); return false; } } @@ -108,19 +108,19 @@ function ($scope, $routeParams, $location, $productApiService, $dashboardUtilsSe if (-1 !== ["multi_select"].indexOf($scope.attribute.Editors)) { $scope.attribute.Type = "[]text"; } - $productApiService.addAttribute($scope.attribute).$promise.then(function (response) { + productApiService.addAttribute($scope.attribute).$promise.then(function (response) { if (response.error === null) { - $scope.message = $dashboardUtilsService.getMessage(null, 'success', 'Attribute was updated successfully'); + $scope.message = dashboardUtilsService.getMessage(null, 'success', 'Attribute was updated successfully'); } else { - $scope.message = $dashboardUtilsService.getMessage(response); + $scope.message = dashboardUtilsService.getMessage(response); } }); } else { - $productApiService.updateAttribute({"attribute": attr}, $scope.attribute).$promise.then(function (response) { + productApiService.updateAttribute({"attribute": attr}, $scope.attribute).$promise.then(function (response) { if (response.error === null) { - $scope.message = $dashboardUtilsService.getMessage(null, 'success', 'Attribute was updated successfully'); + $scope.message = dashboardUtilsService.getMessage(null, 'success', 'Attribute was updated successfully'); } else { - $scope.message = $dashboardUtilsService.getMessage(response); + $scope.message = dashboardUtilsService.getMessage(response); } }); } diff --git a/src/app/product/controller/attributeList.js b/src/app/product/controller/attributeList.js index bfef323e..8c58b2ee 100644 --- a/src/app/product/controller/attributeList.js +++ b/src/app/product/controller/attributeList.js @@ -4,9 +4,9 @@ angular.module("productModule") "$scope", "$routeParams", "$q", -"$productApiService", +"productApiService", "$location", -function ($scope, $routeParams, $q, $productApiService, $location) { +function ($scope, $routeParams, $q, productApiService, $location) { $scope.fields = [ { "attribute": "Label", @@ -39,7 +39,7 @@ function ($scope, $routeParams, $q, $productApiService, $location) { */ var params = $location.search(); params["extra"] = getFields(); - $productApiService.attributesInfo(params).$promise.then( + productApiService.attributesInfo(params).$promise.then( function (response) { var result, i; $scope.attributesList = []; @@ -69,7 +69,7 @@ function ($scope, $routeParams, $q, $productApiService, $location) { var remove = function (attr) { var defer = $q.defer(); - $productApiService.deleteAttribute({"attribute": attr}, + productApiService.deleteAttribute({"attribute": attr}, function (response) { if (response.result === "ok") { defer.resolve(attr); diff --git a/src/app/product/controller/edit.js b/src/app/product/controller/edit.js index b939fa87..b4717301 100644 --- a/src/app/product/controller/edit.js +++ b/src/app/product/controller/edit.js @@ -5,10 +5,10 @@ angular.module("productModule") "$routeParams", "$location", "$q", -"$productApiService", -"$designImageService", -"$dashboardUtilsService", -function ($scope, $routeParams, $location, $q, $productApiService, $designImageService, $dashboardUtilsService) { +"productApiService", +"designImageService", +"dashboardUtilsService", +function ($scope, $routeParams, $location, $q, productApiService, designImageService, dashboardUtilsService) { var productId, getDefaultProduct, addImageManagerAttribute, addStockValues; @@ -67,7 +67,7 @@ function ($scope, $routeParams, $location, $q, $productApiService, $designImageS /** * Gets list all attributes of product */ - $productApiService.attributesInfo().$promise.then( + productApiService.attributesInfo().$promise.then( function (response) { var result = response.result || []; $scope.attributes = result; @@ -78,7 +78,7 @@ function ($scope, $routeParams, $location, $q, $productApiService, $designImageS // options of this product checking is the "Options" from response are present // Map "$scope.product.options" with product options is to complicated and need to be simplified in future addStockValues = function () { - $productApiService.getStock({"productID": productId}).$promise.then( + productApiService.getStock({"productID": productId}).$promise.then( function (response) { var result = response.result || {}; for (var i = 0; i < result.length; i+=1) { @@ -97,7 +97,7 @@ function ($scope, $routeParams, $location, $q, $productApiService, $designImageS * Gets product data */ if (null !== productId) { - $productApiService.getProduct({"productID": productId}).$promise.then( + productApiService.getProduct({"productID": productId}).$promise.then( function (response) { var result = response.result || {}; $scope.product = result; @@ -143,11 +143,11 @@ function ($scope, $routeParams, $location, $q, $productApiService, $designImageS if (response.error === null) { $scope.product._id = response.result._id; $scope.productImages = []; - $scope.message = $dashboardUtilsService.getMessage(null, 'success', 'Product was created successfully'); + $scope.message = dashboardUtilsService.getMessage(null, 'success', 'Product was created successfully'); addImageManagerAttribute(); defer.resolve($scope.product); } else { - $scope.message = $dashboardUtilsService.getMessage(response); + $scope.message = dashboardUtilsService.getMessage(response); } $('[ng-click="save()"]').removeClass('disabled').children('i').remove(); $('[ng-click="save()"]').siblings('.btn').removeClass('disabled'); @@ -158,7 +158,7 @@ function ($scope, $routeParams, $location, $q, $productApiService, $designImageS * @param response */ saveError = function () { - $scope.message = $dashboardUtilsService.getMEssage(null, 'danger', 'Something went wrong'); + $scope.message = dashboardUtilsService.getMEssage(null, 'danger', 'Something went wrong'); $('[ng-click="save()"]').removeClass('disabled').children('i').remove(); $('[ng-click="save()"]').siblings('.btn').removeClass('disabled'); defer.resolve(false); @@ -171,10 +171,10 @@ function ($scope, $routeParams, $location, $q, $productApiService, $designImageS updateSuccess = function (response) { if (response.error === null) { var result = response.result || getDefaultProduct(); - $scope.message = $dashboardUtilsService.getMessage(null, 'success', 'Product was updated successfully'); + $scope.message = dashboardUtilsService.getMessage(null, 'success', 'Product was updated successfully'); defer.resolve(result); } else { - $scope.message = $dashboardUtilsService.getMessage(response); + $scope.message = dashboardUtilsService.getMessage(response); } $('[ng-click="save()"]').removeClass('disabled').children('i').remove(); $('[ng-click="save()"]').siblings('.btn').removeClass('disabled'); @@ -185,17 +185,17 @@ function ($scope, $routeParams, $location, $q, $productApiService, $designImageS * @param response */ updateError = function () { - $scope.message = $dashboardUtilsService.getMessage(null, 'danger', 'Something went wrong'); + $scope.message = dashboardUtilsService.getMessage(null, 'danger', 'Something went wrong'); $('[ng-click="save()"]').removeClass('disabled').children('i').remove(); $('[ng-click="save()"]').siblings('.btn').removeClass('disabled'); defer.resolve(false); }; if (!id) { - $productApiService.save($scope.product, saveSuccess, saveError); + productApiService.save($scope.product, saveSuccess, saveError); } else { $scope.product.id = id; - $productApiService.update($scope.product, updateSuccess, updateError); + productApiService.update($scope.product, updateSuccess, updateError); } return defer.promise; @@ -212,13 +212,13 @@ function ($scope, $routeParams, $location, $q, $productApiService, $designImageS $scope.reloadImages = function () { if ($scope.product !== undefined && $scope.product._id !== undefined) { // taking media patch for new product - $productApiService.getImagePath({"productID": $scope.product._id}).$promise.then( + productApiService.getImagePath({"productID": $scope.product._id}).$promise.then( function (response) { $scope.imagesPath = response.result || ""; }); // taking registered images for product - $productApiService.listImages({"productID": $scope.product._id}).$promise.then( + productApiService.listImages({"productID": $scope.product._id}).$promise.then( function (response) { $scope.productImages = response.result || []; }); @@ -243,7 +243,7 @@ function ($scope, $routeParams, $location, $q, $productApiService, $designImageS postData.append("file", file.files[0]); if (pid !== undefined) { - $productApiService.addImage({"productID": pid, "mediaName": mediaName}, postData) + productApiService.addImage({"productID": pid, "mediaName": mediaName}, postData) .$promise.then(function () { $scope.reloadImages(); }); @@ -259,7 +259,7 @@ function ($scope, $routeParams, $location, $q, $productApiService, $designImageS var pid = $scope.product._id, mediaName = selected; if (pid !== undefined && selected !== undefined) { - $productApiService.removeImage({"productID": pid, "mediaName": mediaName}) + productApiService.removeImage({"productID": pid, "mediaName": mediaName}) .$promise.then(function () { $scope.selectedImage = undefined; $scope.reloadImages(); @@ -287,6 +287,6 @@ function ($scope, $routeParams, $location, $q, $productApiService, $designImageS * @returns {string} - full path to image */ $scope.getImage = function (image) { - return $designImageService.getImage(image); + return designImageService.getImage(image); }; }]); diff --git a/src/app/product/controller/list.js b/src/app/product/controller/list.js index 37cda81b..85a12cf4 100644 --- a/src/app/product/controller/list.js +++ b/src/app/product/controller/list.js @@ -5,12 +5,12 @@ angular.module("productModule") "$location", "$routeParams", "$q", -"$dashboardListService", -"$productApiService", -"$dashboardUtilsService", +"dashboardListService", +"productApiService", +"dashboardUtilsService", "COUNT_ITEMS_PER_PAGE", -function ($scope, $location, $routeParams, $q, DashboardListService, $productApiService, - $dashboardUtilsService, COUNT_ITEMS_PER_PAGE) { +function ($scope, $location, $routeParams, $q, DashboardListService, productApiService, + dashboardUtilsService, COUNT_ITEMS_PER_PAGE) { var serviceList, getProductsList, getAttributeList, getProductCount, showColumns; // Initialize SEO @@ -43,7 +43,7 @@ function ($scope, $location, $routeParams, $q, DashboardListService, $productApi getProductsList = function () { var params = $location.search(); params["extra"] = serviceList.getExtraFields(); - $productApiService.productList(params).$promise.then( + productApiService.productList(params).$promise.then( function (response) { var result, i; $scope.productsTmp = []; @@ -62,7 +62,7 @@ function ($scope, $location, $routeParams, $q, DashboardListService, $productApi * Gets count products */ getProductCount = function () { - $productApiService.getCount($location.search(), {}).$promise.then(function (response) { + productApiService.getCount($location.search(), {}).$promise.then(function (response) { if (response.error === null) { $scope.count = response.result; } else { @@ -75,7 +75,7 @@ function ($scope, $location, $routeParams, $q, DashboardListService, $productApi * Gets attribute list */ getAttributeList = function () { - $productApiService.attributesInfo().$promise.then(function (response) { + productApiService.attributesInfo().$promise.then(function (response) { var result = response.result || []; serviceList.init('products'); @@ -127,7 +127,7 @@ function ($scope, $location, $routeParams, $q, DashboardListService, $productApi _remove = function (id) { var defer = $q.defer(); - $productApiService.remove({"productID": id}, + productApiService.remove({"productID": id}, function (response) { if (response.result === "ok") { defer.resolve(id); @@ -149,7 +149,7 @@ function ($scope, $location, $routeParams, $q, DashboardListService, $productApi $scope.products.splice(i, 1); } } - $scope.message = $dashboardUtilsService.getMessage(null, 'success', 'Product(s) was removed successfully'); + $scope.message = dashboardUtilsService.getMessage(null, 'success', 'Product(s) was removed successfully'); } }; for (id in $scope.idsSelectedRows) { diff --git a/src/app/product/service/api.js b/src/app/product/service/api.js index 804e5013..aa227fc8 100644 --- a/src/app/product/service/api.js +++ b/src/app/product/service/api.js @@ -1,7 +1,7 @@ angular.module("productModule") /** -* $productApiService contains objects to interact with REST-server +* productApiService contains objects to interact with REST-server * Objects: * attributesInfo() - gets attributes list * deleteAttribute(attribute) - deletes attributes by name @@ -18,7 +18,7 @@ angular.module("productModule") * addImage(productId, mediaName) - adds image in product */ -.service("$productApiService", ["$resource", "REST_SERVER_URI", function ($resource, REST_SERVER_URI) { +.service("productApiService", ["$resource", "REST_SERVER_URI", function ($resource, REST_SERVER_URI) { return $resource(REST_SERVER_URI, {}, { "attributesInfo": { method: "GET", diff --git a/src/app/seo/controller/edit.js b/src/app/seo/controller/edit.js index c7d1017f..04110124 100644 --- a/src/app/seo/controller/edit.js +++ b/src/app/seo/controller/edit.js @@ -5,9 +5,9 @@ angular.module("seoModule") "$routeParams", "$location", "$q", - "$seoApiService", - "$dashboardUtilsService", - function ($scope, $routeParams, $location, $q, $seoApiService, $dashboardUtilsService) { + "seoApiService", + "dashboardUtilsService", + function ($scope, $routeParams, $location, $q, seoApiService, dashboardUtilsService) { // Functions var getAttributeList, getDefaultSEO, checkAttributePosition, getRewriteList; // Variables @@ -81,7 +81,7 @@ angular.module("seoModule") * Gets values for url rewrites :( */ var getSeoValues = function(id) { - $seoApiService.canonical({"id": id}).$promise.then( + seoApiService.canonical({"id": id}).$promise.then( function (response) { seoRewriteList[response.result["rewrite"]] = response.result["_id"]; } @@ -89,7 +89,7 @@ angular.module("seoModule") }; getRewriteList = function () { - $seoApiService.list().$promise.then( + seoApiService.list().$promise.then( function (response) { seoRewriteList = {}; var i, seoList = response.result || []; @@ -103,7 +103,7 @@ angular.module("seoModule") getRewriteList(); if (null !== seoId) { - $seoApiService.canonical({"id": seoId}).$promise.then(function (response) { + seoApiService.canonical({"id": seoId}).$promise.then(function (response) { var result = response.result || {}; $scope.seo = result; }); @@ -134,7 +134,7 @@ angular.module("seoModule") saveSuccess = function (response) { if (response.error === null) { $scope.seo = response.result || getDefaultSEO(); - $scope.message = $dashboardUtilsService.getMessage(null, 'success', 'URL rewrite was created successfully'); + $scope.message = dashboardUtilsService.getMessage(null, 'success', 'URL rewrite was created successfully'); defer.resolve(true); } $('[ng-click="save()"]').removeClass('disabled').children('i').remove(); @@ -158,7 +158,7 @@ angular.module("seoModule") updateSuccess = function (response) { if (response.error === null) { $scope.seo = response.result || getDefaultSEO(); - $scope.message = $dashboardUtilsService.getMessage(null, 'success', 'URL rewrite was updated successfully'); + $scope.message = dashboardUtilsService.getMessage(null, 'success', 'URL rewrite was updated successfully'); defer.resolve(true); $('[ng-click="save()"]').removeClass('disabled').children('i').remove(); $('[ng-click="save()"]').siblings('.btn').removeClass('disabled'); @@ -180,21 +180,21 @@ angular.module("seoModule") * checking is rewrite don't replace existing */ if (!$scope.seo.rewrite || $scope.seo.rewrite === "" || $scope.seo.rewrite.length < 4 || !regexp.test($scope.seo.url)) { - $scope.message = $dashboardUtilsService.getMessage(null, 'warning', 'Need to specify object to rewrite and valid url'); + $scope.message = dashboardUtilsService.getMessage(null, 'warning', 'Need to specify object to rewrite and valid url'); updateError(); } else { if (typeof seoRewriteList[$scope.seo.rewrite] === "undefined") { if (typeof id !== "undefined") { - $seoApiService.update({"itemID": id}, $scope.seo, updateSuccess, updateError); + seoApiService.update({"itemID": id}, $scope.seo, updateSuccess, updateError); } else { - $seoApiService.add($scope.seo, saveSuccess, saveError); + seoApiService.add($scope.seo, saveSuccess, saveError); } } else { if (id === seoRewriteList[$scope.seo.rewrite]) { - $seoApiService.update({"itemID": id}, $scope.seo, updateSuccess, updateError); + seoApiService.update({"itemID": id}, $scope.seo, updateSuccess, updateError); } - $scope.message = $dashboardUtilsService.getMessage(null, 'warning', 'Rewrite for this object is already exist'); + $scope.message = dashboardUtilsService.getMessage(null, 'warning', 'Rewrite for this object is already exist'); saveError(); } } diff --git a/src/app/seo/controller/editSeo.js b/src/app/seo/controller/editSeo.js index aba7462d..91fdf93f 100644 --- a/src/app/seo/controller/editSeo.js +++ b/src/app/seo/controller/editSeo.js @@ -2,25 +2,25 @@ angular.module("seoModule") .controller("seoEditController", [ "$scope", - "$seoService", - "$dashboardUtilsService", + "seoService", + "dashboardUtilsService", "$timeout", - function ($scope, $seoService, $dashboardUtilsService, $timeout) { + function ($scope, seoService, dashboardUtilsService, $timeout) { var isInit, seo, seoFields, seoUniqueFields, itemName, hasAttribute, save, remove, isModifySave, isInitUrlRewrite, modifyRemoveMethod, isModifyRemove, modifySaveMethod, addAttributes, addAttributesValue, getDefaultSeo, removeAttributes, saveSeo, getUniqueSeoNames; - $seoService.init(); + seoService.init(); getDefaultSeo = function () { - var defObj = $seoService.getDefaultSeo(); + var defObj = seoService.getDefaultSeo(); defObj.rewrite = typeof $scope[itemName] !== "undefined" ? $scope[itemName]._id : ""; defObj.type = itemName; return defObj; }; - seoFields = $seoService.getSeoFields(); + seoFields = seoService.getSeoFields(); seoUniqueFields = []; isModifySave = false; isModifyRemove = false; @@ -75,11 +75,11 @@ angular.module("seoModule") }; saveSeo = function (oldSeo) { - var existingSeo = $seoService.find(itemName, oldSeo.rewrite); + var existingSeo = seoService.find(itemName, oldSeo.rewrite); if (existingSeo) { var callback = function (response) { seo._id = response.result._id; - $seoService.update(seo).then( + seoService.update(seo).then( function (response) { seo = response || null; for (var i = 0; i < seoFields.length; i += 1) { @@ -89,9 +89,9 @@ angular.module("seoModule") } ); }; - $seoService.get(oldSeo._id).then(callback); + seoService.get(oldSeo._id).then(callback); } else { - $seoService.save(seo).then( + seoService.save(seo).then( function (response) { seo = response || null; for (var i = 0; i < seoFields.length; i += 1) { @@ -114,7 +114,7 @@ angular.module("seoModule") delete $scope.save; if (typeof seo._id === "undefined" && seo.url !== "") { - $seoService.get(seo._id).then(function (response) { + seoService.get(seo._id).then(function (response) { if (response.result !== null) { for (var i = 0; i < seoFields.length; i += 1) { $scope[itemName][seoUniqueFields[i]] = response.result[seoFields[i]]; @@ -124,7 +124,7 @@ angular.module("seoModule") } $scope.save = function () { - var oldSeo = $dashboardUtilsService.clone(seo); + var oldSeo = dashboardUtilsService.clone(seo); for (var i = 0; i < seoFields.length; i += 1) { seo[seoFields[i]] = $scope[itemName][seoUniqueFields[i]]; @@ -156,14 +156,14 @@ angular.module("seoModule") var seo; var callback = function (response) { if (response.result !== null) { - $seoService.remove(response.result); + seoService.remove(response.result); } }; for (var id in $scope.idsSelectedRows) { if ($scope.idsSelectedRows.hasOwnProperty(id) && true === $scope.idsSelectedRows[id]) { - seo = $seoService.find(itemName, id); + seo = seoService.find(itemName, id); if (seo !== null) { - $seoService.get(seo._id).then(callback); + seoService.get(seo._id).then(callback); } } } @@ -233,7 +233,7 @@ angular.module("seoModule") addAttributesValue = function () { $timeout(function() { if (typeof $scope[itemName] !== "undefined" && !isInitUrlRewrite) { - seo = $seoService.find(itemName, $scope[itemName]._id); + seo = seoService.find(itemName, $scope[itemName]._id); if (seo === null) { seo = getDefaultSeo(); } diff --git a/src/app/seo/controller/list.js b/src/app/seo/controller/list.js index 400ab457..49d75133 100644 --- a/src/app/seo/controller/list.js +++ b/src/app/seo/controller/list.js @@ -6,10 +6,10 @@ angular.module("seoModule") "$location", "$routeParams", "$q", - "$dashboardListService", - "$seoApiService", + "dashboardListService", + "seoApiService", "COUNT_ITEMS_PER_PAGE", - function ($rootScope, $scope, $location, $routeParams, $q, DashboardListService, $seoApiService, COUNT_ITEMS_PER_PAGE) { + function ($rootScope, $scope, $location, $routeParams, $q, DashboardListService, seoApiService, COUNT_ITEMS_PER_PAGE) { var getSeoList, serviceList, getAttributeList, showColumns, seoList, seoIdToUrl; serviceList = new DashboardListService(); @@ -26,7 +26,7 @@ angular.module("seoModule") * Gets list and count of url rewrites */ getSeoList = function() { - $seoApiService.list().$promise.then( + seoApiService.list().$promise.then( function (response) { seoList = response.result || []; $scope.count = seoList.length; @@ -113,7 +113,7 @@ angular.module("seoModule") _remove = function (id) { var defer = $q.defer(); - $seoApiService.remove({"itemID": id}, + seoApiService.remove({"itemID": id}, function (response) { if (response.result === "ok") { defer.resolve(id); diff --git a/src/app/seo/service/api.js b/src/app/seo/service/api.js index a6b8dc76..027bd50c 100644 --- a/src/app/seo/service/api.js +++ b/src/app/seo/service/api.js @@ -1,6 +1,6 @@ angular.module("seoModule") -.service("$seoApiService", ["$resource", "REST_SERVER_URI", function ($resource, REST_SERVER_URI) { +.service("seoApiService", ["$resource", "REST_SERVER_URI", function ($resource, REST_SERVER_URI) { return $resource(REST_SERVER_URI, {}, { "add": { method: "POST", diff --git a/src/app/seo/service/seo.js b/src/app/seo/service/seo.js index cd469072..fc47be0b 100644 --- a/src/app/seo/service/seo.js +++ b/src/app/seo/service/seo.js @@ -1,11 +1,11 @@ angular.module("seoModule") -.service("$seoService", [ +.service("seoService", [ "$resource", - "$seoApiService", + "seoApiService", "$q", - "$dashboardUtilsService", - function ($resource, $seoApiService, $q, $dashboardUtilsService) { + "dashboardUtilsService", + function ($resource, seoApiService, $q, dashboardUtilsService) { // Variables var list, oldValue, seoFields; @@ -25,7 +25,7 @@ angular.module("seoModule") }; init = function () { - $seoApiService.list().$promise.then( + seoApiService.list().$promise.then( function (response) { list = response.result || []; } @@ -39,7 +39,7 @@ angular.module("seoModule") for (i = 0; i < list.length; i += 1) { if (list[i].type === type && list[i].rewrite === rewrite) { if(typeof oldValue === "undefined") { - oldValue = $dashboardUtilsService.clone(list[i]); + oldValue = dashboardUtilsService.clone(list[i]); } return list[i]; @@ -52,7 +52,7 @@ angular.module("seoModule") canonical = function (id) { var defer = $q.defer(); - $seoApiService.canonical({"id": id}).$promise.then( + seoApiService.canonical({"id": id}).$promise.then( function (response) { defer.resolve(response); } @@ -66,14 +66,14 @@ angular.module("seoModule") if (!isModified(obj)) { defer.resolve(obj); } else { - $seoApiService.update({"itemID": obj._id}, obj).$promise.then( + seoApiService.update({"itemID": obj._id}, obj).$promise.then( function (response) { var i; for (i = 0; i < list.length; i += 1) { if (list[i]._id === response.result._id) { list[i] = response.result; - oldValue = $dashboardUtilsService.clone(list[i]); + oldValue = dashboardUtilsService.clone(list[i]); defer.resolve(list[i]); } @@ -91,12 +91,12 @@ angular.module("seoModule") if (!isModified(obj)) { defer.resolve(obj); } else { - $seoApiService.add(obj).$promise.then( + seoApiService.add(obj).$promise.then( function (response) { if (response.error === null) { var result = response.result || null; list.push(result); - oldValue = $dashboardUtilsService.clone(result); + oldValue = dashboardUtilsService.clone(result); defer.resolve(result); } } @@ -108,7 +108,7 @@ angular.module("seoModule") remove = function (obj) { var defer = $q.defer(); - $seoApiService.remove({"itemID": obj._id}, obj).$promise.then( + seoApiService.remove({"itemID": obj._id}, obj).$promise.then( function (response) { if (response.error === null) { var result = response.result || null; diff --git a/src/app/subscriptions/controller/edit.js b/src/app/subscriptions/controller/edit.js index e2513a9a..43adb416 100644 --- a/src/app/subscriptions/controller/edit.js +++ b/src/app/subscriptions/controller/edit.js @@ -3,9 +3,9 @@ angular.module("subscriptionsModule") .controller("subscriptionsEditController", [ "$scope", "$routeParams", - "$subscriptionsApiService", - "$dashboardUtilsService", - function($scope, $routeParams, $subscriptionsApiService, $dashboardUtilsService) { + "subscriptionsApiService", + "dashboardUtilsService", + function($scope, $routeParams, subscriptionsApiService, dashboardUtilsService) { var subscriptionId = $routeParams.id; @@ -24,7 +24,7 @@ angular.module("subscriptionsModule") id: subscriptionId }; - $subscriptionsApiService.one(params).$promise.then(function(response) { + subscriptionsApiService.one(params).$promise.then(function(response) { // Set subscription $scope.subscription = response.result || {}; @@ -39,10 +39,10 @@ angular.module("subscriptionsModule") status: 'canceled', }; - $subscriptionsApiService.update(params).$promise + subscriptionsApiService.update(params).$promise .then(function(response){ console.log('updated', response); - $scope.message = $dashboardUtilsService.getMessage(null , 'success', 'Subscription was updated successfully'); + $scope.message = dashboardUtilsService.getMessage(null , 'success', 'Subscription was updated successfully'); }); }; diff --git a/src/app/subscriptions/controller/list.js b/src/app/subscriptions/controller/list.js index 8c18d31a..22733d3b 100644 --- a/src/app/subscriptions/controller/list.js +++ b/src/app/subscriptions/controller/list.js @@ -6,10 +6,10 @@ angular.module("subscriptionsModule") "$location", "$routeParams", "$q", -"$dashboardListService", -"$subscriptionsApiService", +"dashboardListService", +"subscriptionsApiService", "COUNT_ITEMS_PER_PAGE", -function ($rootScope, $scope, $location, $routeParams, $q, DashboardListService, $subscriptionsApiService, COUNT_ITEMS_PER_PAGE) { +function ($rootScope, $scope, $location, $routeParams, $q, DashboardListService, subscriptionsApiService, COUNT_ITEMS_PER_PAGE) { var serviceList = new DashboardListService(); var showColumns = { @@ -48,7 +48,7 @@ function ($rootScope, $scope, $location, $routeParams, $q, DashboardListService, var params = $location.search(); params["extra"] = serviceList.getExtraFields(); - $subscriptionsApiService.list(params).$promise.then( + subscriptionsApiService.list(params).$promise.then( function (response) { var result = response.result || []; $scope.subscriptions = serviceList.getList(result); @@ -57,7 +57,7 @@ function ($rootScope, $scope, $location, $routeParams, $q, DashboardListService, } function getCount() { - $subscriptionsApiService.getCount($location.search(), {}).$promise + subscriptionsApiService.getCount($location.search(), {}).$promise .then(function (response) { $scope.count = (!response.error && response.result) ? response.result : 0; }); diff --git a/src/app/subscriptions/service/api.js b/src/app/subscriptions/service/api.js index 5c9f88b5..6c0e678c 100644 --- a/src/app/subscriptions/service/api.js +++ b/src/app/subscriptions/service/api.js @@ -1,6 +1,6 @@ angular.module("subscriptionsModule") -.service("$subscriptionsApiService", [ +.service("subscriptionsApiService", [ "$resource", "REST_SERVER_URI", function($resource, REST_SERVER_URI) { return $resource(REST_SERVER_URI, {}, { diff --git a/src/app/visitor/controller/addressEdit.js b/src/app/visitor/controller/addressEdit.js index fadc8bc1..679ee02a 100644 --- a/src/app/visitor/controller/addressEdit.js +++ b/src/app/visitor/controller/addressEdit.js @@ -1,12 +1,12 @@ angular.module("visitorModule") .controller("visitorAddressEditController", [ "$scope", - "$visitorApiService", + "visitorApiService", "$routeParams", "$location", "$q", - "$dashboardUtilsService", - function ($scope, $visitorApiService, $routeParams, $location, $q, $dashboardUtilsService) { + "dashboardUtilsService", + function ($scope, visitorApiService, $routeParams, $location, $q, dashboardUtilsService) { var addressId, getDefaultAddress; getDefaultAddress = function () { @@ -32,7 +32,7 @@ angular.module("visitorModule") /** * Gets list all attributes of address */ - $visitorApiService.addressAttributeInfo().$promise.then( + visitorApiService.addressAttributeInfo().$promise.then( function (response) { var result = response.result || []; $scope.attributes = result; @@ -65,7 +65,7 @@ angular.module("visitorModule") * @param id */ if (null !== addressId) { - $visitorApiService.loadAddress({"addressID": addressId}).$promise.then( + visitorApiService.loadAddress({"addressID": addressId}).$promise.then( function (response) { var result = response.result || {}; $scope.address = result; @@ -101,7 +101,7 @@ angular.module("visitorModule") if (response.error === null) { var result = response.result || getDefaultAddress(); $scope.address._id = response.result._id; - $scope.message = $dashboardUtilsService.getMessage(null, 'success', 'Address was created successfully'); + $scope.message = dashboardUtilsService.getMessage(null, 'success', 'Address was created successfully'); defer.resolve(result); } $('[ng-click="save()"]').removeClass('disabled').children('i').remove(); @@ -125,7 +125,7 @@ angular.module("visitorModule") updateSuccess = function (response) { if (response.error === null) { var result = response.result || getDefaultAddress(); - $scope.message = $dashboardUtilsService.getMessage(null, 'success', 'Address was updated successfully'); + $scope.message = dashboardUtilsService.getMessage(null, 'success', 'Address was updated successfully'); $('[ng-click="save()"]').removeClass('disabled').children('i').remove(); $('[ng-click="save()"]').siblings('.btn').removeClass('disabled'); defer.resolve(result); @@ -143,10 +143,10 @@ angular.module("visitorModule") }; if (!id) { - $visitorApiService.saveAddress($scope.address, saveSuccess, saveError); + visitorApiService.saveAddress($scope.address, saveSuccess, saveError); } else { $scope.address.id = id; - $visitorApiService.updateAddress($scope.address, updateSuccess, updateError); + visitorApiService.updateAddress($scope.address, updateSuccess, updateError); } return defer.promise; diff --git a/src/app/visitor/controller/addressList.js b/src/app/visitor/controller/addressList.js index 962bcb16..55bdbaa2 100644 --- a/src/app/visitor/controller/addressList.js +++ b/src/app/visitor/controller/addressList.js @@ -5,10 +5,10 @@ angular.module("visitorModule") "$routeParams", "$location", "$q", - "$dashboardListService", - "$visitorApiService", + "dashboardListService", + "visitorApiService", "COUNT_ITEMS_PER_PAGE", - function ($scope, $routeParams, $location, $q, DashboardListService, $visitorApiService, COUNT_ITEMS_PER_PAGE) { + function ($scope, $routeParams, $location, $q, DashboardListService, visitorApiService, COUNT_ITEMS_PER_PAGE) { var serviceList, getAddressesList, getAddressesCount, getAttributeList, showColumns; serviceList = new DashboardListService(); showColumns = {}; @@ -45,7 +45,7 @@ angular.module("visitorModule") "visitorID": $scope.visitorId, "extra": serviceList.getExtraFields() }; - $visitorApiService.addresses(params).$promise.then( + visitorApiService.addresses(params).$promise.then( function (response) { var result, i; $scope.addressesTmp = []; @@ -62,7 +62,7 @@ angular.module("visitorModule") getAddressesCount = function () { var params = $location.search(); params["visitorID"] = $scope.visitorId; - $visitorApiService.getCountAddresses(params).$promise.then( + visitorApiService.getCountAddresses(params).$promise.then( function (response) { if (response.error === null) { $scope.count = response.result; @@ -74,7 +74,7 @@ angular.module("visitorModule") }; getAttributeList = function () { - $visitorApiService.addressAttributeInfo().$promise.then( + visitorApiService.addressAttributeInfo().$promise.then( function (response) { var result = response.result || []; serviceList.init('addresses'); @@ -131,7 +131,7 @@ angular.module("visitorModule") _remove = function (id) { var defer = $q.defer(); - $visitorApiService.deleteAddress({"addressID": id}, + visitorApiService.deleteAddress({"addressID": id}, function (response) { if (response.result === "ok") { defer.resolve(id); diff --git a/src/app/visitor/controller/attributeEdit.js b/src/app/visitor/controller/attributeEdit.js index 1f32435b..3da19818 100644 --- a/src/app/visitor/controller/attributeEdit.js +++ b/src/app/visitor/controller/attributeEdit.js @@ -3,9 +3,9 @@ angular.module("visitorModule") "$scope", "$routeParams", "$location", -"$visitorApiService", -"$dashboardUtilsService", -function ($scope, $routeParams, $location, $visitorApiService, $dashboardUtilsService) { +"visitorApiService", +"dashboardUtilsService", +function ($scope, $routeParams, $location, visitorApiService, dashboardUtilsService) { var formDisable, formEnable, formValidate, attr, requiredFields, editableFields; attr = $routeParams.attr; @@ -50,7 +50,7 @@ function ($scope, $routeParams, $location, $visitorApiService, $dashboardUtilsSe /** * Gets list all attributes of visitor */ - $visitorApiService.attributesInfo().$promise.then( + visitorApiService.attributesInfo().$promise.then( function (response) { var result, i; result = response.result || []; @@ -84,11 +84,11 @@ function ($scope, $routeParams, $location, $visitorApiService, $dashboardUtilsSe if ($scope.attribute.hasOwnProperty(requiredFields[i])) { value = $scope.attribute[requiredFields[i]] || ""; if (!value.match(/^\w+[\w*$()@^&!]*$/)) { - $scope.message = $dashboardUtilsService.getMessage(null, 'warning', 'The field '+ requiredFields[i]+' invalid'); + $scope.message = dashboardUtilsService.getMessage(null, 'warning', 'The field '+ requiredFields[i]+' invalid'); return false; } } else { - $scope.message = $dashboardUtilsService.getMessage(null, 'warning', 'The field '+ requiredFields[i]+' is not specified'); + $scope.message = dashboardUtilsService.getMessage(null, 'warning', 'The field '+ requiredFields[i]+' is not specified'); return false; } } @@ -111,9 +111,9 @@ function ($scope, $routeParams, $location, $visitorApiService, $dashboardUtilsSe */ saveSuccess = function (response) { if (response.error === null) { - $scope.message = $dashboardUtilsService.getMessage(null, 'success', 'Attribute was created successfully'); + $scope.message = dashboardUtilsService.getMessage(null, 'success', 'Attribute was created successfully'); } else { - $scope.message = $dashboardUtilsService.getMessage(response); + $scope.message = dashboardUtilsService.getMessage(response); } }; @@ -124,7 +124,7 @@ function ($scope, $routeParams, $location, $visitorApiService, $dashboardUtilsSe if (-1 !== ["multi_select"].indexOf($scope.attribute.Editors)) { $scope.attribute.Type = "[]text"; } - $visitorApiService.addAttribute($scope.attribute, saveSuccess); + visitorApiService.addAttribute($scope.attribute, saveSuccess); } $('[ng-click="save()"]').removeClass('disabled').children('i').remove(); diff --git a/src/app/visitor/controller/attributeList.js b/src/app/visitor/controller/attributeList.js index ebe1a480..715f21a1 100644 --- a/src/app/visitor/controller/attributeList.js +++ b/src/app/visitor/controller/attributeList.js @@ -4,10 +4,10 @@ angular.module("visitorModule") "$scope", "$routeParams", "$q", - "$visitorApiService", + "visitorApiService", "$location", "COUNT_ITEMS_PER_PAGE", - function ($scope, $routeParams, $q, $visitorApiService, $location, COUNT_ITEMS_PER_PAGE) { + function ($scope, $routeParams, $q, visitorApiService, $location, COUNT_ITEMS_PER_PAGE) { $scope.fields = [ { "attribute": "Label", @@ -40,7 +40,7 @@ angular.module("visitorModule") */ var params = $location.search(); params["extra"] = getFields(); - $visitorApiService.attributesInfo(params).$promise.then(function (response) { + visitorApiService.attributesInfo(params).$promise.then(function (response) { var result, i; $scope.attributesList = []; result = response.result || []; @@ -92,7 +92,7 @@ angular.module("visitorModule") _remove = function (attr) { var defer = $q.defer(); - $visitorApiService.removeAttribute({"attribute": attr}, + visitorApiService.removeAttribute({"attribute": attr}, function (response) { if (response.result === "ok") { defer.resolve(attr); diff --git a/src/app/visitor/controller/visitorEdit.js b/src/app/visitor/controller/visitorEdit.js index d70ee2bc..a1bcd9d3 100644 --- a/src/app/visitor/controller/visitorEdit.js +++ b/src/app/visitor/controller/visitorEdit.js @@ -5,19 +5,19 @@ angular.module("visitorModule") "$routeParams", "$location", "$q", -"$visitorApiService", -"$dashboardUtilsService", -"$orderApiService", -"$subscriptionsApiService", +"visitorApiService", +"dashboardUtilsService", +"orderApiService", +"subscriptionsApiService", function ( $scope, $routeParams, $location, $q, - $visitorApiService, - $dashboardUtilsService, - $orderApiService, - $subscriptionsApiService + visitorApiService, + dashboardUtilsService, + orderApiService, + subscriptionsApiService ) { var visitorId = $routeParams.id || null; @@ -59,7 +59,7 @@ function ( return $scope.visitor['first_name'] + " " + $scope.visitor['last_name']; }; - $visitorApiService.attributesInfo().$promise.then( + visitorApiService.attributesInfo().$promise.then( function (response) { var result = response.result || []; $scope.attributes = result; @@ -77,7 +77,7 @@ function ( * @param id */ if (null !== visitorId) { - $visitorApiService.load({"visitorID": visitorId}).$promise.then( + visitorApiService.load({"visitorID": visitorId}).$promise.then( function (response) { var result = response.result || {}; $scope.visitor = result; @@ -115,7 +115,7 @@ function ( if (response.error === null) { var result = response.result || getDefaultVisitor(); $scope.visitor._id = response.result._id; - $scope.message = $dashboardUtilsService.getMessage(null, 'success', 'Visitor was created successfully'); + $scope.message = dashboardUtilsService.getMessage(null, 'success', 'Visitor was created successfully'); $('[ng-click="save()"]').removeClass('disabled').children('i').remove(); $('[ng-click="save()"]').siblings('.btn').removeClass('disabled'); defer.resolve(result); @@ -131,7 +131,7 @@ function ( updateSuccess = function (response) { if (response.error === null) { var result = response.result || getDefaultVisitor(); - $scope.message = $dashboardUtilsService.getMessage(null, 'success', 'Visitor was updated successfully'); + $scope.message = dashboardUtilsService.getMessage(null, 'success', 'Visitor was updated successfully'); $('[ng-click="save()"]').removeClass('disabled').children('i').remove(); $('[ng-click="save()"]').siblings('.btn').removeClass('disabled'); defer.resolve(result); @@ -148,11 +148,11 @@ function ( delete $scope.visitor['shipping_address']; if (!id) { - $visitorApiService.save($scope.visitor, saveSuccess, saveError); + visitorApiService.save($scope.visitor, saveSuccess, saveError); } else { $scope.visitor.id = id; - $visitorApiService.update($scope.visitor, updateSuccess, updateError); + visitorApiService.update($scope.visitor, updateSuccess, updateError); } return defer.promise; @@ -165,7 +165,7 @@ function ( visitor_id: visitorId }; - return $orderApiService.orderList(params).$promise.then(function(response) { + return orderApiService.orderList(params).$promise.then(function(response) { return response.result; }); } @@ -176,7 +176,7 @@ function ( visitor_id: visitorId }; - return $subscriptionsApiService.list(params).$promise.then(function(response) { + return subscriptionsApiService.list(params).$promise.then(function(response) { return response.result; }); } diff --git a/src/app/visitor/controller/visitorEmail.js b/src/app/visitor/controller/visitorEmail.js index 8af11116..278ebb20 100644 --- a/src/app/visitor/controller/visitorEmail.js +++ b/src/app/visitor/controller/visitorEmail.js @@ -3,9 +3,9 @@ angular.module("visitorModule") .controller("visitorEmailController", [ "$scope", "$location", - "$visitorApiService", - "$dashboardUtilsService", - function ($scope, $location, $visitorApiService, $dashboardUtilsService) { + "visitorApiService", + "dashboardUtilsService", + function ($scope, $location, visitorApiService, dashboardUtilsService) { var getDefaultEmail; getDefaultEmail = function () { @@ -57,7 +57,7 @@ angular.module("visitorModule") $('[ng-click="send()"]').addClass('disabled').append('').siblings('.btn').addClass('disabled'); var successSend = function (response) { if (response.result === "ok") { - $scope.message = $dashboardUtilsService.getMessage(null, 'success', 'Emails sent successfully'); + $scope.message = dashboardUtilsService.getMessage(null, 'success', 'Emails sent successfully'); $('[ng-click="send()"]').removeClass('disabled').children('i').remove(); $('[ng-click="send()"]').siblings('.btn').removeClass('disabled'); } @@ -66,13 +66,13 @@ angular.module("visitorModule") var errorSend = function (response) { if (response.result === "ok") { - $scope.message = $dashboardUtilsService.getMessage(null, 'danger', 'Something went wrong'); + $scope.message = dashboardUtilsService.getMessage(null, 'danger', 'Something went wrong'); $('[ng-click="send()"]').removeClass('disabled').children('i').remove(); $('[ng-click="send()"]').siblings('.btn').removeClass('disabled'); } }; - $visitorApiService.sendMail($scope.email, successSend, errorSend); + visitorApiService.sendMail($scope.email, successSend, errorSend); }; } diff --git a/src/app/visitor/controller/visitorList.js b/src/app/visitor/controller/visitorList.js index 815156bd..26cf4ac8 100644 --- a/src/app/visitor/controller/visitorList.js +++ b/src/app/visitor/controller/visitorList.js @@ -5,10 +5,10 @@ angular.module("visitorModule") "$routeParams", "$location", "$q", - "$dashboardListService", - "$visitorApiService", + "dashboardListService", + "visitorApiService", "COUNT_ITEMS_PER_PAGE", - function ($scope, $routeParams, $location, $q, DashboardListService, $visitorApiService, COUNT_ITEMS_PER_PAGE) { + function ($scope, $routeParams, $location, $q, DashboardListService, visitorApiService, COUNT_ITEMS_PER_PAGE) { var serviceList, getVisitorsList, getVisitorCount, getAttributeList, showColumns; serviceList = new DashboardListService(); @@ -29,7 +29,7 @@ angular.module("visitorModule") getVisitorsList = function () { var params = $location.search(); params["extra"] = serviceList.getExtraFields(); - $visitorApiService.visitorList(params).$promise.then( + visitorApiService.visitorList(params).$promise.then( function (response) { var result, i; $scope.visitorsTmp = []; @@ -45,7 +45,7 @@ angular.module("visitorModule") * Gets count visitors */ getVisitorCount = function() { - $visitorApiService.getCountVisitors($location.search(), {}).$promise.then( + visitorApiService.getCountVisitors($location.search(), {}).$promise.then( function (response) { if (response.error === null) { $scope.count = response.result; @@ -60,7 +60,7 @@ angular.module("visitorModule") * Gets visitor attributes */ getAttributeList = function() { - $visitorApiService.attributesInfo().$promise.then( + visitorApiService.attributesInfo().$promise.then( function (response) { var result = response.result || []; serviceList.init('visitors'); @@ -113,7 +113,7 @@ angular.module("visitorModule") _remove = function (id) { var defer = $q.defer(); - $visitorApiService.remove({"visitorID": id}, + visitorApiService.remove({"visitorID": id}, function (response) { if (response.result === "ok") { defer.resolve(id); diff --git a/src/app/visitor/service/api.js b/src/app/visitor/service/api.js index 77ec47e9..f0ffde77 100644 --- a/src/app/visitor/service/api.js +++ b/src/app/visitor/service/api.js @@ -1,10 +1,10 @@ angular.module("visitorModule") /* - * $productApiService interaction service + * productApiService interaction service */ -.service("$visitorApiService", ["$resource", "REST_SERVER_URI", function ($resource, REST_SERVER_URI) { +.service("visitorApiService", ["$resource", "REST_SERVER_URI", function ($resource, REST_SERVER_URI) { return $resource(REST_SERVER_URI, {}, { "attributesInfo": { method: "GET", From b240063ad47b7a1b483868ed506640d8bb229991 Mon Sep 17 00:00:00 2001 From: n4bcak3 Date: Fri, 25 Mar 2016 14:24:24 -0400 Subject: [PATCH 14/16] Close ottemo/dashboard#261: Auth check fix. --- src/app/dashboard/init.js | 200 ++++++++++++--------------- src/app/dashboard/menu/controller.js | 2 +- src/app/dashboard/menu/view.html | 2 +- src/app/login/init.js | 1 + 4 files changed, 88 insertions(+), 117 deletions(-) diff --git a/src/app/dashboard/init.js b/src/app/dashboard/init.js index 848353de..30be6952 100644 --- a/src/app/dashboard/init.js +++ b/src/app/dashboard/init.js @@ -1,147 +1,117 @@ -angular.module("dashboardModule", [ +angular.module('dashboardModule', [ // Angular - "ngRoute", - "ngResource", - "ngSanitize", + 'ngRoute', + 'ngResource', + 'ngSanitize', // Lib - "ui.odometer", - "ui.bootstrap", - "highcharts-ng", + 'ui.odometer', + 'ui.bootstrap', + 'highcharts-ng', // Ottemo - "categoryModule", - "cmsModule", - "configModule", - "designModule", - "discountsModule", - "impexModule", - "loginModule", - "orderModule", - "productModule", - "seoModule", - "subscriptionsModule", - "visitorModule" + 'categoryModule', + 'cmsModule', + 'configModule', + 'designModule', + 'discountsModule', + 'impexModule', + 'loginModule', + 'orderModule', + 'productModule', + 'seoModule', + 'subscriptionsModule', + 'visitorModule' ]) -.constant("REST_SERVER_URI", angular.appConfigValue("general.app.foundation_url")) -.constant("COUNT_ITEMS_PER_PAGE", angular.appConfigValue("general.app.item_per_page")) +.constant('REST_SERVER_URI', angular.appConfigValue('general.app.foundation_url')) -/* - * Basic routing configuration - */ -.config(['$routeProvider', - '$httpProvider', +.constant('COUNT_ITEMS_PER_PAGE', angular.appConfigValue('general.app.item_per_page')) + +.config([ + '$routeProvider', '$locationProvider', '$sceDelegateProvider', '$animateProvider', - 'odometerOptionsProvider', - function ($routeProvider, $httpProvider, $locationProvider, $sceDelegateProvider, $animateProvider,odometerOptionsProvider) { - - var otInterceptor = ['$q', - function ($q) { - return { - response: function (response) { - if (typeof response.data.error !== "undefined" && - response.data.error !== null && - response.data.error.code === "0bc07b3d-1443-4594-af82-9d15211ed179") { - location.replace('/'); - } - return response; - }, - responseError: function (rejection) { - switch (rejection.status) { - case 401: - location.reload(); - break; - case 404: - console.warn("The server is unable to process this request - " + rejection.config.url); - break; - } - return $q.reject(rejection); - } - }; - }]; - - $httpProvider.interceptors.push(otInterceptor); - - function checkLoggedIn($q,$log,loginLoginService){ - var def = $q.defer(); - - loginLoginService.init().then(function(auth){ - - if (auth) - def.resolve(auth) - else { - // $location.url('/login'); - $log.error('Authentication required. Redirect to login.'); - def.reject({ needsAuthentication: true }); - def.reject(); - } - }) - - return def.promise - } - - $routeProvider.whenAuthenticated = function(path,route){ - route.resolve = route.resolve || {}; - - angular.extend(route.resolve, { - isLoggedIn: ['$q','$log', 'loginLoginService', checkLoggedIn] - }) - - return $routeProvider.when(path,route); - } + function( + $routeProvider, + $locationProvider, + $sceDelegateProvider, + $animateProvider + ) { + $locationProvider.html5Mode(true); + // Whitelisting $sceDelegateProvider.resourceUrlWhitelist([ 'self', - angular.appConfigValue("general.app.foundation_url") + '/**' + angular.appConfigValue('general.app.foundation_url') + '/**' ]); - $routeProvider - .whenAuthenticated("/", { - templateUrl: "/views/dashboard/welcome.html", - controller: "dashboardController" - }) - .when("/help", { - templateUrl: "/views/help.html" - }) - .otherwise({ redirectTo: "/"}); - - $locationProvider.html5Mode(true); - // Don't monitor font awesome animation .fa-spin $animateProvider.classNameFilter(/^((?!(fa-spin)).)*$/); - }] -) + // Routes + $routeProvider + .when('/', { + templateUrl: '/views/dashboard/welcome.html', + controller: 'dashboardController' + }) + .when('/help', { + templateUrl: '/views/help.html' + }) + .otherwise({ + redirectTo: '/' + }); + } +]) .run([ - "$rootScope", - "$route", - "$http", - "dashboardListService", - "$location", - "$log", - function ($rootScope, $route, $http, DashboardListService,$location,$log) { + '$rootScope', + '$http', + '$location', + 'loginLoginService', + function( + $rootScope, + $http, + $location, + loginLoginService + ) { // ajax cookies support fix $http.defaults.withCredentials = true; - delete $http.defaults.headers.common["X-Requested-With"]; - - $rootScope.$list = new DashboardListService(); + delete $http.defaults.headers.common['X-Requested-With']; - $route.reload(); - - $rootScope.$on('$routeChangeError', function (ev, current, previous, rejection) { + // Redirect to login page + $rootScope.$on('$routeChangeError', function(ev, current, previous, rejection) { if (rejection && rejection.needsAuthentication === true) { - // redirect to login page $location.url('/login'); } }); - // content loaded handler - $rootScope.$on('$routeChangeSuccess', function(res){ - $rootScope.contentLoaded = true; + // Add an auth check to every route + $rootScope.$on('$routeChangeStart', function(e, to, from) { + + if (to.originalPath === '/login') { + return; + } + + to.resolve = to.resolve || {}; + to.resolve.checkLoggedIn = function($q, loginLoginService) { + var def = $q.defer(); + + loginLoginService.init() + .then(function(auth) { + if (auth) { + def.resolve(auth); + } else { + def.reject({ + needsAuthentication: true + }); + } + }); + + return def.promise; + }; }); } ]); + diff --git a/src/app/dashboard/menu/controller.js b/src/app/dashboard/menu/controller.js index d4c79c9c..bfb4b3dd 100644 --- a/src/app/dashboard/menu/controller.js +++ b/src/app/dashboard/menu/controller.js @@ -7,7 +7,7 @@ angular.module('dashboardModule') '$rootScope', function($scope, menuService, loginLoginService, $rootScope) { - $scope.userName = loginLoginService.getFullName() || 'root'; + $scope.user = loginLoginService; $scope.items = menuService.items; $scope.closeAll = menuService.closeAll; diff --git a/src/app/dashboard/menu/view.html b/src/app/dashboard/menu/view.html index c39b1c3f..3c0ce7a0 100644 --- a/src/app/dashboard/menu/view.html +++ b/src/app/dashboard/menu/view.html @@ -69,7 +69,7 @@ diff --git a/src/app/login/init.js b/src/app/login/init.js index 52e7c437..cfdf7779 100644 --- a/src/app/login/init.js +++ b/src/app/login/init.js @@ -25,6 +25,7 @@ angular.module("loginModule", ["ngRoute", "ngResource"]) return def.resolve(); } }); + return def.promise; } } From c8b4b5a58814e2966cbcbebcc09b5e37ee609783 Mon Sep 17 00:00:00 2001 From: Adam Willoughby-Knox Date: Fri, 1 Apr 2016 21:18:58 -0400 Subject: [PATCH 15/16] add product performance reporting [#271] * initial work * perform date calculations * mv files, cleanup some styles * cleanup, and move tz code to tz service * add a chart --- src/app/_scripts/main.js | 28 ++++++ src/app/config/service/timezone.js | 70 ++++++++++++++- src/app/dashboard/controllers.js | 28 +----- src/app/dashboard/init.js | 1 + src/app/dashboard/menu/service.js | 4 + src/app/reports/init.js | 15 ++++ src/app/reports/product.html | 66 +++++++++++++++ src/app/reports/product.js | 131 +++++++++++++++++++++++++++++ src/app/reports/reporting.scss | 0 src/app/reports/service.js | 35 ++++++++ 10 files changed, 348 insertions(+), 30 deletions(-) create mode 100644 src/app/reports/init.js create mode 100644 src/app/reports/product.html create mode 100644 src/app/reports/product.js create mode 100644 src/app/reports/reporting.scss create mode 100644 src/app/reports/service.js diff --git a/src/app/_scripts/main.js b/src/app/_scripts/main.js index c1d9b2bb..af4749b6 100644 --- a/src/app/_scripts/main.js +++ b/src/app/_scripts/main.js @@ -23,4 +23,32 @@ $(document).ready(function () { event.stopPropagation(); }); + // Highcharts settings that we can't adjust from ngHighcharts + Highcharts.setOptions({ + global: { + timezoneOffset: 0 //default + }, + chart: { + spacingLeft: 15, + spacingRight: 0, + backgroundColor: 'rgba(0,0,0,0)' + }, + plotOptions: { + series: { + marker: { + enabled: false + } + } + }, + yAxis: { + labels: { + style: { + color: '#98978B' + } + } + }, + legend: { + enabled: false + }, + }); }); \ No newline at end of file diff --git a/src/app/config/service/timezone.js b/src/app/config/service/timezone.js index 11a65952..bca68fc0 100644 --- a/src/app/config/service/timezone.js +++ b/src/app/config/service/timezone.js @@ -1,10 +1,15 @@ +//TODO: Consider moving to coreModule angular.module('configModule') .factory('timezoneService', ['configApiService', '$q', function(configApiService, $q) { + var storeTz = null; + var service = { - init: init, - storeTz : 0 + get: getTz, + makeDateRange: makeDateRange, + init: init, // @deprecated + storeTz: 0, // @deprecated }; return service; @@ -14,11 +19,70 @@ angular.module('configModule') function init() { // Cache the store tz - configApiService.getPath({path: 'general.store.timezone'}).$promise + configApiService.getPath({ + path: 'general.store.timezone' + }).$promise .then(function(response) { service.storeTz = response.result.substr(3); }); } + + function getTz() { + // We have the tz return a promise wrapped value + if (null !== storeTz) { + return $q.resolve(storeTz) + } + + var config = { + path: 'general.store.timezone' + }; + + return configApiService.getPath(config).$promise + .then(function(response) { + storeTz = response.result.substr(3); + return storeTz + }) + + } + + /** + * @param string; today, yesterday, last 7 days, last 30 days + * @return {[type]} + */ + function makeDateRange(rangeString) { + return getTz().then(function(tz) { + return _make(tz, rangeString) + }); + + //////////////////////// + + function _make(tz, rangeString) { + // Default to today + var startDate = moment().utcOffset(tz); + var endDate = moment().utcOffset(tz).endOf('day'); + + switch (rangeString.toLowerCase()) { + case 'today': + startDate = startDate.startOf('day'); + break; + case 'yesterday': + startDate = startDate.subtract(1, 'day').startOf('day'); + endDate = moment().utcOffset(tz).subtract(1, 'day').endOf('day'); + break; + case 'last 7 days': + startDate = startDate.subtract(7, 'days').startOf('day'); + break; + case 'last 30 days': + startDate = startDate.subtract(30, 'days').startOf('day'); + break; + } + + return { + startDate: startDate, + endDate: endDate + }; + } + } } ]); diff --git a/src/app/dashboard/controllers.js b/src/app/dashboard/controllers.js index 044127f6..8f8bc435 100644 --- a/src/app/dashboard/controllers.js +++ b/src/app/dashboard/controllers.js @@ -75,37 +75,11 @@ angular.module("dashboardModule") } function configGraphs() { - // Highcharts settings that we can't adjust from ngHighcharts Highcharts.setOptions({ - global: { - timezoneOffset: 0 //default - }, - chart: { - spacingLeft: 15, - spacingRight: 0, - backgroundColor: 'rgba(0,0,0,0)' - }, - plotOptions: { - series: { - marker: { - enabled: false - } - } - }, - yAxis: { - labels: { - style: { - color: '#98978B' - } - } - }, colors: [ '#325D88', - '#DFD7CA' + '#DFD7CA', ], - legend: { - enabled: false - }, tooltip: { formatter: function() { return this.series.name + ' @ ' + moment.utc(this.x).format('ha') + ': ' + this.y; diff --git a/src/app/dashboard/init.js b/src/app/dashboard/init.js index 30be6952..cf491b33 100644 --- a/src/app/dashboard/init.js +++ b/src/app/dashboard/init.js @@ -19,6 +19,7 @@ angular.module('dashboardModule', [ 'loginModule', 'orderModule', 'productModule', + 'reportsModule', 'seoModule', 'subscriptionsModule', 'visitorModule' diff --git a/src/app/dashboard/menu/service.js b/src/app/dashboard/menu/service.js index 8fe567d7..0ae5f5c9 100644 --- a/src/app/dashboard/menu/service.js +++ b/src/app/dashboard/menu/service.js @@ -70,6 +70,10 @@ angular.module('dashboardModule') title: 'URL Rewrite', link: '/seo', icon: 'fa-random' + }, { + title: 'Reports', + link: '/reports/product', + icon: 'fa-area-chart' }, { title: 'Settings', icon: 'fa-cog', diff --git a/src/app/reports/init.js b/src/app/reports/init.js new file mode 100644 index 00000000..859f9b36 --- /dev/null +++ b/src/app/reports/init.js @@ -0,0 +1,15 @@ +angular.module('reportsModule', [ + 'ngRoute', + 'ngResource', + 'designModule', + 'configModule', +]) + +.config(["$routeProvider", function($routeProvider) { + $routeProvider + .when("/reports/product", { + templateUrl: "/views/reports/product.html", + controller: "reportsProductController" + }); +}]); + diff --git a/src/app/reports/product.html b/src/app/reports/product.html new file mode 100644 index 00000000..73178716 --- /dev/null +++ b/src/app/reports/product.html @@ -0,0 +1,66 @@ + + +

+ {{field.label}}
  +
 
@@ -65,7 +70,7 @@
 
- +
Today $
Yesterday
Today
Yesterday
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameSkuUnits SoldGross Sales
{{product.name}}{{product.sku}}{{product.units_sold}}{{product.gross_sales | currency}}
+ No results found for this timeframe. +
+ Totals + + + {{report.total_items}} items in +
{{report.total_orders}} orders +
+ {{report.total_sales | currency}} +
+ diff --git a/src/app/reports/product.js b/src/app/reports/product.js new file mode 100644 index 00000000..d46702ba --- /dev/null +++ b/src/app/reports/product.js @@ -0,0 +1,131 @@ +angular.module('reportsModule') + +.controller('reportsProductController', [ + '$scope', + 'reportsService', + 'timezoneService', + 'moment', + '_', + function($scope, reportsService, timezoneService, moment, _) { + $scope.report = {}; + $scope.timeframe = { + frame: 'last 30 days', + options: [ // Support is bound to what timezone.js can parse + 'today', + 'yesterday', + 'last 7 days', + 'last 30 days', + ], + isOpen: false, + set: setTimeframe, + toggle: toggle, + }; + + $scope.chartConfig = getChartConfig(); + + activate(); + + ///////////////////////////////// + + function activate() { + // Get a report on page load + fetchReport($scope.timeframe.frame); + } + + /** + * Updates the current timeframe + * Closes the dropdown + * Fetches the report + * + * @param {string} + */ + function setTimeframe(frame) { + $scope.timeframe.frame = frame; + $scope.timeframe.isOpen = false; + + fetchReport(frame); + } + + // Open/Close the timeframe dropdown + function toggle() { + $scope.timeframe.isOpen = !$scope.timeframe.isOpen; + } + + // Fetch a report for a timeframe string, and make sure + // to modify the dates for the store tz + function fetchReport(frame) { + + timezoneService.makeDateRange(frame) + .then(function(dateRange) { + return reportsService.product(dateRange); + }) + .then(function(report) { + $scope.report = report; + updateChart(); + }); + } + + function getChartConfig() { + // We have to touch some globals to get this to display the way we want + // there are some tweaks in main.js as well + Highcharts.setOptions({ + colors: ['#5da9dd'], + tooltip: { + formatter: function() { + return [ + this.series.name,': ', + '$',this.y,'' + ].join(''); + } + } + }); + + return { + options: { + chart: { + type: 'column' + } + }, + title: { + text: '', + }, + yAxis: { + min: 0, + title: { + text: 'Gross Sales', + }, + labels: { + format: '${value}', + }, + }, + xAxis: { + title: { + text: 'Products by SKU' + }, + labels: { + enabled: false, + }, + minorTickLength: 0, + tickLength: 0, + }, + tooltip: { + headerFormat: '' + }, + series: [], + }; + } + + function updateChart() { + $scope.chartConfig.series = _.map($scope.report.aggregate_items, toChartData); + + function toChartData(product) { + return { + // sku, units_sold + name: product.name, + data: [product.gross_sales] + }; + } + } + } +]); + diff --git a/src/app/reports/reporting.scss b/src/app/reports/reporting.scss new file mode 100644 index 00000000..e69de29b diff --git a/src/app/reports/service.js b/src/app/reports/service.js new file mode 100644 index 00000000..79fa44d4 --- /dev/null +++ b/src/app/reports/service.js @@ -0,0 +1,35 @@ +angular.module('reportsModule') + +.factory('reportsService', [ + '$http', + 'REST_SERVER_URI', + 'timezoneService', + 'moment', + function($http, REST_SERVER_URI, timezoneService, moment) { + + var service = { + product: getProductPerformance, + }; + + return service; + + /////////////////////////// + + function getProductPerformance(dates) { + var url = REST_SERVER_URI + '/reporting/product-performance'; + var config = { + params: { + start_date: dates.startDate.toISOString(), + end_date: dates.endDate.toISOString(), + } + }; + + console.log('fetching product performance report for:', config.params); + + return $http.get(url, config).then(function(response) { + return response.data.result + }); + } + } +]); + From ca42060bd8293ae10a332a11a18f64649b159465 Mon Sep 17 00:00:00 2001 From: James Vastbinder Date: Tue, 5 Apr 2016 10:28:50 -0700 Subject: [PATCH 16/16] version bump for release 1.1.14 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 095c6503..c40b32bb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "Dashboard", - "version": "1.1.02", + "version": "1.1.14", "description": "Ottemo Administration Tool", "main": "gulpfile.js", "repository": {