From b21080b77b78159dce4f328705ed2088f9d02e44 Mon Sep 17 00:00:00 2001 From: James Vastbinder Date: Wed, 21 Jan 2015 07:37:05 -0800 Subject: [PATCH 001/160] add gitter badge --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 05e0db2c..0449eb41 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,9 @@ Dashboard [![wercker status](https://app.wercker.com/status/0d1dbce7b17a8fc14016760e30709afc/m "wercker status")](https://app.wercker.com/project/bykey/0d1dbce7b17a8fc14016760e30709afc) +[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/ottemo/dash?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) + + ## Workflow with gulp From 68f031f62f6825406c9e72872a31c8b84d6af4e8 Mon Sep 17 00:00:00 2001 From: James Vastbinder Date: Fri, 23 Jan 2015 17:36:48 -0800 Subject: [PATCH 002/160] replace gitter with hipchat link --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 0449eb41..0305fd00 100644 --- a/README.md +++ b/README.md @@ -3,8 +3,7 @@ Dashboard [![wercker status](https://app.wercker.com/status/0d1dbce7b17a8fc14016760e30709afc/m "wercker status")](https://app.wercker.com/project/bykey/0d1dbce7b17a8fc14016760e30709afc) -[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/ottemo/dash?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) - +[Link to our HipChat Room for Support](https://www.hipchat.com/gWgE1EkYF) ## Workflow with gulp From 78ddc3a50f3521dc13956a57d609119fd6fde243 Mon Sep 17 00:00:00 2001 From: James Vastbinder Date: Fri, 23 Jan 2015 17:55:12 -0800 Subject: [PATCH 003/160] Update with new hichat room --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0305fd00..e054a764 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ Dashboard [![wercker status](https://app.wercker.com/status/0d1dbce7b17a8fc14016760e30709afc/m "wercker status")](https://app.wercker.com/project/bykey/0d1dbce7b17a8fc14016760e30709afc) -[Link to our HipChat Room for Support](https://www.hipchat.com/gWgE1EkYF) +[Link to our HipChat Room for Support](https://www.hipchat.com/g3BoK1Gqr) ## Workflow with gulp From 72e60637e482f087d52e4b32ab1f3ca959b8237a Mon Sep 17 00:00:00 2001 From: James Vastbinder Date: Thu, 22 Jan 2015 18:06:42 -0800 Subject: [PATCH 004/160] update to install.md --- INSTALL.md | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index 32bf3774..29b5ef10 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -1,4 +1,4 @@ -## Developer Installation Instructions +## Installation Instructions for Local Development ### Install NPM Gulp and Bower @@ -25,22 +25,26 @@ npm install bower install -### Initialize Git Flow +### Build project using Gulp + gulp build + +### Run Client in Development Mode with Browser Reload + gulp build && gulp dev + or + gulp build && gulp serve + +## How to set up Git Flow on Mac/Linux + +#### OSX + brew install git-flow + +#### Linux + sudo apt-get install git-flow + +### Initialize Git Flow in cloned Repository git checkout master git checkout develop git flow init -d ### Start a Feature Branch git flow feature start - -### Build - gulp build - -### Run Unit Tests - Not configured yet - -### Run Client in Development Mode - gulp build && gulp dev - -### Issue Pull Request on Github - git push -u origin From 0d987860d02f57510787fc41944a3951398827cc Mon Sep 17 00:00:00 2001 From: James Vastbinder Date: Thu, 22 Jan 2015 18:13:12 -0800 Subject: [PATCH 005/160] cleaned up install.md --- INSTALL.md | 8 +++++++ README.md | 66 +----------------------------------------------------- 2 files changed, 9 insertions(+), 65 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index 29b5ef10..2bae18e1 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -48,3 +48,11 @@ ### Start a Feature Branch git flow feature start + +### Issue a pull request on github + $ git push -u origin + # if you have git aliased to hub otherwise use the github web interface + $ git pull-request -b develop + +### Delete the local branch + $ git branch -d diff --git a/README.md b/README.md index e054a764..532369ad 100644 --- a/README.md +++ b/README.md @@ -5,71 +5,7 @@ Dashboard [Link to our HipChat Room for Support](https://www.hipchat.com/g3BoK1Gqr) - -## Workflow with gulp - -### Build -Builds project and moves files on the destination folder. Makes concat and minify css and JS. Compiling SASS to css. Checks JS on errors using JSHint - - gulp build - -### Run Client in Development Mode -Moves images, bower-files into destination folder. Compiling sass. Adds watcher on a changes in css, scss, js, html and images. After a change these files browser automatically will be update content - - gulp build && gulp dev - or - gulp build && gulp serve - -### Run Unit Tests -Not configured yet. Will be realized in the near future - - gulp test - -### Also useful are the following commands - gulp jshint // check js on errors - gulp sass // Makes compilation sass to css - gulp clean // Removes the _dist_ folder - -### How start with Vagrantfile -Clone ottemo/dashboard github repo. The vagrant instance will start with nginx available at http://localhost:9999 - You can use gulp serve as well and will be available at http://localhost:9000 - - vagrant up - vagrant ssh - sudo su - - cd /vagrant - gulp serve (this will take a few minutes to start) - -### How to run ottemo/dashboard docker container -Pull latest image from docker hub - - docker pull ottemo/dashboard - -Start the container and access locally access at http://localhost:9999 - - docker run -d -p 9999:80 -t ottemo/dashboard - ## Contribute to Ottemo Dashboard development We use git-flow internally, but if you do not like git-flow you may use [this document](CONTRIBUTOR.md) as an alternative. -Below is a mini quickstart if you are new to git-flow and can't wait to jump into the code. - -### Initialize git-flow - - # fork or clone ottemo like below - $ git clone https://github.com/ottemo/ottemo-go.git - - # init git-flow, (git-flow must be installed for your OS locally) - $ git checkout master - $ git checkout develop - $ git flow init -d - -### Start a feature branch - $ git flow feature start - -### Issue a pull request on github - $ git push -u origin - # if you have git aliased to hub otherwise use the github web interface - $ git pull-request -b develop - -### Delete the local branch - $ git branch -d +There is a mini quickstart if you are new to git-flow in [INSTALL.md](INSTALL.md) From 5dac0d8a74d24994c8447b4f44ffe0ca035508f1 Mon Sep 17 00:00:00 2001 From: James Vastbinder Date: Thu, 22 Jan 2015 18:35:17 -0800 Subject: [PATCH 006/160] added license --- LICENSE.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 LICENSE.md diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 00000000..a07ee588 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,7 @@ +## Copyright © 2015 + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. From 018b7dd18c60e3792cff500d83b1a0364eaf9411 Mon Sep 17 00:00:00 2001 From: James Vastbinder Date: Thu, 22 Jan 2015 18:35:55 -0800 Subject: [PATCH 007/160] update to README for terms and license --- README.md | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 532369ad..de9eff96 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,29 @@ Dashboard [Link to our HipChat Room for Support](https://www.hipchat.com/g3BoK1Gqr) ## Contribute to Ottemo Dashboard development +Clone the repository and send us a Pull Request. There is a mini quickstart if you are new to git-flow in [INSTALL.md](INSTALL.md) + We use git-flow internally, but if you do not like git-flow you may use [this document](CONTRIBUTOR.md) as an alternative. -There is a mini quickstart if you are new to git-flow in [INSTALL.md](INSTALL.md) +## Installation +There are several different ways to install and run Ottemo. + +* Clone the repository, install gulp/bower, run in dev mode with `gulp serve` +* Use our Vagrant & Docker files to build a development vm + +## License + +[MIT License](LICENSE.md) Copyright 2015, Ottemo, Inc + +## Terms and Conditions + +All Submissions you make to Ottemo, Inc. (“Ottemo”) through GitHub are subject +to the following terms and conditions: + +1. You grant Ottemo a perpetual, worldwide, non-exclusive, no charge, royalty +free, irrevocable license under your applicable copyrights and patents to +reproduce, prepare derivative works of, display, publically perform, sublicense +and distribute any feedback, ideas, code, or other information (“Submission”) +you submit through GitHub. + +2. Your Submission is an original work of authorship and you are the owner or are legally entitled to grant the license stated above. From 78fb9a275d15838d3967dd6761c356f76a544814 Mon Sep 17 00:00:00 2001 From: maazghani Date: Fri, 30 Jan 2015 18:22:34 -0500 Subject: [PATCH 008/160] removing Vagrantfile --- Dockerfile | 8 +++----- Vagrantfile | 21 --------------------- 2 files changed, 3 insertions(+), 26 deletions(-) delete mode 100644 Vagrantfile diff --git a/Dockerfile b/Dockerfile index 48ded2d0..161cf1a2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,13 +7,13 @@ FROM ubuntu:latest RUN apt-get update -RUN apt-get install -y nginx git curl python-software-properties python software-properties-common +RUN apt-get install -y openssh-server nginx git curl python-software-properties python software-properties-common RUN add-apt-repository ppa:chris-lea/node.js RUN apt-get update RUN apt-get install -y nodejs -RUN npm update -g npm +RUN git clone https://github.com/ottemo/dash.git -b develop /opt/dashboard WORKDIR /opt/dashboard -RUN git clone https://ottemo-dev:freshbox111222333@github.com/ottemo/dashboard.git -b develop /opt/dashboard +RUN npm update -g npm RUN npm install RUN npm install -g bower RUN bower install --allow-root @@ -24,5 +24,3 @@ ADD ./config/dashboard.conf /etc/nginx/conf.d/ RUN echo "daemon off;" >> /etc/nginx/nginx.conf EXPOSE 80 - -CMD service nginx start diff --git a/Vagrantfile b/Vagrantfile deleted file mode 100644 index 7b84dc51..00000000 --- a/Vagrantfile +++ /dev/null @@ -1,21 +0,0 @@ -# -*- mode: ruby -*- -# vi: set ft=ruby : - -# Vagrantfile API/syntax version. Don't touch unless you know what you're doing! -VAGRANTFILE_API_VERSION = "2" - -Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| - # All Vagrant configuration is done here. The most common configuration - # options are documented and commented below. For a complete reference, - # please see the online documentation at vagrantup.com. - - # Every Vagrant virtual environment requires a box to build off of. - config.vm.box = "ubuntu/trusty64" - - # accessing "localhost:9999" will access port 9999 on the guest machine. - config.vm.network "forwarded_port", guest: 9000, host: 9000 - config.vm.network "forwarded_port", guest: 9999, host: 9999 - - config.vm.provision "shell", path: "./bootstrap.sh", privileged: true, binary: false - -end \ No newline at end of file From dc01ff487e8e273bd2eb73074f5a201e0d19e67a Mon Sep 17 00:00:00 2001 From: Maaz Ghani Date: Mon, 13 Apr 2015 09:34:50 -0700 Subject: [PATCH 009/160] Updating install.md --- INSTALL.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/INSTALL.md b/INSTALL.md index 2bae18e1..a0d8798b 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -33,6 +33,12 @@ or gulp build && gulp serve +Note: The password to login to the dashboard will be whatever was set in the ['gulp build' step](https://github.com/ottemo/store-ng/blob/develop/INSTALL.md#build-ottemo-store-ng) for store-ng. By default this is: +``` +username: admin +password: admin +``` + ## How to set up Git Flow on Mac/Linux #### OSX From 57d379255c7f6d37784284a9c4dcd97392f7b19a Mon Sep 17 00:00:00 2001 From: OBesarab Date: Tue, 14 Apr 2015 07:48:16 -0500 Subject: [PATCH 010/160] [#91860752] style add class statistic --- app/themes/default/styles/bootstrap.css | 6 ++++++ app/themes/default/views/dashboard/welcome.html | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/app/themes/default/styles/bootstrap.css b/app/themes/default/styles/bootstrap.css index 7c00bb66..c3c6c13a 100644 --- a/app/themes/default/styles/bootstrap.css +++ b/app/themes/default/styles/bootstrap.css @@ -2114,6 +2114,12 @@ th { .table-striped > tbody > tr:nth-child(odd) { background-color: #efefef; } +.statistic > tbody > tr > td:first-child { + word-break: break-all; +} +.statistic > tbody > tr > td:last-child { + width: 10px; +} .table-hover > tbody > tr:hover { background-color: #e9e9e9; -webkit-transition: all 0.5s ease; diff --git a/app/themes/default/views/dashboard/welcome.html b/app/themes/default/views/dashboard/welcome.html index 1de8ce66..bf352881 100644 --- a/app/themes/default/views/dashboard/welcome.html +++ b/app/themes/default/views/dashboard/welcome.html @@ -214,7 +214,7 @@

Top Sellers

Top Referrals

- +
- + From 88b90cce14f3516462f7c5365895caaf1ad5ac89 Mon Sep 17 00:00:00 2001 From: James Vastbinder Date: Tue, 14 Apr 2015 21:50:05 -0700 Subject: [PATCH 016/160] updated column widths for uniformity [Finished #92477190] --- app/themes/default/views/order/edit.html | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/app/themes/default/views/order/edit.html b/app/themes/default/views/order/edit.html index 28c69db9..aad65564 100644 --- a/app/themes/default/views/order/edit.html +++ b/app/themes/default/views/order/edit.html @@ -55,23 +55,23 @@

@@ -309,4 +309,4 @@

- \ No newline at end of file + From 783862a171965bd5e0dfdf1be449667fcec89a16 Mon Sep 17 00:00:00 2001 From: OBesarab Date: Tue, 14 Apr 2015 10:19:07 -0500 Subject: [PATCH 011/160] [#86229562] first step - list is aviliable --- app/scripts/seo/controller/list.js | 109 +++++++++++++++++++++++++ app/scripts/seo/init.js | 25 +++++- app/scripts/seo/module.js | 4 +- app/scripts/seo/service/seo.js | 3 +- app/themes/default/views/seo/list.html | 14 ++++ 5 files changed, 150 insertions(+), 5 deletions(-) create mode 100644 app/scripts/seo/controller/list.js create mode 100644 app/themes/default/views/seo/list.html diff --git a/app/scripts/seo/controller/list.js b/app/scripts/seo/controller/list.js new file mode 100644 index 00000000..dd45d8f3 --- /dev/null +++ b/app/scripts/seo/controller/list.js @@ -0,0 +1,109 @@ +(function (define, $) { + "use strict"; + + define(["seo/init"], function (seoModule) { + seoModule + .controller("seoListController", [ + "$rootScope", + "$scope", + "$location", + "$routeParams", + "$q", + "$dashboardListService", + "$seoService", + "$seoApiService", + "COUNT_ITEMS_PER_PAGE", + function ($rootScope, $scope, $location, $routeParams, $q, DashboardListService, $seoService, $seoApiService, COUNT_ITEMS_PER_PAGE) { + var getSeoList, serviceList, getSeoCount, getAttributeList, showColumns; + + serviceList = new DashboardListService(); + showColumns = { + 'url' : {'type' : 'select-link', 'label' : 'URL'}, + 'type' : {'label' : 'Type', 'filter' : 'text'} + }; + +// $seoService.init(); + $scope.idsSelectedRows = {}; + $scope.fields = []; + $scope.attributes = []; + + getSeoList = function() { + $seoApiService.list().$promise.then( + function (response) { + var result = response.result || []; + $scope.rewritesTmp = []; + + for (var i = 0; i < result.length; i += 1) { + $scope.rewritesTmp.push(result[i]); + } + console.log($scope.rewritesTmp); + } + ); + }; + + getAttributeList = function() { + var fields = ["url", "title", "meta_keywords", "meta_description", "type"]; + for (var i = 0; i < fields.length; i+=1) { + $scope.attributes.push({ + "Attribute": fields[i], + "Collection": "seo", + "Default": "", + "Editors": "text", + "Group": "SEO", + "IsRequired": false, + "IsStatic": true, + "Label": fields[i].charAt(0).toUpperCase() + fields[i].slice(1), + "Model": "Seo", + "Options": "", + "Type": "text", + "Value": "" + }); + } + serviceList.init('seo'); + serviceList.setAttributes($scope.attributes); + $scope.fields = $scope.fields.concat(serviceList.getFields(showColumns)); + }; + + /** + * Handler event when selecting the seo in the list + * + * @param id + */ + $scope.select = function (url) { + $location.path("/seo/" + url); + }; + + /** + * + */ + $scope.create = function () { + $location.path("/seo/new"); + }; + + $scope.$watch(function () { + if (typeof $scope.attributes !== "undefined" && typeof $scope.rewritesTmp !== "undefined") { + return true; + } + + return false; + }, function (isInitAll) { + if(isInitAll) { + $scope.rewrites = serviceList.getList($scope.rewritesTmp); + } + }); + + $scope.init = (function () { + if (JSON.stringify({}) === JSON.stringify($location.search())) { + $location.search("limit", "0," + COUNT_ITEMS_PER_PAGE); + return; + } + getAttributeList(); + getSeoList(); + })(); + } + ] + ); + + return seoModule; + }); +})(window.define, jQuery); diff --git a/app/scripts/seo/init.js b/app/scripts/seo/init.js index ebfa7629..7443f3c5 100644 --- a/app/scripts/seo/init.js +++ b/app/scripts/seo/init.js @@ -14,19 +14,38 @@ * */ angular.module.seoModule = angular.module("seoModule", ["ngRoute", "ngResource"]) + .config(["$routeProvider", function ($routeProvider) { + $routeProvider + .when("/seo", { + templateUrl: angular.getTheme("seo/list.html"), + controller: "seoListController" + }) +// .when("/order/:id", { +// templateUrl: angular.getTheme("order/edit.html"), +// controller: "orderEditController" +// }); + } + ]) .run([ "$loginLoginService", "$rootScope", "$designService", - "$dashboardHeaderService", "$route", - function ($loginService, $rootScope, $designService) { + "$dashboardSidebarService", + "$dashboardHeaderService", + function ($loginService, $rootScope, $designService, $route, $dashboardSidebarService, $dashboardHeaderService) { $designService.setTopPage("seo/index.html"); + + // NAVIGATION + // Adds item in the left top-menu + $dashboardHeaderService.addMenuItem("/seo", "seo", "/seo"); + // Adds item in the left sidebar + $dashboardSidebarService.addItem("/seo", "seo", "/seo", "fa fa-exchange", 6); } ]); return angular.module.seoModule; }); -})(window.define); \ No newline at end of file +})(window.define); diff --git a/app/scripts/seo/module.js b/app/scripts/seo/module.js index 952e2395..7ac01ca5 100644 --- a/app/scripts/seo/module.js +++ b/app/scripts/seo/module.js @@ -10,11 +10,13 @@ define([ "seo/service/api", "seo/service/seo", + "seo/controller/list", "seo/controller/seoEdit" + ], function (seoModule) { return seoModule; }); -})(window.define); \ No newline at end of file +})(window.define); diff --git a/app/scripts/seo/service/seo.js b/app/scripts/seo/service/seo.js index 42c4ad0f..74dfb6d3 100644 --- a/app/scripts/seo/service/seo.js +++ b/app/scripts/seo/service/seo.js @@ -42,6 +42,7 @@ ); }; + find = function (type, rewrite) { var i; @@ -178,4 +179,4 @@ return seoModule; }); -})(window.define); \ No newline at end of file +})(window.define); diff --git a/app/themes/default/views/seo/list.html b/app/themes/default/views/seo/list.html new file mode 100644 index 00000000..f17776bc --- /dev/null +++ b/app/themes/default/views/seo/list.html @@ -0,0 +1,14 @@ + +

+ + URL Rewrites +

+ +
+ + + + + + +
From 882a33bbc25d4b5005d39025b69bffc36c204889 Mon Sep 17 00:00:00 2001 From: OBesarab Date: Tue, 14 Apr 2015 10:27:28 -0500 Subject: [PATCH 012/160] fixed code --- app/themes/default/styles/bootstrap.css | 6 ------ app/themes/default/styles/style.css | 6 ++++++ app/themes/default/views/dashboard/welcome.html | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/themes/default/styles/bootstrap.css b/app/themes/default/styles/bootstrap.css index c3c6c13a..7c00bb66 100644 --- a/app/themes/default/styles/bootstrap.css +++ b/app/themes/default/styles/bootstrap.css @@ -2114,12 +2114,6 @@ th { .table-striped > tbody > tr:nth-child(odd) { background-color: #efefef; } -.statistic > tbody > tr > td:first-child { - word-break: break-all; -} -.statistic > tbody > tr > td:last-child { - width: 10px; -} .table-hover > tbody > tr:hover { background-color: #e9e9e9; -webkit-transition: all 0.5s ease; diff --git a/app/themes/default/styles/style.css b/app/themes/default/styles/style.css index d1ae11fc..3a89df1c 100755 --- a/app/themes/default/styles/style.css +++ b/app/themes/default/styles/style.css @@ -155,6 +155,12 @@ table th.checkboxes-column { .table-pagination-row .pagination { margin: 0; } +.table-statistic > tbody > tr > td:first-child { + word-break: break-all; +} +.table-statistic > tbody > tr > td:last-child { + width: 10px; +} #filters { display: none; } diff --git a/app/themes/default/views/dashboard/welcome.html b/app/themes/default/views/dashboard/welcome.html index bf352881..bc88648c 100644 --- a/app/themes/default/views/dashboard/welcome.html +++ b/app/themes/default/views/dashboard/welcome.html @@ -214,7 +214,7 @@

Top Sellers

Top Referrals

- +
+ + + @@ -132,4 +135,4 @@

Save Back to orders -
\ No newline at end of file +
From b2894012660c4621ce54e24188fe9a62608c1130 Mon Sep 17 00:00:00 2001 From: James Vastbinder Date: Tue, 14 Apr 2015 21:31:38 -0700 Subject: [PATCH 014/160] center order details text [92477190] [#92477190] --- app/themes/default/views/order/edit.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/themes/default/views/order/edit.html b/app/themes/default/views/order/edit.html index dba8db4d..0a15cad3 100644 --- a/app/themes/default/views/order/edit.html +++ b/app/themes/default/views/order/edit.html @@ -88,13 +88,13 @@

- + - + - +
From 5339b94259ae1d7e32581c985d2bd8b63b4da5e6 Mon Sep 17 00:00:00 2001 From: James Vastbinder Date: Tue, 14 Apr 2015 21:19:48 -0700 Subject: [PATCH 013/160] add size to orders [#92477190] --- app/themes/default/views/order/edit.html | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/themes/default/views/order/edit.html b/app/themes/default/views/order/edit.html index 73581692..dba8db4d 100644 --- a/app/themes/default/views/order/edit.html +++ b/app/themes/default/views/order/edit.html @@ -87,6 +87,9 @@

{{product.Name}}{{product.Options.Size.value}} {{product.Qty}}{{product.Name}} {{product.Options.Size.value}}{{product.Options.Size.value}} {{product.Qty}}{{product.Qty}} {{product.Price | currency}}{{product.Price | currency}}
From 87d2933de816298472a9ba8952c19b0d18f73058 Mon Sep 17 00:00:00 2001 From: James Vastbinder Date: Tue, 14 Apr 2015 21:41:22 -0700 Subject: [PATCH 015/160] adjust width for product name [#92477190] --- app/themes/default/views/order/edit.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/themes/default/views/order/edit.html b/app/themes/default/views/order/edit.html index 0a15cad3..28c69db9 100644 --- a/app/themes/default/views/order/edit.html +++ b/app/themes/default/views/order/edit.html @@ -85,7 +85,7 @@

{{product.Name}}{{product.Name}} {{product.Options.Size.value}}
- + - + - + - + - +
Company:Company: {{order.shipping_address.company}}
Name:Name: {{order.shipping_address.last_name}} {{order.shipping_address.first_name}}
Address:Address: {{order.shipping_address.address_line1}} {{order.shipping_address.address_line2}}, {{order.shipping_address.city}},
Zip,state,country:Zip,state,country: {{order.shipping_address.zip_code}}, {{order.shipping_address.state}}, {{order.shipping_address.country}}
Phone:Phone: {{order.shipping_address.phone}}
@@ -94,7 +94,7 @@

{{product.Qty}} - {{product.Price | currency}} + {{product.Price | currency}} @@ -103,20 +103,20 @@

- - + + - + - + - +
Subtotal:{{order.subtotal | currency}}Subtotal:{{order.subtotal | currency}}
Shipping{{order.shipping_amount | currency}}{{order.shipping_amount | currency}}
Tax:{{order.tax_amount | currency}}{{order.tax_amount | currency}}
Order Total:{{order.grand_total | currency}}{{order.grand_total | currency}}
From 369fb30b534f5eb12be1243ec731375d95cca1d9 Mon Sep 17 00:00:00 2001 From: Adam Willoughby-Knox Date: Wed, 15 Apr 2015 09:26:38 -0400 Subject: [PATCH 017/160] typo --- app/themes/default/views/order/edit.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/themes/default/views/order/edit.html b/app/themes/default/views/order/edit.html index aad65564..c85179d9 100644 --- a/app/themes/default/views/order/edit.html +++ b/app/themes/default/views/order/edit.html @@ -85,7 +85,7 @@

- {{product.Name}} + {{product.Name}} {{product.Options.Size.value}} From 79c0733c66f81ea9d720557cdf775d44235c47db Mon Sep 17 00:00:00 2001 From: Adam Knox Date: Wed, 15 Apr 2015 10:09:10 -0400 Subject: [PATCH 018/160] password validation text updates --- app/scripts/design/directives/validator/password.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/scripts/design/directives/validator/password.js b/app/scripts/design/directives/validator/password.js index c4e84bd5..0de2a7de 100644 --- a/app/scripts/design/directives/validator/password.js +++ b/app/scripts/design/directives/validator/password.js @@ -10,11 +10,11 @@ minCountNumbers = 1; minCountSymbols = 1; - passwordNotValidLength = "password should have " + minLen + " char or more"; - passwordNotEnoughLowercases = "password should have not less " + minCountUppercase + " lowercase"; - passwordNotEnoughUppercases = "password should have not less " + minCountUppercase + " uppercase"; - passwordNotEnoughNumbers = "password should have not less " + minCountNumbers + " numbers"; - passwordNotEnoughSymbols = "password should have not less " + minCountSymbols + " symbols"; + passwordNotValidLength = "password should have " + minLen + " characters or more"; + passwordNotEnoughLowercases = "password should have at least " + minCountUppercase + " lowercase"; + passwordNotEnoughUppercases = "password should have at least " + minCountUppercase + " uppercase"; + passwordNotEnoughNumbers = "password should have at least " + minCountNumbers + " numbers"; + passwordNotEnoughSymbols = "password should have at least " + minCountSymbols + " symbols"; designModule.directive("otPassword", function () { return { From f32d6ecf7940ce108a3527254bd172db53ef9712 Mon Sep 17 00:00:00 2001 From: Adam Knox Date: Wed, 15 Apr 2015 10:09:27 -0400 Subject: [PATCH 019/160] html typo --- app/themes/default/views/design/gui/table.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/themes/default/views/design/gui/table.html b/app/themes/default/views/design/gui/table.html index 0e281cd4..c56979f6 100644 --- a/app/themes/default/views/design/gui/table.html +++ b/app/themes/default/views/design/gui/table.html @@ -17,7 +17,7 @@
-
- \ No newline at end of file + From e8e8563250b93d59f3dfbf2e7e97320101745000 Mon Sep 17 00:00:00 2001 From: OBesarab Date: Wed, 15 Apr 2015 09:54:34 -0500 Subject: [PATCH 020/160] [#86229562] add editor, no rewrite object selector --- app/scripts/cms/controller/pageList.js | 2 +- app/scripts/seo/controller/edit.js | 171 +++++++++++++++++++++++++ app/scripts/seo/controller/list.js | 106 +++++++++++++-- app/scripts/seo/controller/seoEdit.js | 4 +- app/scripts/seo/init.js | 12 +- app/scripts/seo/module.js | 1 + app/themes/default/views/seo/edit.html | 18 +++ 7 files changed, 294 insertions(+), 20 deletions(-) create mode 100644 app/scripts/seo/controller/edit.js create mode 100644 app/themes/default/views/seo/edit.html diff --git a/app/scripts/cms/controller/pageList.js b/app/scripts/cms/controller/pageList.js index f3cc8ea8..5f93be6d 100644 --- a/app/scripts/cms/controller/pageList.js +++ b/app/scripts/cms/controller/pageList.js @@ -17,7 +17,7 @@ showColumns = { 'identifier' : {'type' : 'select-link'}, 'enabled' : {}, - 'pagetitle' : {'label' : 'Title of Page'} + 'title' : {} }; // Initialize SEO diff --git a/app/scripts/seo/controller/edit.js b/app/scripts/seo/controller/edit.js new file mode 100644 index 00000000..71badffe --- /dev/null +++ b/app/scripts/seo/controller/edit.js @@ -0,0 +1,171 @@ +(function (define) { + "use strict"; + + define(["seo/init"], function (seoModule) { + seoModule + .controller("seoIndependentEditController", [ + "$scope", + "$routeParams", + "$location", + "$q", + "$seoApiService", + "$dashboardUtilsService", + function ($scope, $routeParams, $location, $q, $seoApiService, $dashboardUtilsService) { + // Functions + var getAttributeList, getDefaultSEO; + // Variables + var seoURL, seoAttributes; + + seoAttributes = {"url":{"IsRequired": true, "Label": "URL"}, + "title":{}, + "meta_keywords":{}, + "meta_description":{}, + "rewrite":{"IsRequired": true}, + "type":{"IsRequired": true, "Editors": "select", "Options": "page,category,product"} + }; + // not_editable, seo_selector, product_selector, selector : Options: "new,pending,canceled,complete" + + seoURL = $routeParams.id; + + if (!seoURL && seoURL !== "new") { + $location.path("/seo"); + } + + if (seoURL === "new") { + seoURL = null; + } + + getDefaultSEO = function () { + return { + "url": "", + "title": "", + "type": "", + "meta_keywords": "", + "meta_description": "" + }; + }; + + $scope.seo = {}; + + getAttributeList = function() { + $scope.attributes = []; + + for (var attributeName in seoAttributes) { + if (typeof seoAttributes[attributeName] !== "undefined") { + var obj = { + "Attribute": attributeName, + "Collection": "seo", + "Default": "", + "Editors": "text", + "Group": "SEO", + "IsRequired": false, + "IsStatic": true, + "Label": attributeName.charAt(0).toUpperCase() + attributeName.slice(1), + "Model": "Seo", + "Options": "", + "Type": "text", + "Value": "" + }; + + for (var attributeKeys in seoAttributes[attributeName]) { + if ( obj.hasOwnProperty(attributeKeys) ) { + obj[attributeKeys] = seoAttributes[attributeName][attributeKeys]; + } + } + $scope.attributes.push(obj); + } + } + }; + + getAttributeList(); + + if (null !== seoURL) { + $seoApiService.get({"url": seoURL}).$promise.then(function (response) { + var result = response.result[0] || {}; + $scope.seo = result; + }); + } + + $scope.back = function () { + $location.path("/seo"); + }; + + /** + * Event handler to save the seo data. + * Creates new seo if ID in current seo is empty OR updates current seo if ID is set + */ + $scope.save = function () { + $('[ng-click="save()"]').addClass('disabled').append('').siblings('.btn').addClass('disabled'); + + var id, defer, saveSuccess, saveError, updateSuccess, updateError; + defer = $q.defer(); + + if (typeof $scope.seo !== "undefined") { + id = $scope.seo.Id || $scope.seo._id; + } + + /** + * + * @param response + */ + saveSuccess = function (response) { + if (response.error === null) { + $scope.seo = response.result || getDefaultSEO(); + $scope.message = $dashboardUtilsService.getMessage(null, 'success', 'URL rewrite was created successfully'); + defer.resolve(true); + } + $('[ng-click="save()"]').removeClass('disabled').children('i').remove(); + $('[ng-click="save()"]').siblings('.btn').removeClass('disabled'); + }; + + /** + * + * @param response + */ + saveError = function () { + defer.resolve(false); + $('[ng-click="save()"]').removeClass('disabled').children('i').remove(); + $('[ng-click="save()"]').siblings('.btn').removeClass('disabled'); + }; + + /** + * + * @param response + */ + updateSuccess = function (response) { + if (response.error === null) { + $scope.seo = response.result || getDefaultSEO(); + $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'); + } + }; + + /** + * + * @param response + */ + updateError = function () { + defer.resolve(false); + $('[ng-click="save()"]').removeClass('disabled').children('i').remove(); + $('[ng-click="save()"]').siblings('.btn').removeClass('disabled'); + }; + + if (!id) { + if ($scope.seo.url !== "" && $scope.seo.rewrite !== "" ) { + $seoApiService.add($scope.seo, saveSuccess, saveError); + } + } else { + $seoApiService.update({"itemID": id}, $scope.seo, updateSuccess, updateError); + } + + return defer.promise; + }; + } + ] + ); + + return seoModule; + }); +})(window.define); diff --git a/app/scripts/seo/controller/list.js b/app/scripts/seo/controller/list.js index dd45d8f3..4553abde 100644 --- a/app/scripts/seo/controller/list.js +++ b/app/scripts/seo/controller/list.js @@ -14,35 +14,59 @@ "$seoApiService", "COUNT_ITEMS_PER_PAGE", function ($rootScope, $scope, $location, $routeParams, $q, DashboardListService, $seoService, $seoApiService, COUNT_ITEMS_PER_PAGE) { - var getSeoList, serviceList, getSeoCount, getAttributeList, showColumns; + var getSeoList, serviceList, getAttributeList, showColumns, seoList, seoIdToUrl; serviceList = new DashboardListService(); showColumns = { 'url' : {'type' : 'select-link', 'label' : 'URL'}, - 'type' : {'label' : 'Type', 'filter' : 'text'} + 'type' : {'label' : 'Type', 'filter' : 'text'}, + 'title': {} }; -// $seoService.init(); $scope.idsSelectedRows = {}; $scope.fields = []; - $scope.attributes = []; + + /** + * Gets values for url rewrites + */ + var getSeoValues = function(url) { + $seoApiService.get({"url": url}).$promise.then( + function (response) { + response.result[0]["ID"] = response.result[0]["_id"]; + seoIdToUrl[response.result[0]["_id"]] = response.result[0]["url"]; + $scope.rewritesTmp.push(response.result[0]); + } + ); + }; + + /** + * Gets list and count of url rewrites + */ getSeoList = function() { $seoApiService.list().$promise.then( function (response) { - var result = response.result || []; + seoList = response.result || []; + $scope.count = seoList.length; $scope.rewritesTmp = []; + seoIdToUrl = {}; - for (var i = 0; i < result.length; i += 1) { - $scope.rewritesTmp.push(result[i]); + for (var i = 0; i < seoList.length; i += 1) { + getSeoValues(seoList[i]["url"]); } - console.log($scope.rewritesTmp); } ); }; + + + /** + * Gets list of attributes for url rewrites + */ getAttributeList = function() { var fields = ["url", "title", "meta_keywords", "meta_description", "type"]; + $scope.attributes = []; + for (var i = 0; i < fields.length; i+=1) { $scope.attributes.push({ "Attribute": fields[i], @@ -69,8 +93,8 @@ * * @param id */ - $scope.select = function (url) { - $location.path("/seo/" + url); + $scope.select = function (id) { + $location.path("/seo/" + seoIdToUrl[id]); }; /** @@ -80,9 +104,69 @@ $location.path("/seo/new"); }; + var hasSelectedRows = function () { + var result = false; + for (var _id in $scope.idsSelectedRows) { + if ($scope.idsSelectedRows.hasOwnProperty(_id) && $scope.idsSelectedRows[_id]) { + result = true; + } + } + return result; + }; + + /** + * Removes seo by ID + * + */ + $scope.remove = function () { + + if (!hasSelectedRows()) { + return true; + } + + var i, answer, _remove; + answer = window.confirm("Please confirm you want to remove this url rewrite."); + _remove = function (id) { + var defer = $q.defer(); + + $seoApiService.remove({"itemID": id}, + function (response) { + if (response.result === "ok") { + defer.resolve(id); + } else { + defer.resolve(false); + } + } + ); + + 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.rewrites.length; i += 1) { + if ($scope.rewrites[i].ID === response) { + $scope.rewrites.splice(i, 1); + } + } + } + }; + + for (var id in $scope.idsSelectedRows) { + if ($scope.idsSelectedRows.hasOwnProperty(id) && true === $scope.idsSelectedRows[id]) { + _remove(id).then(callback); + } + } + } + $('[ng-click="parent.remove()"]').removeClass('disabled').children('i').remove(); + $('[ng-click="parent.remove()"]').siblings('.btn').removeClass('disabled'); + + }; + $scope.$watch(function () { if (typeof $scope.attributes !== "undefined" && typeof $scope.rewritesTmp !== "undefined") { - return true; + return ($scope.rewritesTmp.length === $scope.count); } return false; diff --git a/app/scripts/seo/controller/seoEdit.js b/app/scripts/seo/controller/seoEdit.js index 582f8951..f0bf7bbf 100644 --- a/app/scripts/seo/controller/seoEdit.js +++ b/app/scripts/seo/controller/seoEdit.js @@ -56,7 +56,7 @@ * unique fields are saved in seoUniqueFields variable * */ - getUniqueSeoNames = function () { + getUniqueSeoNames = function () { /*jshint maxcomplexity:6 */ if (typeof $scope.attributes !== "undefined" && seoUniqueFields.length < 1) { var seoUniqueNames = seoUniqueFields; var i, uniqueSeoFirstWord = "seo_", existingAttributes = []; @@ -223,7 +223,7 @@ removeAttributes = function () { if (typeof $scope.attributes !== "undefined") { for (var i=0; i < $scope.attributes.length; i+=1) { - if (seoUniqueFields.indexOf($scope.attributes[i].Attribute) !== -1 && $scope.attributes[i].Group == "SEO") { + if (seoUniqueFields.indexOf($scope.attributes[i].Attribute) !== -1 && $scope.attributes[i].Group === "SEO") { $scope.attributes.splice(i, 1); } } diff --git a/app/scripts/seo/init.js b/app/scripts/seo/init.js index 7443f3c5..89423e44 100644 --- a/app/scripts/seo/init.js +++ b/app/scripts/seo/init.js @@ -20,10 +20,10 @@ templateUrl: angular.getTheme("seo/list.html"), controller: "seoListController" }) -// .when("/order/:id", { -// templateUrl: angular.getTheme("order/edit.html"), -// controller: "orderEditController" -// }); + .when("/seo/:id", { + templateUrl: angular.getTheme("seo/edit.html"), + controller: "seoIndependentEditController" + }); } ]) @@ -39,9 +39,9 @@ // NAVIGATION // Adds item in the left top-menu - $dashboardHeaderService.addMenuItem("/seo", "seo", "/seo"); + $dashboardHeaderService.addMenuItem("/seo", "URL Rewrite", "/seo"); // Adds item in the left sidebar - $dashboardSidebarService.addItem("/seo", "seo", "/seo", "fa fa-exchange", 6); + $dashboardSidebarService.addItem("/seo", "URL Rewrite", "/seo", "fa fa-random", 3); } ]); diff --git a/app/scripts/seo/module.js b/app/scripts/seo/module.js index 7ac01ca5..bec3ce6f 100644 --- a/app/scripts/seo/module.js +++ b/app/scripts/seo/module.js @@ -11,6 +11,7 @@ "seo/service/api", "seo/service/seo", "seo/controller/list", + "seo/controller/edit", "seo/controller/seoEdit" ], diff --git a/app/themes/default/views/seo/edit.html b/app/themes/default/views/seo/edit.html new file mode 100644 index 00000000..609cb02e --- /dev/null +++ b/app/themes/default/views/seo/edit.html @@ -0,0 +1,18 @@ + +

+ + SEO: {{seo.title}} +

+

+ + New SEO +

+ +
+ + + + + + +
From 3f0e8ecddfbfcbb3423f4ba659c7d69d67a8eed6 Mon Sep 17 00:00:00 2001 From: Adam Knox Date: Wed, 15 Apr 2015 13:51:59 -0400 Subject: [PATCH 021/160] remove name field, we already have first and last name --- app/scripts/visitor/controller/visitorList.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/scripts/visitor/controller/visitorList.js b/app/scripts/visitor/controller/visitorList.js index a3560aac..97bec341 100644 --- a/app/scripts/visitor/controller/visitorList.js +++ b/app/scripts/visitor/controller/visitorList.js @@ -14,12 +14,13 @@ "COUNT_ITEMS_PER_PAGE", function ($scope, $routeParams, $location, $q, DashboardListService, $visitorApiService, COUNT_ITEMS_PER_PAGE) { var serviceList, getVisitorsList, getVisitorCount, getAttributeList, showColumns; + serviceList = new DashboardListService(); + showColumns = { - 'name' : {'type' : 'select-link', 'label' : 'Name'}, - 'email' : {}, - 'first_name' : {}, 'last_name' : {}, + 'first_name' : {}, + 'email' : {}, 'is_admin' : {} }; From 1fe7cf8d46eaf42fcf09791b37e3e794e6f79d80 Mon Sep 17 00:00:00 2001 From: Adam Knox Date: Wed, 15 Apr 2015 14:35:48 -0400 Subject: [PATCH 022/160] reset commit --- app/scripts/visitor/controller/visitorList.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/scripts/visitor/controller/visitorList.js b/app/scripts/visitor/controller/visitorList.js index 97bec341..d4977598 100644 --- a/app/scripts/visitor/controller/visitorList.js +++ b/app/scripts/visitor/controller/visitorList.js @@ -18,9 +18,10 @@ serviceList = new DashboardListService(); showColumns = { - 'last_name' : {}, - 'first_name' : {}, + 'name' : {'type' : 'select-link', 'label' : 'Name'}, 'email' : {}, + 'first_name' : {}, + 'last_name' : {}, 'is_admin' : {} }; From e1fa31e91d4c6652b0ea5c1ef13d4a6181b2efd1 Mon Sep 17 00:00:00 2001 From: Adam Knox Date: Wed, 15 Apr 2015 14:36:15 -0400 Subject: [PATCH 023/160] add refactor note to function --- app/scripts/dashboard/service/list.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/scripts/dashboard/service/list.js b/app/scripts/dashboard/service/list.js index 5666582d..26231f86 100644 --- a/app/scripts/dashboard/service/list.js +++ b/app/scripts/dashboard/service/list.js @@ -91,8 +91,11 @@ }; If showColumns not specified fields will be filled by editable attributes. */ + // TODO: Refactor, too complex + // also if we could pass in an array we could control the order of the fields + // from the request. getFields = function (showColumns) { - /*jshint maxcomplexity:false */ + if (isInitFields) { for (var j = 0; j < fields.length; j += 1) { fields[j].filterValue = $routeParams[fields[j].attribute]; From c9ebfcd6c66060f2ff0c30cd52f91ef4fc326fb9 Mon Sep 17 00:00:00 2001 From: OBesarab Date: Thu, 16 Apr 2015 10:04:47 -0500 Subject: [PATCH 024/160] [#86229562] added selectors for SEO manager --- app/scripts/category/controller/edit.js | 1 + .../directives/editor/guiCategorySelector.js | 2 +- .../directives/editor/guiPageSelector.js | 152 ++++++++++++ .../directives/editor/guiProductSelector.js | 3 +- .../directives/editor/guiProductsSelector.js | 221 ++++++++++++++++++ app/scripts/design/module.js | 4 +- app/scripts/seo/controller/edit.js | 110 ++++++++- .../views/design/gui/editor/pageSelector.html | 26 +++ .../design/gui/editor/productsSelector.html | 26 +++ .../default/views/design/gui/formBuilder.html | 27 ++- 10 files changed, 550 insertions(+), 22 deletions(-) create mode 100644 app/scripts/design/directives/editor/guiPageSelector.js create mode 100644 app/scripts/design/directives/editor/guiProductsSelector.js create mode 100644 app/themes/default/views/design/gui/editor/pageSelector.html create mode 100644 app/themes/default/views/design/gui/editor/productsSelector.html diff --git a/app/scripts/category/controller/edit.js b/app/scripts/category/controller/edit.js index 562ff9ad..9787190a 100644 --- a/app/scripts/category/controller/edit.js +++ b/app/scripts/category/controller/edit.js @@ -79,6 +79,7 @@ $scope.category = result; rememberProducts(); $scope.category.parent = $scope.category['parent_id']; + $scope.selectedImage = result['image']; addImageManagerAttribute(); }); } diff --git a/app/scripts/design/directives/editor/guiCategorySelector.js b/app/scripts/design/directives/editor/guiCategorySelector.js index 911bbd73..1786359d 100644 --- a/app/scripts/design/directives/editor/guiCategorySelector.js +++ b/app/scripts/design/directives/editor/guiCategorySelector.js @@ -60,7 +60,7 @@ $scope.select = function (id) { $scope.item[$scope.attribute.Attribute] = id; - $scope.hide("parent_id"); + $scope.hide($scope.attribute.Attribute); }; $scope.show = function (id) { diff --git a/app/scripts/design/directives/editor/guiPageSelector.js b/app/scripts/design/directives/editor/guiPageSelector.js new file mode 100644 index 00000000..8a256840 --- /dev/null +++ b/app/scripts/design/directives/editor/guiPageSelector.js @@ -0,0 +1,152 @@ +(function (define, $) { + "use strict"; + + define(["design/init"], function (designModule) { + + designModule + /** + * Directive used for automatic attribute editor creation + */ + .directive("guiPageSelector", [ + "$location", + "$routeParams", + "$designService", + "$dashboardListService", + "$cmsApiService", + function ($location, $routeParams, $designService, DashboardListService, $cmsApiService) { + var serviceList = new DashboardListService(), showColumns; + showColumns = { + 'identifier' : {'type' : 'select-link'}, + 'enabled' : {}, + 'title' : {} + }; + + return { + restrict: "E", + templateUrl: $designService.getTemplate("design/gui/editor/pageSelector.html"), + + scope: { + "attribute": "=editorScope", + "item": "=item" + }, + + controller: function ($scope) { + var loadData; + + $scope.oldSearch = {}; + + /** + * ?? + * + */ + $scope.getParentName = function () { + var name = ""; + if (typeof $scope.item !== "undefined" && + typeof $scope.items !== "undefined" && + typeof $scope.item[$scope.attribute.Attribute] !== "undefined") { + + for (var i = 0; i < $scope.items.length; i += 1) { + + if ($scope.items[i].ID === $scope.item[$scope.attribute.Attribute] || + $scope.items[i].ID === $scope.item.parent) { + name = $scope.items[i].Name; + break; + } + } + } + + return name; + }; + + $scope.select = function (id) { + $scope.item[$scope.attribute.Attribute] = id; + $scope.hide($scope.attribute.Attribute); + }; + + $scope.show = function (id) { + serviceList.init('pages'); + $("#" + id).modal("show"); + }; + + $scope.hide = function (id) { + $("#" + id).modal("hide"); + }; + + $scope.clear = function () { + $scope.item[$scope.attribute.Attribute] = ""; + $scope.item.parent = ""; + }; + + loadData = function () { + + if (typeof $scope.search === "undefined") { + $scope.search = {}; + } + + /** + * Gets list of pages + */ + var getPagesList = function () { + var params = $scope.search; + params["extra"] = serviceList.getExtraFields(); + $cmsApiService.pageList(params).$promise.then( + function (response) { + var result, i; + $scope.pagesTmp = []; + result = response.result || []; + for (i = 0; i < result.length; i += 1) { + if (result[i].ID !== $scope.item._id) { + $scope.pagesTmp.push(result[i]); + } + } + } + ); + }; + + /** + * Gets count of categories + */ + $cmsApiService.pageCount($scope.search).$promise.then( + function (response) { + if (response.error === null) { + $scope.count = response.result; + } else { + $scope.count = 0; + } + } + ); + + $cmsApiService.pageAttributes().$promise.then( + function (response) { + var result = response.result || []; + serviceList.init('pages'); + $scope.attributes = result; + serviceList.setAttributes($scope.attributes); + $scope.fields = serviceList.getFields(showColumns); + getPagesList(); + } + ); + + var prepareList = function () { + if (typeof $scope.attributes === "undefined" || typeof $scope.pagesTmp === "undefined") { + return false; + } + + $scope.items = serviceList.getList($scope.pagesTmp); + }; + + $scope.$watch("pagesTmp", prepareList); + $scope.$watch("attributes", prepareList); + }; + + $scope.$watch("search", function () { + loadData(); + }); + + } + }; + }]); + + return designModule; + }); +})(window.define, jQuery); diff --git a/app/scripts/design/directives/editor/guiProductSelector.js b/app/scripts/design/directives/editor/guiProductSelector.js index e35f4515..3eb08f32 100644 --- a/app/scripts/design/directives/editor/guiProductSelector.js +++ b/app/scripts/design/directives/editor/guiProductSelector.js @@ -32,8 +32,7 @@ 'name' : {'type' : 'select-link', 'label' : 'Name'}, 'enabled' : {}, 'sku' : {}, - 'price' : {}, - 'weight' : {} + 'price' : {} }; return { diff --git a/app/scripts/design/directives/editor/guiProductsSelector.js b/app/scripts/design/directives/editor/guiProductsSelector.js new file mode 100644 index 00000000..aac6e1c2 --- /dev/null +++ b/app/scripts/design/directives/editor/guiProductsSelector.js @@ -0,0 +1,221 @@ +(function (define, $) { + "use strict"; + + define(["design/init"], function (designModule) { + var clone = function (obj) { + if (null === obj || "object" !== typeof obj) { + return obj; + } + var copy = obj.constructor(); + for (var attr in obj) { + if (obj.hasOwnProperty(attr)) { + copy[attr] = obj[attr]; + } + } + return copy; + }; + designModule + /** + * Directive used for automatic attribute editor creation + */ + .directive("guiProductsSelector", [ + "$location", + "$routeParams", + "$designService", + "$dashboardListService", + "$productApiService", + "$designImageService", + "COUNT_ITEMS_PER_PAGE", + function ($location, $routeParams, $designService, DashboardListService, $productApiService, $designImageService, COUNT_ITEMS_PER_PAGE) { + var serviceList = new DashboardListService(), showColumns; + showColumns = { + 'name' : {'type' : 'select-link', 'label' : 'Name'}, + 'enabled' : {}, + 'sku' : {}, + 'price' : {} + }; + + return { + restrict: "E", + templateUrl: $designService.getTemplate("design/gui/editor/productsSelector.html"), + + scope: { + "attribute": "=editorScope", + "item": "=item", + "parent": "=parent" + }, + + controller: function ($scope) { + var loadData; + + $scope.oldSearch = {}; + $scope.selected = {}; + $scope.isExpand = false; + $scope.countSelected = 0; + + var oldWidth, getCountItems; + + /** + * Get Name of selected object + * + * @returns string + */ + $scope.getParentName = function () { + var name = ""; + if (typeof $scope.item !== "undefined" && + typeof $scope.items !== "undefined" && + typeof $scope.item[$scope.attribute.Attribute] !== "undefined") { + + for (var i = 0; i < $scope.items.length; i += 1) { + + if ($scope.items[i].ID === $scope.item[$scope.attribute.Attribute] || + $scope.items[i].ID === $scope.item.parent) { + name = $scope.items[i].Name; + break; + } + } + } + + return name; + }; + + $scope.select = function (id) { + $scope.item[$scope.attribute.Attribute] = id; + $scope.hide($scope.attribute.Attribute); + }; + + $scope.show = function (id) { + serviceList.init('products'); + $("#" + id).modal("show"); + }; + + $scope.hide = function (id) { + $("#" + id).modal("hide"); + }; + + $scope.clear = function () { + $scope.item[$scope.attribute.Attribute] = ""; + $scope.item.parent = ""; + }; + + + loadData = function () { + $scope.fields = [ + { + "attribute": "Image", + "type": "image", + "label": "", + "visible": true + } + ]; + if (typeof $scope.search === "undefined") { + $scope.search = {}; + $scope.search.limit = "0," + COUNT_ITEMS_PER_PAGE; + } + if (typeof $scope.search.limit === "undefined") { + $scope.search.limit = "0," + COUNT_ITEMS_PER_PAGE; + } + + if (JSON.stringify($scope.oldSearch) === JSON.stringify($scope.search)) { + return false; + } + + $scope.oldSearch = clone($scope.search); + + var getProductsList = function () { + var params = $scope.search; + params["extra"] = serviceList.getExtraFields(); + $productApiService.productList(params).$promise.then( + function (response) { + var result, i; + $scope.productsTmp = []; + result = response.result || []; + + for (i = 0; i < result.length; i += 1) { + if (typeof $scope.parent.excludeItems !== "undefined" && -1 !== $scope.parent.excludeItems.indexOf(result[i].ID)) { + continue; + } + result[i].Name = result[i].Extra.name; + result[i].sku = result[i].Extra.sku; + $scope.productsTmp.push(result[i]); + } + } + ); + }; + /** + * Gets list of products + */ + var getProductCount = function () { + $productApiService.getCount($scope.search, {}).$promise.then(function (response) { + if (response.error === null) { + $scope.count = response.result; + } else { + $scope.count = 0; + } + }); + }; + + var getAttributeList = function () { + $productApiService.attributesInfo().$promise.then(function (response) { + var result = response.result || []; + serviceList.init('products'); + $scope.attributes = result; + serviceList.setAttributes($scope.attributes); + $scope.fields = $scope.fields.concat(serviceList.getFields(showColumns)); + getProductsList(); + }); + }; + + $scope.$watch(function () { + if (typeof $scope.attributes !== "undefined" && typeof $scope.productsTmp !== "undefined") { + return true; + } + + return false; + }, function (isInitAll) { + if (isInitAll) { + $scope.items = serviceList.getList($scope.productsTmp); + } + }); + + $scope.init = (function () { + getProductCount(); + getAttributeList(); + })(); + }; + + $scope.$watch("search", function () { + delete $scope.productsTmp; + loadData(); + }); + + + + /** + * Returns full path to image + * + * @param {string} path - the destination path to product folder + * @param {string} image - image name + * @returns {string} - full path to image + */ + $scope.getImage = function (image) { + return $designImageService.getFullImagePath("", image); + }; + + $scope.expand = function () { + oldWidth = $('.modal-dialog').css("width"); + $('.modal-dialog').css("width", "90%"); + $scope.isExpand = true; + }; + + $scope.compress = function () { + $('.modal-dialog').css("width", oldWidth || "600px"); + $scope.isExpand = false; + }; + } + }; + }]); + + return designModule; + }); +})(window.define, jQuery); diff --git a/app/scripts/design/module.js b/app/scripts/design/module.js index fb4d116b..239f6bda 100644 --- a/app/scripts/design/module.js +++ b/app/scripts/design/module.js @@ -45,6 +45,8 @@ "design/directives/editor/guiModelSelector", "design/directives/editor/guiArrayModelSelector", "design/directives/editor/guiVisitorSelector", + "design/directives/editor/guiPageSelector", + "design/directives/editor/guiProductsSelector", "design/directives/editor/guiProductSelector", "design/directives/editor/guiCategorySelector", "design/directives/editor/guiNotEditable", @@ -67,4 +69,4 @@ return designModule; }); -})(window.define); \ No newline at end of file +})(window.define); diff --git a/app/scripts/seo/controller/edit.js b/app/scripts/seo/controller/edit.js index 71badffe..41d7abd5 100644 --- a/app/scripts/seo/controller/edit.js +++ b/app/scripts/seo/controller/edit.js @@ -12,18 +12,20 @@ "$dashboardUtilsService", function ($scope, $routeParams, $location, $q, $seoApiService, $dashboardUtilsService) { // Functions - var getAttributeList, getDefaultSEO; + var getAttributeList, getDefaultSEO, checkAttributePosition, getRewriteList; // Variables - var seoURL, seoAttributes; + var seoURL, seoAttributes, seoRewriteNum, seoRewriteList; + + seoRewriteNum = 5; seoAttributes = {"url":{"IsRequired": true, "Label": "URL"}, "title":{}, "meta_keywords":{}, "meta_description":{}, - "rewrite":{"IsRequired": true}, - "type":{"IsRequired": true, "Editors": "select", "Options": "page,category,product"} + "type":{"IsRequired": true, "Editors": "select", "Options": "page,category,product"}, + "rewrite":{"IsRequired": true, "Editors": "seo_selector", "Label": "Object"} }; - // not_editable, seo_selector, product_selector, selector : Options: "new,pending,canceled,complete" + // not_editable, seo_selector, product_selector, "Options": "page,category,product" seoURL = $routeParams.id; @@ -79,6 +81,31 @@ getAttributeList(); + /** + * Gets values for url rewrites :( + */ + var getSeoValues = function(url) { + $seoApiService.get({"url": url}).$promise.then( + function (response) { + seoRewriteList[response.result[0]["rewrite"]] = response.result[0]["_id"]; + } + ); + }; + + getRewriteList = function () { + $seoApiService.list().$promise.then( + function (response) { + seoRewriteList = {}; + var i, seoList = response.result || []; + for (i = 0; i < seoList.length; i += 1) { + getSeoValues(seoList[i]["url"]); + } + } + ); + }; + + getRewriteList(); + if (null !== seoURL) { $seoApiService.get({"url": seoURL}).$promise.then(function (response) { var result = response.result[0] || {}; @@ -97,7 +124,7 @@ $scope.save = function () { $('[ng-click="save()"]').addClass('disabled').append('').siblings('.btn').addClass('disabled'); - var id, defer, saveSuccess, saveError, updateSuccess, updateError; + var id, defer, saveSuccess, saveError, existingSeo, updateSuccess, updateError, regexp = /^\w*/; defer = $q.defer(); if (typeof $scope.seo !== "undefined") { @@ -152,16 +179,79 @@ $('[ng-click="save()"]').siblings('.btn').removeClass('disabled'); }; - if (!id) { - if ($scope.seo.url !== "" && $scope.seo.rewrite !== "" ) { + if (!regexp.test($scope.seo.url)) { + $scope.message = $dashboardUtilsService.getMessage(null, 'warning', 'The field url invalid'); + updateError(); + } + + /** + * Check for existing rewrite and drop a message for it + * if no so we creating new one and make save of it + */ + + if ($scope.seo.rewrite.length < 4) { + $scope.message = $dashboardUtilsService.getMessage(null, 'warning', 'Need to specify object to rewrite'); + updateError(); + } + + if (typeof seoRewriteList[$scope.seo.rewrite] === "undefined") { + if (typeof id !== "undefined") { + $seoApiService.update({"itemID": id}, $scope.seo, updateSuccess, updateError); + } else { $seoApiService.add($scope.seo, saveSuccess, saveError); } - } else { - $seoApiService.update({"itemID": id}, $scope.seo, updateSuccess, updateError); + } + else { + if (id === seoRewriteList[$scope.seo.rewrite]) { + $seoApiService.update({"itemID": id}, $scope.seo, updateSuccess, updateError); + } + $scope.message = $dashboardUtilsService.getMessage(null, 'warning', 'Rewrite for this object is already exist'); + saveError(); } return defer.promise; }; + + checkAttributePosition = function () { + if ($scope.attributes[seoRewriteNum]["Attribute"] = "rewrite") { + return seoRewriteNum; + } else { + for (var i=0; i < $scope.attributes.length; i+=1){ + if ($scope.attributes[i]["Attribute"] = "rewrite") { + seoRewriteNum = i; + return i; + } + } + } + } + + $scope.$watch(function () { + return $scope.seo.type; + + }, function (newVal, oldVal) { + if (typeof $scope.attributes !== "undefined") { + checkAttributePosition(); + if (typeof newVal !== "undefined" && typeof oldVal !== "undefined"){ + $scope.seo.rewrite = ""; + } + switch (newVal) { + case "category": + $scope.attributes[seoRewriteNum]["Editors"] = "category_selector"; + break; + + case "product": + $scope.attributes[seoRewriteNum]["Editors"] = "products_selector"; + break; + + case "page": + $scope.attributes[seoRewriteNum]["Editors"] = "page_selector"; + break; + + default: + $scope.attributes[seoRewriteNum]["Editors"] = "not_editable"; + } + } + }, true); } ] ); diff --git a/app/themes/default/views/design/gui/editor/pageSelector.html b/app/themes/default/views/design/gui/editor/pageSelector.html new file mode 100644 index 00000000..68aa60cc --- /dev/null +++ b/app/themes/default/views/design/gui/editor/pageSelector.html @@ -0,0 +1,26 @@ +
+ + Selected: + {{getParentName()}} + +
+ + diff --git a/app/themes/default/views/design/gui/editor/productsSelector.html b/app/themes/default/views/design/gui/editor/productsSelector.html new file mode 100644 index 00000000..13b187d1 --- /dev/null +++ b/app/themes/default/views/design/gui/editor/productsSelector.html @@ -0,0 +1,26 @@ +
+ + Selected: + {{getParentName()}} + +
+ + diff --git a/app/themes/default/views/design/gui/formBuilder.html b/app/themes/default/views/design/gui/formBuilder.html index f942cae2..36eb2dcf 100644 --- a/app/themes/default/views/design/gui/formBuilder.html +++ b/app/themes/default/views/design/gui/formBuilder.html @@ -11,7 +11,7 @@ (parent.form.{{attribute.Attribute}}.$invalid && !parent.form.{{attribute.Attribute}}.$pristine) }"> - +

This field is required.

@@ -43,7 +43,7 @@ ng-show="attribute.IsRequired">* - +

This field is required.

@@ -207,7 +207,18 @@ - + + +
+ + +
+ +
+ + +
+
@@ -218,7 +229,7 @@

- +
@@ -231,7 +242,7 @@

- +

This field is required.

@@ -240,7 +251,7 @@

(parent.form.{{attribute.Attribute}}.$invalid && !parent.form.{{attribute.Attribute}}.$pristine)" class="help-block">{{parent.form[attribute.Attribute].message}}

- +
@@ -248,6 +259,6 @@

- + -
\ No newline at end of file +
From 55f1e93cfbd929216a3eef35fa8eb0d9331d8201 Mon Sep 17 00:00:00 2001 From: OBesarab Date: Fri, 17 Apr 2015 05:01:56 -0500 Subject: [PATCH 025/160] fixes and ranaming, removed unused staff --- .../directives/editor/guiPageSelector.js | 2 +- .../directives/editor/guiProductsSelector.js | 2 +- .../design/directives/editor/guiSelect.js | 19 ++++--- app/scripts/seo/controller/edit.js | 57 ++++++++----------- app/scripts/seo/controller/seoEdit.js | 2 - .../views/design/gui/editor/pageSelector.html | 2 +- 6 files changed, 39 insertions(+), 45 deletions(-) diff --git a/app/scripts/design/directives/editor/guiPageSelector.js b/app/scripts/design/directives/editor/guiPageSelector.js index 8a256840..8d2261a1 100644 --- a/app/scripts/design/directives/editor/guiPageSelector.js +++ b/app/scripts/design/directives/editor/guiPageSelector.js @@ -104,7 +104,7 @@ }; /** - * Gets count of categories + * Gets count of pages */ $cmsApiService.pageCount($scope.search).$promise.then( function (response) { diff --git a/app/scripts/design/directives/editor/guiProductsSelector.js b/app/scripts/design/directives/editor/guiProductsSelector.js index aac6e1c2..25a1ca54 100644 --- a/app/scripts/design/directives/editor/guiProductsSelector.js +++ b/app/scripts/design/directives/editor/guiProductsSelector.js @@ -53,7 +53,7 @@ $scope.isExpand = false; $scope.countSelected = 0; - var oldWidth, getCountItems; + var oldWidth; /** * Get Name of selected object diff --git a/app/scripts/design/directives/editor/guiSelect.js b/app/scripts/design/directives/editor/guiSelect.js index f3a921f4..dddf77e1 100644 --- a/app/scripts/design/directives/editor/guiSelect.js +++ b/app/scripts/design/directives/editor/guiSelect.js @@ -52,6 +52,7 @@ $scope.options = []; options = getOptions($scope.attribute.Options); + for (field in options) { if (options.hasOwnProperty(field)) { $scope.options.push({ @@ -64,13 +65,15 @@ } } - $scope.options.unshift({ - Desc: "", - Extra: null, - Id: "", - Image: "", - Name: "" - }); + if ($scope.attribute.Default === ""){ + $scope.options.unshift({ + Desc: "", + Extra: null, + Id: "", + Image: "", + Name: "" + }); + } }); } }; @@ -78,4 +81,4 @@ return designModule; }); -})(window.define); \ No newline at end of file +})(window.define); diff --git a/app/scripts/seo/controller/edit.js b/app/scripts/seo/controller/edit.js index 41d7abd5..f387b2d7 100644 --- a/app/scripts/seo/controller/edit.js +++ b/app/scripts/seo/controller/edit.js @@ -22,10 +22,9 @@ "title":{}, "meta_keywords":{}, "meta_description":{}, - "type":{"IsRequired": true, "Editors": "select", "Options": "page,category,product"}, - "rewrite":{"IsRequired": true, "Editors": "seo_selector", "Label": "Object"} + "type":{"IsRequired": true, "Editors": "select", "Options": "page,category,product", "Default": "page"}, + "rewrite":{"IsRequired": true, "Label": "Object"} }; - // not_editable, seo_selector, product_selector, "Options": "page,category,product" seoURL = $routeParams.id; @@ -121,10 +120,10 @@ * Event handler to save the seo data. * Creates new seo if ID in current seo is empty OR updates current seo if ID is set */ - $scope.save = function () { + $scope.save = function () { /*jshint maxcomplexity:9 */ $('[ng-click="save()"]').addClass('disabled').append('').siblings('.btn').addClass('disabled'); - var id, defer, saveSuccess, saveError, existingSeo, updateSuccess, updateError, regexp = /^\w*/; + var id, defer, saveSuccess, saveError, updateSuccess, updateError, regexp = /^\w*/; defer = $q.defer(); if (typeof $scope.seo !== "undefined") { @@ -179,56 +178,50 @@ $('[ng-click="save()"]').siblings('.btn').removeClass('disabled'); }; - if (!regexp.test($scope.seo.url)) { - $scope.message = $dashboardUtilsService.getMessage(null, 'warning', 'The field url invalid'); - updateError(); - } - /** - * Check for existing rewrite and drop a message for it - * if no so we creating new one and make save of it + * Check for valid rewrite and url if not, drop a message for it + * checking is rewrite don't replace existing */ - - if ($scope.seo.rewrite.length < 4) { - $scope.message = $dashboardUtilsService.getMessage(null, 'warning', 'Need to specify object to rewrite'); + if ($scope.seo.rewrite.length < 4 || $scope.seo.rewrite === "" || !regexp.test($scope.seo.url)) { + $scope.message = $dashboardUtilsService.getMessage(null, 'warning', 'Need to specify object to rewrite and valid url'); updateError(); - } - - if (typeof seoRewriteList[$scope.seo.rewrite] === "undefined") { - if (typeof id !== "undefined") { - $seoApiService.update({"itemID": id}, $scope.seo, updateSuccess, updateError); - } else { - $seoApiService.add($scope.seo, saveSuccess, saveError); + } else { + if (typeof seoRewriteList[$scope.seo.rewrite] === "undefined") { + if (typeof id !== "undefined") { + $seoApiService.update({"itemID": id}, $scope.seo, updateSuccess, updateError); + } else { + $seoApiService.add($scope.seo, saveSuccess, saveError); + } } - } - else { - if (id === seoRewriteList[$scope.seo.rewrite]) { - $seoApiService.update({"itemID": id}, $scope.seo, updateSuccess, updateError); + else { + if (id === seoRewriteList[$scope.seo.rewrite]) { + $seoApiService.update({"itemID": id}, $scope.seo, updateSuccess, updateError); + } + $scope.message = $dashboardUtilsService.getMessage(null, 'warning', 'Rewrite for this object is already exist'); + saveError(); } - $scope.message = $dashboardUtilsService.getMessage(null, 'warning', 'Rewrite for this object is already exist'); - saveError(); } return defer.promise; }; checkAttributePosition = function () { - if ($scope.attributes[seoRewriteNum]["Attribute"] = "rewrite") { + if ($scope.attributes[seoRewriteNum]["Attribute"] === "rewrite") { return seoRewriteNum; } else { for (var i=0; i < $scope.attributes.length; i+=1){ - if ($scope.attributes[i]["Attribute"] = "rewrite") { + if ($scope.attributes[i]["Attribute"] === "rewrite") { seoRewriteNum = i; return i; } } } - } + }; $scope.$watch(function () { return $scope.seo.type; - }, function (newVal, oldVal) { + }, function (newVal, oldVal) {/*jshint maxcomplexity:6 */ if (typeof $scope.attributes !== "undefined") { checkAttributePosition(); if (typeof newVal !== "undefined" && typeof oldVal !== "undefined"){ diff --git a/app/scripts/seo/controller/seoEdit.js b/app/scripts/seo/controller/seoEdit.js index f0bf7bbf..ff3e1295 100644 --- a/app/scripts/seo/controller/seoEdit.js +++ b/app/scripts/seo/controller/seoEdit.js @@ -85,7 +85,6 @@ function (response) { seo = response || null; for (var i = 0; i < seoFields.length; i += 1) { - $scope[itemName][seoUniqueFields[i]] = seo[seoFields[i]]; } isInitUrlRewrite = true; @@ -98,7 +97,6 @@ function (response) { seo = response || null; for (var i = 0; i < seoFields.length; i += 1) { - $scope[itemName][seoUniqueFields[i]] = seo[seoFields[i]]; } isInitUrlRewrite = true; diff --git a/app/themes/default/views/design/gui/editor/pageSelector.html b/app/themes/default/views/design/gui/editor/pageSelector.html index 68aa60cc..063aecdd 100644 --- a/app/themes/default/views/design/gui/editor/pageSelector.html +++ b/app/themes/default/views/design/gui/editor/pageSelector.html @@ -10,7 +10,7 @@