diff --git a/.travis.yml b/.travis.yml index 071bf4c1..3920c837 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,21 +1,9 @@ language: node_js node_js: -<<<<<<< HEAD - - "4.2.6" - -before_script: - - npm install - -script: - - npm run test - - npm run test-e2e - -======= - "5.6.0" before_install: - npm install -g bower gulp script: - - npm run test ->>>>>>> 281bb9e29d0e44c929457c755c5b59714e368ee2 + - npm run test \ No newline at end of file diff --git a/README.md b/README.md index cff5d7d4..75f85054 100644 --- a/README.md +++ b/README.md @@ -2,15 +2,12 @@ A seed project for custom Four51 Solutions built on AngularJS *** -<<<<<<< HEAD -======= ## Build Status ### development [![Build Status](https://travis-ci.org/ordercloud-api/angular-buyer.svg?branch=development)](https://travis-ci.org/ordercloud-api/angular-buyer) ### master [![Build Status](https://travis-ci.org/ordercloud-api/angular-buyer.svg?branch=master)](https://travis-ci.org/ordercloud-api/angular-buyer) ->>>>>>> 281bb9e29d0e44c929457c755c5b59714e368ee2 ## Get started Node.js is required for the following node package manager (npm) tasks. If you don't have node.js installed, you can download it [here](http://nodejs.org/). @@ -153,8 +150,4 @@ task, which runs `build` and then `compile`: ```sh $ gulp -<<<<<<< HEAD ``` -======= -``` ->>>>>>> 281bb9e29d0e44c929457c755c5b59714e368ee2 diff --git a/bower.json b/bower.json index e348e816..1b3e82bf 100644 --- a/bower.json +++ b/bower.json @@ -24,31 +24,6 @@ ], "dependencies": { "bootstrap": "^3.3.6", -<<<<<<< HEAD - "angular": "^1.5.7", - "angular-animate": "^1.5.7", - "angular-sanitize": "^1.5.7", - "angular-touch": "^1.5.7", - "angular-messages": "^1.5.7", - "angular-toastr": "^1.7.0", - "angular-ui-tree": "^2.16.0", - "angular-bootstrap": "^1.3.3", - "ordercloud-ng-sdk": "1.0.24", - "angular-auto-validate": "^1.19.5", - "font-awesome": "^4.6.3", - "angular-snap": "^1.8.5", - "angular-localforage": "^1.2.5", - "underscore": "^1.8.3", - "angular-ui-router": "^0.3.1", - "angular-busy": "^4.1.3" - }, - "devDependencies": { - "angular-mocks": "^1.5.7" - }, - "resolutions": { - "angular": "^1.5.7", - "angular-animate": "^1.5.7" -======= "angular": "^1.6.0", "angular-resource": "^1.6.0", "angular-animate": "^1.6.0", @@ -76,6 +51,5 @@ "angular-animate": "^1.6.0", "angular-resource": "^1.6.0", "angular-cookies": "^1.6.0" ->>>>>>> 281bb9e29d0e44c929457c755c5b59714e368ee2 } } diff --git a/gulp.config.js b/gulp.config.js index 78cb0584..49f24858 100644 --- a/gulp.config.js +++ b/gulp.config.js @@ -1,9 +1,5 @@ var source = './src/', assets = 'assets/', -<<<<<<< HEAD - components = './../Components/', -======= ->>>>>>> 281bb9e29d0e44c929457c755c5b59714e368ee2 build = './build/', bowerFiles = './bower_components/', npmFiles = './node_modules', @@ -39,29 +35,11 @@ module.exports = { '!' + source + '**/*.spec.js', '!' + source + '**/*.test.js' ], -<<<<<<< HEAD - components: { - dir: components, - scripts: [ - components + '**/*.js', - '!' + components + '**/*.spec.js', - '!' + components + '**/*.test.js' - ], - templates: components + '**/*.html', - styles: { - less: components + '**/*.less', - css: components + '**/*.css' - } - }, - appFiles: [ - build + '**/app.js', -======= appFiles: [ build + '**/app.module.js', build + '**/app.config.js', build + '**/app.run.js', build + '**/app.controller.js', ->>>>>>> 281bb9e29d0e44c929457c755c5b59714e368ee2 build + '**/*.js', build + '**/*.css', source + '**/*.css' @@ -90,11 +68,7 @@ module.exports = { function getConstants() { var result = {}; -<<<<<<< HEAD - var constants = JSON.parse(fs.readFileSync(source + 'app/app.config.json')); -======= var constants = JSON.parse(fs.readFileSync(source + 'app/app.constants.json')); ->>>>>>> 281bb9e29d0e44c929457c755c5b59714e368ee2 var environment = process.env.environment || constants.environment; switch (environment) { case 'local': diff --git a/gulp/build/app-config.js b/gulp/build/app-config.js index d9b7ca59..4d512a9d 100644 --- a/gulp/build/app-config.js +++ b/gulp/build/app-config.js @@ -4,20 +4,12 @@ var gulp = require('gulp'), ngConstant = require('gulp-ng-constant'); gulp.task('clean:app-config', function() { -<<<<<<< HEAD - return del(config.build + '**/app.config.js'); -======= return del(config.build + '**/app.constants.js'); ->>>>>>> 281bb9e29d0e44c929457c755c5b59714e368ee2 }); gulp.task('app-config', ['clean:app-config'], function() { return gulp -<<<<<<< HEAD - .src(config.src + '**/app.config.json') -======= .src(config.src + '**/app.constants.json') ->>>>>>> 281bb9e29d0e44c929457c755c5b59714e368ee2 .pipe(ngConstant(config.ngConstantSettings)) .pipe(gulp.dest(config.build)); }); diff --git a/gulp/build/inject.js b/gulp/build/inject.js index 63e77c71..2fd253dc 100644 --- a/gulp/build/inject.js +++ b/gulp/build/inject.js @@ -11,18 +11,10 @@ gulp.task('clean:inject', function() { gulp.task('inject', ['clean:inject', 'scripts', 'assets', 'app-config', 'bower-fonts', 'styles'], function() { var target = gulp.src(config.index), bowerFiles = gulp.src(mainBowerFiles({filter: ['**/*.js', '**/*.css']}), {read: false}), -<<<<<<< HEAD - appFiles = gulp.src([].concat(config.appFiles, config.components.styles.css), {read: false}); - - return target - .pipe(inject(bowerFiles, {name: 'bower'})) - .pipe(inject(appFiles)) -======= appFiles = gulp.src([].concat(config.appFiles), {read: false}); return target .pipe(inject(bowerFiles, {name: 'bower', ignorePath: config.bowerFiles.replace('.', ''), addPrefix: 'bower_files'})) .pipe(inject(appFiles, {ignorePath: config.build.replace('.', '')})) ->>>>>>> 281bb9e29d0e44c929457c755c5b59714e368ee2 .pipe(gulp.dest(config.build)); }); diff --git a/gulp/build/scripts.js b/gulp/build/scripts.js index fbe9ab23..6e94f74f 100644 --- a/gulp/build/scripts.js +++ b/gulp/build/scripts.js @@ -11,23 +11,14 @@ var gulp = require('gulp'), gulp.task('clean:scripts', function() { return del([ config.build + '**/*.js', -<<<<<<< HEAD - '!' + config.build + '**/app.config.js' -======= '!' + config.build + '**/app.constants.js' ->>>>>>> 281bb9e29d0e44c929457c755c5b59714e368ee2 ]); }); gulp.task('scripts', ['clean:scripts'], function() { return gulp .src([].concat( -<<<<<<< HEAD - config.scripts, - config.components.scripts -======= config.scripts ->>>>>>> 281bb9e29d0e44c929457c755c5b59714e368ee2 )) .pipe(cache(config.jsCache)) .pipe(ngAnnotate()) @@ -39,12 +30,7 @@ gulp.task('scripts', ['clean:scripts'], function() { gulp.task('rebuild-scripts', function() { return gulp .src([].concat( -<<<<<<< HEAD - config.scripts, - config.components.scripts -======= config.scripts ->>>>>>> 281bb9e29d0e44c929457c755c5b59714e368ee2 )) .pipe(cache('jsscripts')) .pipe(ngAnnotate()) diff --git a/gulp/build/serve-build.js b/gulp/build/serve-build.js index 8bfd567f..9259a520 100644 --- a/gulp/build/serve-build.js +++ b/gulp/build/serve-build.js @@ -1,31 +1,13 @@ var gulp = require('gulp'), config = require('../../gulp.config'), -<<<<<<< HEAD - browserSync = require('browser-sync'), -======= ->>>>>>> 281bb9e29d0e44c929457c755c5b59714e368ee2 argv = require('yargs') .count('debug') .alias('d', 'debug') .argv, -<<<<<<< HEAD - serve = require('../serve'), - unit = require('../test/unit'), - plato = require('../test/plato'); -======= serve = require('../serve'); ->>>>>>> 281bb9e29d0e44c929457c755c5b59714e368ee2 gulp.task('serve-build', ['inject'], function() { serve(true /*isDev*/); if (argv.debug) { -<<<<<<< HEAD - unit.RunUnitTests(); - unit.ServeTests(); - plato.GenerateReport(function () { - plato.OpenReport(); - }); -======= ->>>>>>> 281bb9e29d0e44c929457c755c5b59714e368ee2 } }); diff --git a/gulp/build/styles.js b/gulp/build/styles.js index 25bf547a..7aee7fc8 100644 --- a/gulp/build/styles.js +++ b/gulp/build/styles.js @@ -18,12 +18,7 @@ gulp.task('styles', ['clean:styles'], function() { return gulp .src([].concat( mainBowerFiles({filter: '**/*.less'}), -<<<<<<< HEAD - config.src + '**/*.less', - config.components.styles.less -======= './src/app/styles/main.less' ->>>>>>> 281bb9e29d0e44c929457c755c5b59714e368ee2 )) .pipe(sourcemaps.init()) .pipe(lessImport('oc-import.less')) diff --git a/gulp/compile/app-css.js b/gulp/compile/app-css.js index af8f7bf0..a2bce53e 100644 --- a/gulp/compile/app-css.js +++ b/gulp/compile/app-css.js @@ -21,13 +21,7 @@ gulp.task('app-css', ['clean:app-css'], function() { return gulp .src([].concat( mainBowerFiles({filter: ['**/*.css', '**/*.less']}), -<<<<<<< HEAD - config.components.styles.less, - config.components.styles.css, - config.styles -======= './src/app/styles/main.less' ->>>>>>> 281bb9e29d0e44c929457c755c5b59714e368ee2 )) .pipe(lessFilter) .pipe(lessImport('app.less')) diff --git a/gulp/compile/app-js.js b/gulp/compile/app-js.js index 1928427d..4aa476a8 100644 --- a/gulp/compile/app-js.js +++ b/gulp/compile/app-js.js @@ -24,15 +24,8 @@ gulp.task('app-js', ['clean:app-js'], function() { return gulp .src([].concat( config.scripts, -<<<<<<< HEAD - config.components.scripts, - config.templates, - config.components.templates, - config.src + '**/app.config.json' -======= config.templates, config.src + '**/app.constants.json' ->>>>>>> 281bb9e29d0e44c929457c755c5b59714e368ee2 )) .pipe(jsonFilter) .pipe(ngConstant(config.ngConstantSettings)) @@ -45,14 +38,10 @@ gulp.task('app-js', ['clean:app-js'], function() { .pipe(fileSort()) .pipe(wrapper(config.wrapper)) .pipe(ngAnnotate()) -<<<<<<< HEAD - .pipe(concat('app.js')) -======= .pipe(concat('app.module.js')) .pipe(concat('app.config.js')) .pipe(concat('app.run.js')) .pipe(concat('app.controller.js')) ->>>>>>> 281bb9e29d0e44c929457c755c5b59714e368ee2 .pipe(rev()) .pipe(uglify({mangle:false})) //turning off mangle to fix the compile error .pipe(gulp.dest(config.compile + 'js/')) diff --git a/gulp/serve.js b/gulp/serve.js index c31c88e1..91aee679 100644 --- a/gulp/serve.js +++ b/gulp/serve.js @@ -30,23 +30,6 @@ module.exports = function (isDev) { if (isDev) { gulp.watch([].concat( -<<<<<<< HEAD - config.src + '**/*.html', - config.components.templates - )) - .on('change', browserSync.reload); - gulp.watch([].concat( - config.scripts, - config.components.scripts - ), ['rebuild-scripts']) - .on('change', browserSync.reload); - gulp.watch([].concat( - config.styles, - config.components.styles.less, - config.components.styles.css - ), ['styles']); - gulp.watch(config.src + '**/app.config.json', ['app-config']) -======= config.src + '**/*.html' )) .on('change', browserSync.reload); @@ -58,7 +41,6 @@ config.styles ), ['styles']); gulp.watch(config.src + '**/app.constants.json', ['app-config']) ->>>>>>> 281bb9e29d0e44c929457c755c5b59714e368ee2 .on('change', browserSync.reload); } return nodemon ({ diff --git a/gulp/test/SpecRunner.html b/gulp/test/SpecRunner.html deleted file mode 100644 index 139e10cb..00000000 --- a/gulp/test/SpecRunner.html +++ /dev/null @@ -1,160 +0,0 @@ - - - - - Jasmine Spec Runner v2.4.1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/gulp/test/e2e.js b/gulp/test/e2e.js index 205ad21a..0be58f4b 100644 --- a/gulp/test/e2e.js +++ b/gulp/test/e2e.js @@ -1,66 +1,4 @@ var gulp = require('gulp'), -<<<<<<< HEAD - argv = require('yargs').argv, - selenium = require('selenium-standalone'), - config = require('../../gulp.config'), - browserSync = require('browser-sync'), - protractor = require("gulp-protractor").protractor; - -gulp.task('selenium', function (done) { - selenium.install({ - drivers: { - chrome: { - version: '2.9', - arch: process.arch, - baseURL: 'https://chromedriver.storage.googleapis.com' - } - }, - logger: function(message) { - console.log(message); - } - }, function (err) { - if (err) return done(err); - - selenium.start(function (err, child) { - if (err) return done(err); - selenium.child = child; - done(); - }); - }); -}); - -gulp.task('http', ['inject'], function(done) { - browserSync({ - logLevel: 'silent', - notify: false, - open: false, - port: 9000, - server: { - baseDir: [ - config.src + 'app/', - config.build, - config.root - ] - }, - ui: false - }, done); -}); - -gulp.task('test:e2e', ['http'/*, 'selenium'*/], function() { - return gulp - .src('./src/**/*.test.js') - .pipe(protractor({ - configFile: 'protractor.config.js', - args: [ - '--baseUrl', argv.baseUrl || 'http://localhost:9000', - '--suite', argv.suite || 'all' - ] - })) - .on('error', function(e) { throw e }) - .once('end', function() { - browserSync.exit(); - selenium.child.kill(); -======= browserSync = require('browser-sync').create(), argv = require('yargs').argv, config = require('../../gulp.config'), @@ -92,6 +30,5 @@ gulp.task('test:e2e', ['start-localhost'], function() { .on('end', browserSync.exit) .on('error', function (e) { throw e; ->>>>>>> 281bb9e29d0e44c929457c755c5b59714e368ee2 }); }); diff --git a/gulp/test/plato.js b/gulp/test/plato.js deleted file mode 100644 index 62817e5e..00000000 --- a/gulp/test/plato.js +++ /dev/null @@ -1,58 +0,0 @@ -var gulp = require('gulp'), - browserSync = require('browser-sync').create(), - config = require('../../gulp.config'), - plato = require('plato'); - -gulp.task('report', function(done) { - generateReport(done); -}); - -gulp.task('plato', ['report'], function() { - return openReport(); -}); - -function generateReport(done) { - var files = [ - config.build + '**/*.js', - '!' + config.build + '**/*.test.js', - '!' + config.build + '**/*.spec.js' - ]; - - var outputDir = './plato/dir'; - var options = { - title: 'OrderCloud Code Analysis' - }; - - var callback = function(report) { - plato.getOverviewReport(report); - if (done) { - done(); - } - }; - - plato.inspect(files, outputDir, options, callback); -} - -function openReport() { - browserSync.init({ - logLevel: 'silent', - notify: false, - open: true, - port: 4530, - files: [ - './plato/dir/files/**/*' - ], - server: { - index: 'index.html', - baseDir: [ - './plato/dir/' - ] - }, - ui: false - }); -} - -module.exports = { - GenerateReport: generateReport, - OpenReport: openReport -}; diff --git a/gulp/test/unit.js b/gulp/test/unit.js index d270d494..fb0a61c6 100644 --- a/gulp/test/unit.js +++ b/gulp/test/unit.js @@ -1,70 +1,4 @@ var gulp = require('gulp'), -<<<<<<< HEAD - inject = require('gulp-inject'), - browserSync = require('browser-sync').create(), - config = require('../../gulp.config'), - mainBowerFiles = require('main-bower-files'); - -gulp.task('test:unit', ['scripts', 'app-config'], function() { - runUnitTests(); - serveTests(); -}); - -function runUnitTests() { - var target = gulp.src('./gulp/test/SpecRunner.html'), - bowerFiles = gulp.src(mainBowerFiles({includeDev: true, filter: '**/*.js'}), {read: false}), - appFiles = gulp.src([].concat( - config.build + '**/app.js', - config.build + '**/*.js' - ), {read: false}), - specFiles = gulp.src([].concat( - config.src + '**/*.spec.js', - config.components.dir + '**/*.spec.js' - ), {read: false}), - jasmineFiles = gulp.src([ - './node_modules/jasmine-core/lib/jasmine-core/jasmine.css', - './node_modules/jasmine-core/lib/jasmine-core/jasmine.js', - './node_modules/jasmine-core/lib/jasmine-core/jasmine-html.js', - './node_modules/jasmine-core/lib/jasmine-core/boot.js' - ], {read:false}); - - return target - .pipe(inject(jasmineFiles, {name: 'jasmine'})) - .pipe(inject(bowerFiles, {name: 'bower'})) - .pipe(inject(appFiles)) - .pipe(inject(specFiles, {name: 'spec'})) - .pipe(gulp.dest('./gulp/test/')); -} - -function serveTests() { - console.log(config.root + config.src.replace('.', '') + 'app/'); - browserSync.init({ - logLevel: 'silent', - notify: false, - open: true, - port: 4520, - files: [ - config.build + '**/*.js' - ], - server: { - index: 'SpecRunner.html', - baseDir: [ - config.root, - config.components.dir + '/../', - __dirname, - config.root + config.src.replace('.', '') + 'app/' - ] - }, - ui: false - }); -} - -module.exports = { - RunUnitTests: runUnitTests, - ServeTests: serveTests -}; - -======= config = require('../../gulp.config'), Server = require('karma').Server; @@ -73,5 +7,4 @@ gulp.task('test:unit', ['scripts', 'app-config'], function(done) { configFile: config.root + '/karma.conf.js', singleRun: true }, done).start(); -}); ->>>>>>> 281bb9e29d0e44c929457c755c5b59714e368ee2 +}); \ No newline at end of file diff --git a/lib/jasmine_examples/Player.js b/lib/jasmine_examples/Player.js deleted file mode 100644 index fe95f894..00000000 --- a/lib/jasmine_examples/Player.js +++ /dev/null @@ -1,24 +0,0 @@ -function Player() { -} -Player.prototype.play = function(song) { - this.currentlyPlayingSong = song; - this.isPlaying = true; -}; - -Player.prototype.pause = function() { - this.isPlaying = false; -}; - -Player.prototype.resume = function() { - if (this.isPlaying) { - throw new Error("song is already playing"); - } - - this.isPlaying = true; -}; - -Player.prototype.makeFavorite = function() { - this.currentlyPlayingSong.persistFavoriteStatus(true); -}; - -module.exports = Player; diff --git a/lib/jasmine_examples/Song.js b/lib/jasmine_examples/Song.js deleted file mode 100644 index 3415bb82..00000000 --- a/lib/jasmine_examples/Song.js +++ /dev/null @@ -1,9 +0,0 @@ -function Song() { -} - -Song.prototype.persistFavoriteStatus = function(value) { - // something complicated - throw new Error("not yet implemented"); -}; - -module.exports = Song; diff --git a/package.json b/package.json index e178519f..4613a776 100644 --- a/package.json +++ b/package.json @@ -2,11 +2,7 @@ "name": "ordercloud-seed", "version": "1.0.0", "description": "A seed project for custom Four51 Solutions built on AngularJS", -<<<<<<< HEAD - "main": "app.js", -======= "main": "app.module.js", ->>>>>>> 281bb9e29d0e44c929457c755c5b59714e368ee2 "engines": { "node": "5.6.0", "npm": "3.6.0" @@ -16,19 +12,11 @@ "bower_components" ], "scripts": { -<<<<<<< HEAD - "postinstall": "bower install && npm run build-all", - "start": "node server.js", - "build-all": "gulp inject index", - "test": "gulp test:unit", - "test-e2e": "gulp test:e2e" -======= "heroku-prebuild": "npm install bower gulp --save", "postinstall": "bower install && npm run build-all", "start": "node server.js", "build-all": "gulp inject index --gulpfile ./heroku.gulpfile.js", "test": "gulp test:unit" ->>>>>>> 281bb9e29d0e44c929457c755c5b59714e368ee2 }, "repository": { "type": "git", @@ -48,49 +36,6 @@ }, "homepage": "https://github.com/Four51/OrderCloud-Seed-AngularJS#readme", "dependencies": { -<<<<<<< HEAD - "bower": "1.7.7", - "browser-sync": "^2.11.1", - "del": "^2.2.0", - "express": "^4.13.4", - "fs": "0.0.2", - "gulp": "^3.9.0", - "gulp-angular-filesort": "^1.1.1", - "gulp-angular-templatecache": "^1.8.0", - "gulp-autoprefixer": "^3.1.0", - "gulp-beautify": "^2.0.0", - "gulp-cached": "^1.1.0", - "gulp-concat": "^2.6.0", - "gulp-csso": "^1.0.1", - "gulp-filter": "^3.0.1", - "gulp-flatten": "^0.2.0", - "gulp-htmlmin": "^1.3.0", - "gulp-imagemin": "^2.4.0", - "gulp-inject": "^3.0.0", - "gulp-less": "^3.0.5", - "gulp-less-import": "^1.0.0", - "gulp-ng-annotate": "^1.1.0", - "gulp-ng-constant": "^1.1.0", - "gulp-nodemon": "^2.0.6", - "gulp-open": "^1.0.0", - "gulp-protractor": "^2.1.0", - "gulp-rev": "^6.0.1", - "gulp-sourcemaps": "^1.6.0", - "gulp-uglify": "^1.5.1", - "gulp-wrapper": "^1.0.0", - "jasmine": "^2.4.1", - "jasmine-node": "^1.14.5", - "main-bower-files": "^2.11.1", - "plato": "^1.5.0", - "protractor": "^3.1.1", - "require-dir": "^0.3.0", - "selenium-standalone": "^4.9.1", - "selenium-webdriver": "^2.52.0", - "yargs": "^3.32.0" - }, - "devDependencies": {} -} -======= "browser-sync": "2.11.1", "del": "2.2.0", "express": "4.13.4", @@ -130,5 +75,4 @@ "karma-ng-html2js-preprocessor": "1.0.0", "karma-phantomjs-launcher": "1.0.2" } -} ->>>>>>> 281bb9e29d0e44c929457c755c5b59714e368ee2 +} \ No newline at end of file diff --git a/protractor.config.js b/protractor.config.js deleted file mode 100644 index 8bc7f712..00000000 --- a/protractor.config.js +++ /dev/null @@ -1,56 +0,0 @@ -// An example configuration file -exports.config = { - // The address of a running selenium server. - seleniumAddress: 'http://localhost:4444/wd/hub', - - // Capabilities to be passed to the webdriver instance. - capabilities: { - browserName: 'chrome' - }, - - // Spec patterns are relative to the configuration file location passed - // to protractor (in this example conf.js). - // They may include glob patterns. - specs: ['./src/**/*.test.js'], - - suites: { - all: './src/**/*.test.js', - buyer: [ - './src/cart/**/*.test.js', - './src/catalog/**/*.test.js', - './src/checkout/**/*.test.js', - './src/orderHistory/**/*.test.js' - ], - admin: [ - './src/addresses/**/*.test.js', - './src/adminUsers/**/*.test.js', - './src/approvalRules/**/*.test.js', - './src/buyers/**/*.test.js', - './src/categories/**/*.test.js', - './src/costCenters/**/*.test.js', - './src/coupons/**/*.test.js', - './src/creditCards/**/*.test.js', - './src/giftCards/**/*.test.js', - './src/orders/**/*.test.js', - './src/priceSchedules/**/*.test.js', - './src/products/**/*.test.js', - './src/shipments/**/*.test.js', - './src/specs/**/*.test.js', - './src/spendingAccounts/**/*.test.js', - './src/userGroups/**/*.test.js', - './src/users/**/*.test.js' - ], - common: [ - './src/common/**/*.test.js', - './src/account/**/*.test.js', - './src/base/**/*.test.js', - './src/home/**/*.test.js', - './src/login/**/*.test.js' - ] - }, - - // Options to be passed to Jasmine-node. - jasmineNodeOpts: { - showColors: true // Use colors in the command line report. - } -}; \ No newline at end of file diff --git a/server.js b/server.js index 2abd01a9..4bcaacb0 100644 --- a/server.js +++ b/server.js @@ -16,19 +16,12 @@ switch(env) { break; default: console.log('*** DEV ***'); -<<<<<<< HEAD - app.use(express.static(config.root + config.build.replace('.', ''))); - app.use(express.static(config.root + config.src.replace('.', '') + 'app/')); - app.use(express.static(config.root)); - app.use(express.static(config.root + config.components.dir)); -======= // Host bower_files app.use('/bower_files', express.static(config.root + config.bowerFiles.replace('.', ''))); // Host unminfied javascript files app.use(express.static(config.root + config.build.replace('.', ''))); // Host unchanged html files app.use(express.static(config.root + config.src.replace('.', '') + 'app/')); ->>>>>>> 281bb9e29d0e44c929457c755c5b59714e368ee2 app.get('/*', function(req, res) { res.sendFile(config.root + config.build.replace('.', '') + 'index.html'); }); diff --git a/spec/helpers/jasmine_examples/SpecHelper.js b/spec/helpers/jasmine_examples/SpecHelper.js deleted file mode 100644 index 578b3e86..00000000 --- a/spec/helpers/jasmine_examples/SpecHelper.js +++ /dev/null @@ -1,15 +0,0 @@ -beforeEach(function () { - jasmine.addMatchers({ - toBePlaying: function () { - return { - compare: function (actual, expected) { - var player = actual; - - return { - pass: player.currentlyPlayingSong === expected && player.isPlaying - } - } - }; - } - }); -}); diff --git a/spec/jasmine_examples/PlayerSpec.js b/spec/jasmine_examples/PlayerSpec.js deleted file mode 100644 index 80f149e3..00000000 --- a/spec/jasmine_examples/PlayerSpec.js +++ /dev/null @@ -1,60 +0,0 @@ -describe("Player", function() { - var Player = require('../../lib/jasmine_examples/Player'); - var Song = require('../../lib/jasmine_examples/Song'); - var player; - var song; - - beforeEach(function() { - player = new Player(); - song = new Song(); - }); - - it("should be able to play a Song", function() { - player.play(song); - expect(player.currentlyPlayingSong).toEqual(song); - - //demonstrates use of custom matcher - expect(player).toBePlaying(song); - }); - - describe("when song has been paused", function() { - beforeEach(function() { - player.play(song); - player.pause(); - }); - - it("should indicate that the song is currently paused", function() { - expect(player.isPlaying).toBeFalsy(); - - // demonstrates use of 'not' with a custom matcher - expect(player).not.toBePlaying(song); - }); - - it("should be possible to resume", function() { - player.resume(); - expect(player.isPlaying).toBeTruthy(); - expect(player.currentlyPlayingSong).toEqual(song); - }); - }); - - // demonstrates use of spies to intercept and test method calls - it("tells the current song if the user has made it a favorite", function() { - spyOn(song, 'persistFavoriteStatus'); - - player.play(song); - player.makeFavorite(); - - expect(song.persistFavoriteStatus).toHaveBeenCalledWith(true); - }); - - //demonstrates use of expected exceptions - describe("#resume", function() { - it("should throw an exception if song is already playing", function() { - player.play(song); - - expect(function() { - player.resume(); - }).toThrowError("song is already playing"); - }); - }); -}); diff --git a/spec/support/jasmine.json b/spec/support/jasmine.json deleted file mode 100644 index 3ea31669..00000000 --- a/spec/support/jasmine.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "spec_dir": "spec", - "spec_files": [ - "**/*[sS]pec.js" - ], - "helpers": [ - "helpers/**/*.js" - ], - "stopSpecOnExpectationFailure": false, - "random": false -} diff --git a/src/README.md b/src/README.md index ae4adef7..b5379c90 100644 --- a/src/README.md +++ b/src/README.md @@ -8,14 +8,6 @@ tests of such code. ``` src/ |- app/ -<<<<<<< HEAD - | |- home/ - | |- app.js - | |- app.spec.js - | |- global.less - | |- variables.less - |- assets/ -======= | |- common/ | |- styles/ | |- app.config.js @@ -26,7 +18,6 @@ src/ | |- app.spec.js |- assets/ | |- images/ ->>>>>>> 281bb9e29d0e44c929457c755c5b59714e368ee2 |- index.html ``` diff --git a/src/app/README.md b/src/app/README.md index 6ec439ab..e889cd4f 100644 --- a/src/app/README.md +++ b/src/app/README.md @@ -5,26 +5,16 @@ ``` src/ |- app/ -<<<<<<< HEAD - | |- home/ - | |- about/ - | |- app.js -======= | |- app.config.js | |- app.constants.json | |- app.controller.js | |- app.module.js | |- app.run.js ->>>>>>> 281bb9e29d0e44c929457c755c5b59714e368ee2 | |- app.spec.js ``` The `src/app` directory contains all code specific to this application. Apart -<<<<<<< HEAD -from `app.js` and its accompanying tests (discussed below), this directory is -======= from `app.*.js` and its accompanying tests (discussed below), this directory is ->>>>>>> 281bb9e29d0e44c929457c755c5b59714e368ee2 filled with subdirectories corresponding to high-level sections of the application, often corresponding to top-level routes. Each directory can have as many subdirectories as it needs, and the build system will understand what to @@ -34,15 +24,9 @@ route `/products`, though this is in no way enforced. Products may then have subdirectories for "create", "view", "search", etc. The "view" submodule may then define a route of `/products/:id`, ad infinitum. -<<<<<<< HEAD -## `app.js` - -This is our main app configuration file. It kickstarts the whole process by -======= ## `app.module.js` This is our main app file. It kickstarts the whole process by ->>>>>>> 281bb9e29d0e44c929457c755c5b59714e368ee2 requiring all the modules that we need. By default, the OrderCloud AngularJS Seed includes a few useful modules written @@ -68,17 +52,11 @@ angular.module('orderCloud', [ ]) ``` -<<<<<<< HEAD -With app modules broken down in this way, all routing is performed by the -submodules we include, as that is where our app's functionality is really -defined. So all we need to do in `app.js` is specify a default route to follow, -======= ## `app.config.js` With app modules broken down in this way, all routing is performed by the submodules we include, as that is where our app's functionality is really defined. So all we need to do in `app.config.js` is specify a default route to follow, ->>>>>>> 281bb9e29d0e44c929457c755c5b59714e368ee2 which route of course is defined in a submodule. In this case, our `home` module is where we want to start, which has a defined route for `/home` in `src/app/home/home.js`. @@ -89,11 +67,8 @@ is where we want to start, which has a defined route for `/home` in }) ``` -<<<<<<< HEAD -======= ## `app.run.js` ->>>>>>> 281bb9e29d0e44c929457c755c5b59714e368ee2 Use the main applications run method to execute any code after services have been instantiated. @@ -102,11 +77,8 @@ have been instantiated. }) ``` -<<<<<<< HEAD -======= ## `app.controller.js` ->>>>>>> 281bb9e29d0e44c929457c755c5b59714e368ee2 And then we define our main application controller. This is a good place for logic not specific to the template or route, such as menu logic or page title wiring. @@ -124,20 +96,11 @@ not specific to the template or route, such as menu logic or page title wiring. One of the design philosophies of `OrderCloud-Seed-AngularJS` is that tests should exist alongside the code they test and that the build system should be smart enough to -<<<<<<< HEAD -know the difference and react accordingly. As such, the unit test for `app.js` -======= know the difference and react accordingly. As such, the unit test for `app.*.js` ->>>>>>> 281bb9e29d0e44c929457c755c5b59714e368ee2 is `app.spec.js`, though it is quite minimal. ### Global application styles -<<<<<<< HEAD -By default, we include [Ambient](http://ionlyseespots.github.io/ambient-design/index.html) which is an internally developed design framework that makes use of HTML5 elements & CSS3 attributes to layout the document outline. - -======= ->>>>>>> 281bb9e29d0e44c929457c755c5b59714e368ee2 Within the `src/app/` directory we included a `global.less` and `variables.less` file. These should be utilized for application wide LESS variables and mixins. Each component within `src/app` will have a corresponding `less/` directory with a similar structure. diff --git a/src/app/account/account.js b/src/app/account/account.js index ac6bebfd..eb3e7c6f 100644 --- a/src/app/account/account.js +++ b/src/app/account/account.js @@ -1,17 +1,10 @@ angular.module('orderCloud') .config(AccountConfig) -<<<<<<< HEAD - .controller('AccountCtrl', AccountController) - .factory('AccountService', AccountService) - .controller('ConfirmPasswordCtrl', ConfirmPasswordController) - .controller('ChangePasswordCtrl', ChangePasswordController) -======= .controller('AccountInfoCtrl', AccountInfoController) .controller('AccountEditModalCtrl', AccountEditModalController) .factory('AccountService', AccountService) .controller('ChangePasswordModalCtrl', ChangePasswordModalController) .controller('ConfirmPasswordCtrl', ConfirmPasswordController) ->>>>>>> 281bb9e29d0e44c929457c755c5b59714e368ee2 ; function AccountConfig($stateProvider) { @@ -20,31 +13,16 @@ function AccountConfig($stateProvider) { parent: 'base', url: '/account', templateUrl: 'account/templates/account.tpl.html', -<<<<<<< HEAD - controller: 'AccountCtrl', - controllerAs: 'account' - }) - .state('account.changePassword', { - url: '/changepassword', - templateUrl: 'account/templates/changePassword.tpl.html', - controller: 'ChangePasswordCtrl', - controllerAs: 'changePassword' -======= controller: 'AccountInfoCtrl', controllerAs: 'accountInfo', data: { pageTitle: "Account" } ->>>>>>> 281bb9e29d0e44c929457c755c5b59714e368ee2 }) ; } -<<<<<<< HEAD -function AccountService($q, $uibModal, OrderCloud) { -======= function AccountService($q, $uibModal, OrderCloud, toastr) { ->>>>>>> 281bb9e29d0e44c929457c755c5b59714e368ee2 var service = { Update: _update, ChangePassword: _changePassword @@ -68,27 +46,17 @@ function AccountService($q, $uibModal, OrderCloud, toastr) { templateUrl: 'account/templates/confirmPassword.modal.tpl.html', controller: 'ConfirmPasswordCtrl', controllerAs: 'confirmPassword', -<<<<<<< HEAD - size: 'sm' -======= size: 'md' ->>>>>>> 281bb9e29d0e44c929457c755c5b59714e368ee2 }).result.then(function(password) { var checkPasswordCredentials = { Username: currentProfile.Username, Password: password }; -<<<<<<< HEAD - OrderCloud.Auth.GetToken(checkPasswordCredentials) - .then(function() { - updateUser(); -======= OrderCloud.Auth.GetToken(checkPasswordCredentials) .then(function() { updateUser(); toastr.success('Account changes were saved.', 'Success!'); ->>>>>>> 281bb9e29d0e44c929457c755c5b59714e368ee2 }) .catch(function(ex) { deferred.reject(ex); @@ -130,11 +98,6 @@ function AccountService($q, $uibModal, OrderCloud, toastr) { return service; } -<<<<<<< HEAD -function AccountController($exceptionHandler, toastr, AccountService, CurrentUser) { - var vm = this; - vm.profile = angular.copy(CurrentUser); -======= function AccountInfoController($uibModal, CurrentUser){ var vm = this; vm.profile = angular.copy(CurrentUser); @@ -179,7 +142,6 @@ function AccountInfoController($uibModal, CurrentUser){ function AccountEditModalController($uibModalInstance, $exceptionHandler, AccountService, CurrentUser, Profile){ var vm = this; vm.profile = Profile; ->>>>>>> 281bb9e29d0e44c929457c755c5b59714e368ee2 var currentProfile = CurrentUser; vm.update = function() { @@ -187,19 +149,11 @@ function AccountEditModalController($uibModalInstance, $exceptionHandler, Accoun .then(function(data) { vm.profile = angular.copy(data); currentProfile = data; -<<<<<<< HEAD - toastr.success('Account changes were saved.', 'Success!'); - }) - .catch(function(ex) { - vm.profile = currentProfile; - $exceptionHandler(ex) -======= vm.submit(); }) .catch(function(ex) { vm.profile = currentProfile; $exceptionHandler(ex); ->>>>>>> 281bb9e29d0e44c929457c755c5b59714e368ee2 }); }; @@ -207,19 +161,9 @@ function AccountEditModalController($uibModalInstance, $exceptionHandler, Accoun vm.profile = currentProfile; form.$setPristine(true); }; -<<<<<<< HEAD -} - -function ConfirmPasswordController($uibModalInstance) { - var vm = this; - - vm.submit = function() { - $uibModalInstance.close(vm.password); -======= vm.submit = function() { $uibModalInstance.close(); ->>>>>>> 281bb9e29d0e44c929457c755c5b59714e368ee2 }; vm.cancel = function() { @@ -227,11 +171,7 @@ function ConfirmPasswordController($uibModalInstance) { }; } -<<<<<<< HEAD -function ChangePasswordController($state, $exceptionHandler, toastr, AccountService, CurrentUser) { -======= function ChangePasswordModalController(toastr, $state, $exceptionHandler, AccountService, $uibModalInstance, CurrentUser){ ->>>>>>> 281bb9e29d0e44c929457c755c5b59714e368ee2 var vm = this; vm.currentUser = CurrentUser; @@ -242,15 +182,6 @@ function ChangePasswordModalController(toastr, $state, $exceptionHandler, Accoun vm.currentUser.CurrentPassword = null; vm.currentUser.NewPassword = null; vm.currentUser.ConfirmPassword = null; -<<<<<<< HEAD - $state.go('account'); - }) - .catch(function(ex) { - $exceptionHandler(ex) - }); - }; -} -======= vm.submit(); $state.go('account.information'); }) @@ -278,5 +209,4 @@ function ConfirmPasswordController($uibModalInstance) { vm.cancel = function() { $uibModalInstance.dismiss('cancel'); }; -} ->>>>>>> 281bb9e29d0e44c929457c755c5b59714e368ee2 +} \ No newline at end of file diff --git a/src/app/account/less/account.less b/src/app/account/less/account.less deleted file mode 100644 index 44abe672..00000000 --- a/src/app/account/less/account.less +++ /dev/null @@ -1,3 +0,0 @@ -#COMPONENT_Account { - background-color:@component-account-bg; -} \ No newline at end of file diff --git a/src/app/account/less/variables.less b/src/app/account/less/variables.less deleted file mode 100644 index 3d0d486a..00000000 --- a/src/app/account/less/variables.less +++ /dev/null @@ -1 +0,0 @@ -@component-account-bg: @global-component-bg; \ No newline at end of file diff --git a/src/app/account/templates/account.tpl.html b/src/app/account/templates/account.tpl.html index cbcad4c1..3b60d838 100644 --- a/src/app/account/templates/account.tpl.html +++ b/src/app/account/templates/account.tpl.html @@ -1,39 +1,3 @@ -<<<<<<< HEAD -
- -
-
-
- - -
-
- - -
-
-
- - -
-
- - -
-
- - -
-
- - -
- - - -
-
-=======
- ->>>>>>> 281bb9e29d0e44c929457c755c5b59714e368ee2 + \ No newline at end of file diff --git a/src/app/account/templates/changePassword.tpl.html b/src/app/account/templates/changePassword.tpl.html deleted file mode 100644 index aaef31c5..00000000 --- a/src/app/account/templates/changePassword.tpl.html +++ /dev/null @@ -1,17 +0,0 @@ - -
-
- - -
-
- - -
-
- - -
- - -
\ No newline at end of file diff --git a/src/app/account/templates/confirmPassword.modal.tpl.html b/src/app/account/templates/confirmPassword.modal.tpl.html index 9a671667..a45e971f 100644 --- a/src/app/account/templates/confirmPassword.modal.tpl.html +++ b/src/app/account/templates/confirmPassword.modal.tpl.html @@ -1,15 +1,3 @@ -<<<<<<< HEAD - -=======
->>>>>>> 281bb9e29d0e44c929457c755c5b59714e368ee2 diff --git a/src/app/account/tests/account.spec.js b/src/app/account/tests/account.spec.js index 102c4c76..6a83fc01 100644 --- a/src/app/account/tests/account.spec.js +++ b/src/app/account/tests/account.spec.js @@ -2,12 +2,8 @@ describe('Component: Account', function() { var scope, q, account, -<<<<<<< HEAD - accountFactory; -======= accountFactory, uibModalInstance; ->>>>>>> 281bb9e29d0e44c929457c755c5b59714e368ee2 beforeEach(module('orderCloud')); beforeEach(module('orderCloud.sdk')); beforeEach(inject(function($q, $rootScope, AccountService) { @@ -24,10 +20,7 @@ describe('Component: Account', function() { Active: true }; accountFactory = AccountService; -<<<<<<< HEAD -======= uibModalInstance = jasmine.createSpyObj('modalInstance', ['close', 'dismiss', 'result.then']); ->>>>>>> 281bb9e29d0e44c929457c755c5b59714e368ee2 })); describe('Factory: AccountService', function() { @@ -81,91 +74,6 @@ describe('Component: Account', function() { }); }); -<<<<<<< HEAD - describe('Controller: AccountCtrl', function() { - var accountCtrl, currentProfile; - beforeEach(inject(function($state, $controller) { - accountCtrl = $controller('AccountCtrl', { - $scope: scope, - CurrentUser: {} - }); - spyOn($state, 'go').and.returnValue(true); - })); - - describe('update', function() { - beforeEach(inject(function() { - accountCtrl.profile = account; - currentProfile = {}; - var defer = q.defer(); - defer.resolve(account); - spyOn(accountFactory, 'Update').and.returnValue(defer.promise); - accountCtrl.update(); - })); - it ('should call the Accounts Update method', inject(function(AccountService) { - expect(accountFactory.Update).toHaveBeenCalledWith(currentProfile, account); - })); - }); - - //describe('resetForm', function() { - // beforeEach(inject(function(form) { - // accountCtrl.profile = account; - // spyOn(form, '$setPristine').and.returnValue(null); - // accountCtrl.resetForm(form); - // })); - // it ('should set accountCtrl.profile to currentProfile', inject(function() { - // expect(accountCtrl.profile).toEqual({}); - // })); - // it ('should call form.$setPristine method', inject(function(form) { - // expect(form.$setPristine).toHaveBeenCalledWith(true); - // })); - //}); - }); - - //describe('Controller: ConfirmPasswordCtrl', function() { - // var confirmPasswordCtrl; - // beforeEach(inject(function($state, $controller) { - // confirmPasswordCtrl = $controller('ConfirmPasswordCtrl', { - // $scope: scope - // }); - // spyOn($state, 'go').and.returnValue(true); - // })); - // - // describe('submit', function() { - // beforeEach(inject(function($uibModalInstance) { - // confirmPasswordCtrl.password = account.password; - // var defer = q.defer(); - // defer.resolve(account); - // spyOn($uibModalInstance, 'close').and.returnValue(defer.promise); - // confirmPasswordCtrl.submit(); - // scope.$digest(); - // })); - // it ('should call the $uibModalInstance close method', inject(function($uibModalInstance) { - // expect($uibModalInstance.close).toHaveBeenCalledWith(confirmPasswordCtrl.password); - // })); - // }); - // - // describe('cancel', function() { - // beforeEach(inject(function($uibModalInstance) { - // confirmPasswordCtrl.password = account.password; - // var defer = q.defer(); - // defer.resolve(account); - // spyOn($uibModalInstance, 'dismiss').and.returnValue(defer.promise); - // confirmPasswordCtrl.cancel(); - // scope.$digest(); - // })); - // it ('should call the $uibModalInstance close method', inject(function($uibModalInstance) { - // expect($uibModalInstance.dismiss).toHaveBeenCalledWith('cancel'); - // })); - // }); - //}); - - describe('Controller: ChangePasswordCtrl', function () { - var changePasswordCtrl; - beforeEach(inject(function($state, $controller) { - changePasswordCtrl = $controller('ChangePasswordCtrl', { - $scope: scope, - CurrentUser: {} -======= describe('Controller: AccountInfoCtrl', function() { var accountInfoCtrl, uibModal, @@ -265,25 +173,11 @@ describe('Component: Account', function() { $scope: scope, CurrentUser: {}, $uibModalInstance: uibModalInstance ->>>>>>> 281bb9e29d0e44c929457c755c5b59714e368ee2 }); spyOn($state, 'go').and.returnValue(true); })); describe('changePassword', function() { beforeEach(inject(function() { -<<<<<<< HEAD - changePasswordCtrl.currentUser = account; - var defer = q.defer(); - defer.resolve(account); - spyOn(accountFactory, 'ChangePassword').and.returnValue(defer.promise); - changePasswordCtrl.changePassword(); - })); - it ('should call the Accounts ChangePassword method', inject(function(AccountService) { - expect(accountFactory.ChangePassword).toHaveBeenCalledWith(changePasswordCtrl.currentUser); - })); - }); - -======= changePasswordModalCtrl.currentUser = account; var defer = q.defer(); defer.resolve(account); @@ -327,7 +221,6 @@ describe('Component: Account', function() { expect(uibModalInstance.dismiss).toHaveBeenCalled(); }); }); ->>>>>>> 281bb9e29d0e44c929457c755c5b59714e368ee2 }); }); diff --git a/src/app/app.config.json b/src/app/app.config.json deleted file mode 100644 index 5bd770a4..00000000 --- a/src/app/app.config.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "appname": "XXXXX", - "scope": "BuyerReader", - "clientid": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXX", - "buyerid": "XXXXX", - "catalogid": "XXXXX", - "environment": "prod", - "anonymous": false, - "base": { - "left":true, - "right":false, - "top":true, - "bottom":false - } -} \ No newline at end of file diff --git a/src/app/app.js b/src/app/app.js deleted file mode 100644 index 0e711451..00000000 --- a/src/app/app.js +++ /dev/null @@ -1,136 +0,0 @@ -angular.module('orderCloud', [ - 'ngSanitize', - 'ngAnimate', - 'ngMessages', - 'ngTouch', - 'snap', - 'ui.tree', - 'ui.router', - 'ui.bootstrap', - 'orderCloud.sdk', - 'LocalForageModule', - 'toastr', - 'cgBusy', - 'jcs-autoValidate', - 'ordercloud-infinite-scroll', - 'ordercloud-buyer-select', - 'ordercloud-search', - 'ordercloud-assignment-helpers', - 'ordercloud-paging-helpers', - 'ordercloud-auto-id', - 'ordercloud-current-order', - 'ordercloud-address', - 'ordercloud-lineitems', - 'ordercloud-geography' - ]) - .run(SetBuyerID) - .run(SetCatalogID) - .config(Routing) - .config(ErrorHandling) - .config(Interceptor) - .controller('AppCtrl', AppCtrl) - .config(DatePickerConfig) -; - -function DatePickerConfig(uibDatepickerConfig, uibDatepickerPopupConfig){ - uibDatepickerConfig.showWeeks = false; - uibDatepickerPopupConfig.showButtonBar = false; -} - -function SetBuyerID(OrderCloud, buyerid) { - OrderCloud.BuyerID.Get() == buyerid ? angular.noop() : OrderCloud.BuyerID.Set(buyerid); -} - -function SetCatalogID(OrderCloud, catalogid){ - catalogid ? OrderCloud.CatalogID.Set(catalogid) : OrderCloud.CatalogID.Set(OrderCloud.BuyerID.Get()); -} - -function Routing($urlRouterProvider, $urlMatcherFactoryProvider, $locationProvider) { - $urlMatcherFactoryProvider.strictMode(false); - $urlRouterProvider.otherwise('/home'); - $locationProvider.html5Mode(true); -} - -function ErrorHandling($provide) { - $provide.decorator('$exceptionHandler', handler); - - function handler($delegate, $injector) { - return function(ex, cause) { - $delegate(ex, cause); - $injector.get('toastr').error(ex.data ? (ex.data.error || (ex.data.Errors ? ex.data.Errors[0].Message : ex.data)) : ex.message, 'Error'); - }; - } -} - -function AppCtrl($q, $rootScope, $state, $ocMedia, toastr, LoginService, appname, anonymous) { - var vm = this; - vm.name = appname; - vm.title = appname; - vm.$state = $state; - vm.$ocMedia = $ocMedia; - vm.contentLoading = undefined; - - function cleanLoadingIndicators() { - if (vm.contentLoading && vm.contentLoading.promise && !vm.contentLoading.promise.$cgBusyFulfilled) vm.contentLoading.resolve(); //resolve leftover loading promises - } - - //Detect if the app was loaded on a touch device with relatively good certainty - //http://stackoverflow.com/a/6262682 - vm.isTouchDevice = (function() { - var el = document.createElement('div'); - el.setAttribute('ongesturestart', 'return;'); // or try "ontouchstart" - return typeof el.ongesturestart === "function"; - })(); - - vm.logout = function() { - LoginService.Logout(); - }; - - $rootScope.$on('$stateChangeStart', function(e, toState) { - cleanLoadingIndicators(); - var defer = $q.defer(); - //defer.delay = 200; - defer.wrapperClass = 'indicator-container'; - (toState.data && toState.data.loadingMessage) ? defer.message = toState.data.loadingMessage : defer.message = null; - defer.templateUrl = 'common/loading-indicators/templates/view.loading.tpl.html'; - vm.contentLoading = defer; - }); - - $rootScope.$on('$stateChangeSuccess', function(e, toState) { - cleanLoadingIndicators(); - if (toState.data && toState.data.componentName) { - vm.title = toState.data.componentName + ' | ' + appname; - } else { - vm.title = appname; - } - }); - - $rootScope.$on('$stateChangeError', function(event, toState, toParams, fromState, fromParams, error) { - cleanLoadingIndicators(); - console.log(error); - }); - - $rootScope.$on('OC:AccessInvalidOrExpired', function() { - if (!anonymous) LoginService.RememberMe(); - }); - - $rootScope.$on('OC:AccessForbidden', function(){ - toastr.warning("You do not have permission to access this page."); - }); -} - -function Interceptor($httpProvider) { - $httpProvider.interceptors.push(function($q, $rootScope) { - return { - 'responseError': function(rejection) { - if (rejection.config.url.indexOf('ordercloud.io') > -1 && rejection.status == 401) { - $rootScope.$broadcast('OC:AccessInvalidOrExpired'); - } - if (rejection.config.url.indexOf('ordercloud.io') > -1 && rejection.status == 403){ - $rootScope.$broadcast('OC:AccessForbidden'); - } - return $q.reject(rejection); - } - }; - }); -} diff --git a/src/app/base/base.js b/src/app/base/base.js index a9a89f96..5e752877 100644 --- a/src/app/base/base.js +++ b/src/app/base/base.js @@ -1,171 +1,6 @@ angular.module('orderCloud') .config(BaseConfig) .controller('BaseCtrl', BaseController) -<<<<<<< HEAD - .filter('occomponents', occomponents) -; - -function BaseConfig($stateProvider, $injector) { - var baseViews = { - '': { - templateUrl: 'base/templates/base.tpl.html', - controller: 'BaseCtrl', - controllerAs: 'base' - } - }; - - if ($injector.has('base')) { - var baseConfig = $injector.get('base'); - - //conditional base left - baseConfig.left ? baseViews['left@base'] = { - 'templateUrl': 'base/templates/base.left.tpl.html' - } : angular.noop(); - - //conditional base right - baseConfig.right ? baseViews['right@base'] = { - 'templateUrl': 'base/templates/base.right.tpl.html' - } : angular.noop(); - - //conditional base top - baseConfig.top ? baseViews['top@base'] = { - 'templateUrl': 'base/templates/base.top.tpl.html' - } : angular.noop(); - - //conditional base bottom - baseConfig.bottom ? baseViews['bottom@base'] = { - 'templateUrl': 'base/templates/base.bottom.tpl.html' - } : angular.noop(); - } - - var baseState = { - url: '', - abstract: true, - views: baseViews, - resolve: { - CurrentUser: function($q, $state, OrderCloud, buyerid, anonymous) { - var dfd = $q.defer(); - OrderCloud.Me.Get() - .then(function(data) { - dfd.resolve(data); - }) - .catch(function(){ - if (anonymous) { - if (!OrderCloud.Auth.ReadToken()) { - OrderCloud.Auth.GetToken('') - .then(function(data) { - OrderCloud.Auth.SetToken(data['access_token']); - }) - .finally(function() { - OrderCloud.BuyerID.Set(buyerid); - dfd.resolve({}); - }); - } - } else { - OrderCloud.Auth.RemoveToken(); - OrderCloud.Auth.RemoveImpersonationToken(); - OrderCloud.BuyerID.Set(null); - $state.go('login'); - dfd.resolve(); - } - }); - return dfd.promise; - }, - AnonymousUser: function($q, OrderCloud, CurrentUser) { - CurrentUser.Anonymous = angular.isDefined(JSON.parse(atob(OrderCloud.Auth.ReadToken().split('.')[1])).orderid); - }, - ComponentList: function($state, $q, Underscore, CurrentUser) { - var deferred = $q.defer(); - var nonSpecific = ['Buyers', 'Products', 'Specs', 'Price Schedules', 'Admin Users', 'Product Facets']; - var components = { - nonSpecific: [], - buyerSpecific: [] - }; - angular.forEach($state.get(), function(state) { - if (!state.data || !state.data.componentName) return; - if (nonSpecific.indexOf(state.data.componentName) > -1) { - if (Underscore.findWhere(components.nonSpecific, {Display: state.data.componentName}) == undefined) { - components.nonSpecific.push({ - Display: state.data.componentName, - StateRef: state.name - }); - } - } else { - if (Underscore.findWhere(components.buyerSpecific, {Display: state.data.componentName}) == undefined) { - components.buyerSpecific.push({ - Display: state.data.componentName, - StateRef: state.name - }); - } - } - }); - deferred.resolve(components); - return deferred.promise; - } - } - }; - - $stateProvider.state('base', baseState); -} - -function BaseController($rootScope, $ocMedia, Underscore, snapRemote, defaultErrorMessageResolver, CurrentUser, ComponentList, base) { - var vm = this; - vm.left = base.left; - vm.right = base.right; - vm.currentUser = CurrentUser; - vm.catalogItems = ComponentList.nonSpecific; - vm.organizationItems = ComponentList.buyerSpecific; - vm.registrationAvailable = Underscore.filter(vm.organizationItems, function(item) { return item.StateRef == 'registration' }).length; - - defaultErrorMessageResolver.getErrorMessages().then(function (errorMessages) { - errorMessages['customPassword'] = 'Password must be at least eight characters long and include at least one letter and one number'; - //regex for customPassword = ^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d!$%@#£€*?&]{8,}$ - errorMessages['positiveInteger'] = 'Please enter a positive integer'; - //regex positiveInteger = ^[0-9]*[1-9][0-9]*$ - errorMessages['ID_Name'] = 'Only Alphanumeric characters, hyphens and underscores are allowed'; - //regex ID_Name = ([A-Za-z0-9\-\_]+) - errorMessages['confirmpassword'] = 'Your passwords do not match'; - errorMessages['noSpecialChars'] = 'Only Alphanumeric characters are allowed'; - }); - - vm.snapOptions = { - disable: (!base.left && base.right) ? 'left' : ((base.left && !base.right) ? 'right' : 'none') - }; - - function _isMobile() { - return $ocMedia('max-width:991px'); - } - - function _initDrawers(isMobile) { - snapRemote.close('MAIN'); - if (isMobile && (base.left || base.right)) { - snapRemote.enable('MAIN'); - } else { - snapRemote.disable('MAIN'); - } - } - - _initDrawers(_isMobile()); - - $rootScope.$watch(_isMobile, function(n, o) { - if (n === o) return; - _initDrawers(n); - }); -} - -function occomponents() { - return function(components) { - var filtered = ['registration']; - var result = []; - - angular.forEach(components, function(component) { - if (filtered.indexOf(component.StateRef) == -1) result.push(component); - }); - - return result; - } -} -======= .factory('NewOrder', NewOrderService) ; @@ -274,5 +109,4 @@ function NewOrderService($q, OrderCloud) { } return service; -} ->>>>>>> 281bb9e29d0e44c929457c755c5b59714e368ee2 +} \ No newline at end of file diff --git a/src/app/base/less/base.less b/src/app/base/less/base.less deleted file mode 100644 index 45bbe38a..00000000 --- a/src/app/base/less/base.less +++ /dev/null @@ -1,102 +0,0 @@ -#BASE { - background-color:@body-bg; - overflow:hidden; - height:100%; - display:flex; - flex-flow:column nowrap; -} - -#BASE { - &.desktop-left, - &.desktop-right { - transition:right 200ms ease-in-out, left 200ms ease-in-out; - } -} - -@media(min-width:@screen-md-min) { - #BASE { - &.desktop-left { - left:@base-left-width; - } - &.desktop-right { - right:@base-right-width; - } - } -} - -#BASE_TOP, -#BASE_BOTTOM { - flex:0 1 auto; - .navbar { - margin:0; - border-radius:0; - border-left-width:0; - border-right-width:0; - } -} - -#BASE_TOP { - .navbar { - border-top-width:0; - } -} - -#BASE_BOTTOM { - .navbar { - border-bottom-width:0; - } -} - -#BASE_LEFT, -#BASE_RIGHT { - padding:@grid-gutter-width/2; - background-color:@side-nav-bg;; - border-style:solid; - border-color:@side-nav-border; - border-width:0; -} - -#BASE_LEFT { - border-right-width:1px; - &.snap-drawer { - width:@base-left-width; - } -} - -#BASE_RIGHT { - border-left-width:1px; - &.snap-drawer { - width:@base-right-width; - } -} - -//===== Minicart in Base top/bottom -#BASE_BOTTOM { - .dropdown .dropdown-menu { - top: auto; - bottom: 100%; - margin-bottom:2px; - } - :not(#minicart).dropdown .dropdown-menu { - margin-bottom: 0; - .border-top-radius(@border-radius-base); - .border-bottom-radius(0); - } - .caret { - border-top: 0; - border-bottom: 4px dashed; - content: ""; - } -} - -#BASE_BOTTOM, -#BASE_TOP { - #minicart { - &:extend(.navbar-right); - &:extend(.navbar-form); - margin-right:0; - margin-top:0; - margin-bottom:0; - } -} - diff --git a/src/app/base/less/variables.less b/src/app/base/less/variables.less deleted file mode 100644 index 18a7e35b..00000000 --- a/src/app/base/less/variables.less +++ /dev/null @@ -1,7 +0,0 @@ -//OrderCloud Side Nav -@side-nav-bg: exclusion(@body-bg, @gray-darker); -@side-nav-border: shade(@side-nav-bg, 5); - -//If you change the right or left width - you will also need to adjust the minPosition/maxPosition for the snapOptions in base.js to match -@base-left-width: 265px; -@base-right-width: 265px; diff --git a/src/app/base/templates/base.bottom.tpl.html b/src/app/base/templates/base.bottom.tpl.html deleted file mode 100644 index 6660bcc1..00000000 --- a/src/app/base/templates/base.bottom.tpl.html +++ /dev/null @@ -1,35 +0,0 @@ - diff --git a/src/app/base/templates/base.left.tpl.html b/src/app/base/templates/base.left.tpl.html deleted file mode 100644 index 4eda08ab..00000000 --- a/src/app/base/templates/base.left.tpl.html +++ /dev/null @@ -1,33 +0,0 @@ - - - - diff --git a/src/app/base/templates/base.right.tpl.html b/src/app/base/templates/base.right.tpl.html deleted file mode 100644 index a0a78a7e..00000000 --- a/src/app/base/templates/base.right.tpl.html +++ /dev/null @@ -1,33 +0,0 @@ - - - - diff --git a/src/app/base/templates/base.top.tpl.html b/src/app/base/templates/base.top.tpl.html deleted file mode 100644 index 2356512e..00000000 --- a/src/app/base/templates/base.top.tpl.html +++ /dev/null @@ -1,35 +0,0 @@ - diff --git a/src/app/base/templates/base.tpl.html b/src/app/base/templates/base.tpl.html index 6161c00f..2856f1de 100644 --- a/src/app/base/templates/base.tpl.html +++ b/src/app/base/templates/base.tpl.html @@ -1,15 +1,4 @@ -<<<<<<< HEAD -
-
- -
-
- -
- -=======
-
->>>>>>> 281bb9e29d0e44c929457c755c5b59714e368ee2 +
\ No newline at end of file diff --git a/src/app/base/tests/base.spec.js b/src/app/base/tests/base.spec.js index 00e82c6b..18aa0cbf 100644 --- a/src/app/base/tests/base.spec.js +++ b/src/app/base/tests/base.spec.js @@ -2,54 +2,6 @@ describe('Component: Base', function() { var q, scope, oc, -<<<<<<< HEAD - underscore; - beforeEach(module('orderCloud')); - beforeEach(module('orderCloud.sdk')); - beforeEach(module('ui.router')); - beforeEach(inject(function($q, $rootScope, OrderCloud, Underscore) { - q = $q; - scope = $rootScope.$new(); - oc = OrderCloud; - underscore = Underscore; - })); - describe('State: Base', function() { - var state; - beforeEach(inject(function($state) { - state = $state.get('base'); - var dfd = q.defer(); - dfd.resolve(true); - spyOn(oc.BuyerID, 'Set').and.callThrough(); - spyOn(oc.Auth, 'RemoveToken').and.callThrough(); - spyOn(oc.Auth, 'RemoveImpersonationToken').and.callThrough(); - spyOn($state, 'go').and.returnValue(true); - })); - //Skipped this test because Base now resolves with Auth.IsAuthenticated and THEN do a Me.Get() to confirm the token will work - it('should resolve CurrentUser', inject(function ($injector) { - var dfd = q.defer(); - dfd.resolve('TEST USER'); - spyOn(oc.Me, 'Get').and.returnValue(dfd.promise); - $injector.invoke(state.resolve.CurrentUser); - expect(oc.Me.Get).toHaveBeenCalled(); - })); - it('should remove Auth tokens, set BuyerID to null, and return to login if unauthenticated', inject(function($injector, $state) { - var dfd = q.defer(); - dfd.reject(true); - spyOn(oc.Me, 'Get').and.returnValue(dfd.promise); - $injector.invoke(state.resolve.CurrentUser); - scope.$digest(); - expect(oc.Auth.RemoveToken).toHaveBeenCalled(); - expect(oc.Auth.RemoveImpersonationToken).toHaveBeenCalled(); - expect(oc.BuyerID.Set).toHaveBeenCalledWith(null); - expect($state.go).toHaveBeenCalledWith('login'); - })); - it ('should resolve ComponentsList', inject(function($injector, $state) { - var currentUser = $injector.invoke(state.resolve.CurrentUser); - var components = $injector.invoke(state.resolve.ComponentList, scope, {$state: $state, $q: q, Underscore: underscore, CurrentUser: currentUser}); - expect(components.nonSpecific).not.toBe(null); - expect(components.buyerSpecific).not.toBe(null); - })); -======= buyerid = "BUYERID", state, injector; @@ -94,7 +46,6 @@ describe('Component: Base', function() { injector.invoke(base.resolve.CurrentOrder, scope, {ExistingOrder: existingOrder, NewOrder: newOrder, CurrentUser: currentUser}); expect(newOrder.Create).toHaveBeenCalledWith({}); })) ->>>>>>> 281bb9e29d0e44c929457c755c5b59714e368ee2 }); describe('Controller: BaseCtrl', function(){ @@ -102,44 +53,6 @@ describe('Component: Base', function() { fake_user = { Username: 'notarealusername', Password: 'notarealpassword' -<<<<<<< HEAD - }; - beforeEach(inject(function($controller) { - baseCtrl = $controller('BaseCtrl', { - CurrentUser: fake_user - }); - })); - it ('should initialize the currentUser into its scope', function() { - expect(baseCtrl.currentUser).toBe(fake_user); - }); - }); - - describe('Controller: BaseLeftCtrl', function(){ - var baseLeftCtrl, - fake_components = { - nonSpecific: ['test1', 'test2', 'test3'], - buyerSpecific: ['test4', 'test5', 'test6'] - }; - beforeEach(inject(function($controller) { - baseLeftCtrl = $controller('BaseLeftCtrl', { - ComponentList: fake_components, - Order: null - }); - })); - it ('should initialize the components lists', function() { - expect(baseLeftCtrl.catalogItems).toBe(fake_components.nonSpecific); - expect(baseLeftCtrl.organizationItems).toBe(fake_components.buyerSpecific); - }); - }); - - describe('Controller: BaseTopCtrl', function(){ - var baseTopCtrl; - beforeEach(inject(function($controller) { - baseTopCtrl = $controller('BaseTopCtrl', {}); - })); - /* No tests needed */ - }); -======= }, fake_order = { ID: 'fakeorder' @@ -155,5 +68,4 @@ describe('Component: Base', function() { expect(baseCtrl.currentOrder).toBe(fake_order); }); }); ->>>>>>> 281bb9e29d0e44c929457c755c5b59714e368ee2 }); diff --git a/src/app/base/tests/base.test.js b/src/app/base/tests/base.test.js index dc276cd0..2e411be1 100644 --- a/src/app/base/tests/base.test.js +++ b/src/app/base/tests/base.test.js @@ -1,10 +1,6 @@ function BasePage() { this.get = function() { -<<<<<<< HEAD - browser.get('/#'); -======= browser.get('#'); ->>>>>>> 281bb9e29d0e44c929457c755c5b59714e368ee2 }; this.getTitle = function() { @@ -21,11 +17,7 @@ describe('Base', function() { describe('base', function() { it ("should display the correct title", function() { -<<<<<<< HEAD - expect(page.getTitle()).toBe('OrderCloud'); -======= expect(page.getTitle()).toBe('Angular Buyer'); ->>>>>>> 281bb9e29d0e44c929457c755c5b59714e368ee2 }); }) }); \ No newline at end of file diff --git a/src/app/common/address/address.js b/src/app/common/address/address.js deleted file mode 100644 index a6404f20..00000000 --- a/src/app/common/address/address.js +++ /dev/null @@ -1,54 +0,0 @@ -angular.module('ordercloud-address', []) - .directive('ordercloudAddressForm', AddressFormDirective) - .directive('ordercloudAddressInfo', AddressInfoDirective) - .filter('address', AddressFilter) -; - -function AddressFormDirective(OCGeography) { - return { - restrict: 'E', - scope: { - address: '=', - isbilling: '=' - }, - templateUrl: 'common/address/templates/address.form.tpl.html', - link: function(scope) { - scope.countries = OCGeography.Countries; - scope.states = OCGeography.States; - } - }; -} - -function AddressInfoDirective() { - return { - restrict: 'E', - scope: { - addressid: '@' - }, - templateUrl: 'common/address/templates/address.info.tpl.html', - controller: 'AddressInfoCtrl', - controllerAs: 'addressInfo' - }; -} - -function AddressFilter() { - return function(address, option) { - if (!address) return null; - if (option === 'full') { - var result = []; - if (address.AddressName) { - result.push(address.AddressName); - } - result.push((address.FirstName ? address.FirstName + ' ' : '') + address.LastName); - result.push(address.Street1); - if (address.Street2) { - result.push(address.Street2); - } - result.push(address.City + ', ' + address.State + ' ' + address.Zip); - return result.join('\n'); - } - else { - return address.Street1 + (address.Street2 ? ', ' + address.Street2 : ''); - } - } -} diff --git a/src/app/common/address/templates/address.form.tpl.html b/src/app/common/address/templates/address.form.tpl.html deleted file mode 100644 index 50e8b91b..00000000 --- a/src/app/common/address/templates/address.form.tpl.html +++ /dev/null @@ -1,54 +0,0 @@ -
-
-
- - -
-
- - -
-
-
-
- - -
-
- - -
-
-
- - -
-
- - -
-
-
- - -
-
- - -
-
-
-
- - -
-
-
\ No newline at end of file diff --git a/src/app/common/auto-id/auto-id.js b/src/app/common/auto-id/auto-id.js deleted file mode 100644 index c168621b..00000000 --- a/src/app/common/auto-id/auto-id.js +++ /dev/null @@ -1,50 +0,0 @@ -angular.module('ordercloud-auto-id', []); - -angular.module('ordercloud-auto-id') - .directive('ordercloudAutoId', ordercloudAutoIdDirective) -; - -function ordercloudAutoIdDirective($compile) { - return { - restrict: 'A', - require: 'ngModel', - scope: { - boxtext: '@' - }, - link: function(scope, element, attrs, ngModel) { - scope.boxtext = scope.boxtext || 'Auto-Gen. ID'; - var autoID_element = angular.element(" {{boxtext}} "); - //var initCheckbox = true; - //if (scope.defaultvalue != undefined) { - // initCheckbox = scope.defaultvalue; - //} - //console.log(initCheckbox); - if(element.parent().hasClass('input-group') == false) { - element.wrap("
"); - } - autoID_element.attr('checked', true); - if (autoID_element.find('input').prop('checked')) { - element.attr('disabled', true); - } - autoID_element.find('input').bind('click', function() { - autoID_element.attr('checked', !autoID_element.prop('checked')); - if (autoID_element.find('input').prop('checked')) { - element.attr('disabled', true); - element.attr('required', false); - element.attr('ng-required', false); - element.removeClass('ng-invalid'); - element.removeClass('ng-invalid-required'); - ngModel.$setViewValue(null); - ngModel.$render(); - } - else { - element.attr('disabled', false); - element.attr('required', true); - element.attr('ng-required', true); - } - }); - element.after(autoID_element); - $compile(autoID_element)(scope); - } - } -} diff --git a/src/app/common/auto-id/tests/auto-id.spec.js b/src/app/common/auto-id/tests/auto-id.spec.js deleted file mode 100644 index c4b2cdf3..00000000 --- a/src/app/common/auto-id/tests/auto-id.spec.js +++ /dev/null @@ -1,35 +0,0 @@ -describe('Directive: ordercloudAutoId', function() { - var scope, - element, - modelValue; - beforeEach(module('orderCloud')); - beforeEach(module('orderCloud.sdk')); - beforeEach(module('ordercloud-auto-id')); - beforeEach(inject(function($rootScope, $compile) { - scope = $rootScope.$new(); - element = $compile('
')(scope); - scope.$digest(); - })); - it('should set boxtext to the value passed in', inject(function($compile) { - var potato_element = $compile('')(scope); - scope.$digest(); - expect(potato_element.isolateScope().boxtext).toBe('potato'); - })); - it('should wrap the input in an input group div', function() { - var result = element[0].querySelectorAll('.input-group'); - expect(angular.element(result).hasClass('input-group')).toBe(true); - }); - it('should have property checked set to checked', function() { - var result = element[0].querySelectorAll('.input-group-addon'); - expect(angular.element(result).attr('checked')).toBe('checked'); - }); - it('should have attribute disabled set to disabled', function() { - var result = element[0].querySelectorAll('.element_for_testing'); - expect(angular.element(result).attr('disabled')).toBe('disabled'); - }); - it('should init boxtext if no value is passed in', inject(function($compile) { - var blank_element = $compile('')(scope); - scope.$digest(); - expect(blank_element.isolateScope().boxtext).toBe('Auto-Gen. ID'); - })); -}); diff --git a/src/app/common/auto-id/tests/auto-id.test.js b/src/app/common/auto-id/tests/auto-id.test.js deleted file mode 100644 index e69de29b..00000000 diff --git a/src/app/common/buyer-select/less/buyer-select.less b/src/app/common/buyer-select/less/buyer-select.less deleted file mode 100644 index b4030d63..00000000 --- a/src/app/common/buyer-select/less/buyer-select.less +++ /dev/null @@ -1,22 +0,0 @@ -.btn-select-buyer { - text-align:left; - margin-bottom:10px; - span { - display:block; - white-space: normal; - } -} - -.buyer-list-menu{ - padding:0; - border:0; - background-color:@body-bg; - min-width:400px; - max-width:100%; - .table-fixed-header { - margin-bottom:0; - } - .table-container { - max-height:calc(50vh); - } -} \ No newline at end of file diff --git a/src/app/common/buyer-select/ordercloud-buyer-selected.js b/src/app/common/buyer-select/ordercloud-buyer-selected.js deleted file mode 100644 index 8bce4c7d..00000000 --- a/src/app/common/buyer-select/ordercloud-buyer-selected.js +++ /dev/null @@ -1,48 +0,0 @@ -angular.module('ordercloud-buyer-select', []) - .directive('ordercloudSelectBuyer', SelectBuyerDirective) - .controller('SelectBuyerCtrl', SelectBuyerController) -; - -function SelectBuyerDirective() { - return { - scope: { - align:'@' - }, - restrict: 'E', - templateUrl: 'common/buyer-select/templates/buyer-select.tpl.html', - controller: 'SelectBuyerCtrl', - controllerAs: 'selectBuyer' - } -} - -function SelectBuyerController($scope, $state, OrderCloud) { - var vm = this; - - vm.align = $scope.align; - - OrderCloud.Buyers.List().then(function(data) { - vm.BuyerList = data; - }); - - OrderCloud.Buyers.Get(OrderCloud.BuyerID.Get()).then(function(data) { - vm.selectedBuyer = data; - }); - - vm.ChangeBuyer = function(buyer) { - OrderCloud.Buyers.Get(buyer.ID).then(function(data) { - vm.selectedBuyer = data; - OrderCloud.BuyerID.Set(data.ID); - $state.reload($state.current); - }); - }; - - vm.pagingfunction = function() { - if (vm.BuyerList.Meta.Page <= vm.BuyerList.Meta.TotalPages) { - OrderCloud.Buyers.List(null, vm.BuyerList.Meta.Page + 1, vm.BuyerList.Meta.PageSize) - .then(function(data) { - vm.BuyerList.Meta = data.Meta; - vm.BuyerList.Items = [].concat(vm.BuyerList.Items, data.Items); - }); - } - } -} diff --git a/src/app/common/buyer-select/templates/buyer-select.tpl.html b/src/app/common/buyer-select/templates/buyer-select.tpl.html deleted file mode 100644 index 1275dd1c..00000000 --- a/src/app/common/buyer-select/templates/buyer-select.tpl.html +++ /dev/null @@ -1,49 +0,0 @@ -
-
- - -
- -
diff --git a/src/app/common/buyer-select/tests/buyer-select.spec.js b/src/app/common/buyer-select/tests/buyer-select.spec.js deleted file mode 100644 index f931e916..00000000 --- a/src/app/common/buyer-select/tests/buyer-select.spec.js +++ /dev/null @@ -1,106 +0,0 @@ -describe('Buyer-Select:', function() { - var q, - scope, - oc; - beforeEach(module('orderCloud')); - beforeEach(module('orderCloud.sdk')); - beforeEach(inject(function($q, $rootScope, OrderCloud){ - q = $q; - scope = $rootScope.$new(); - oc = OrderCloud; - })); - - describe('Directive: ordercloudSelectBuyer', function() { - var element; - beforeEach(inject(function($compile) { - var deferred1 = q.defer(); - var deferred2 = q.defer(); - deferred1.resolve('Buyer'); - deferred2.resolve('Buyers'); - spyOn(oc.Buyers, 'Get').and.returnValue(deferred1.promise); - spyOn(oc.Buyers, 'List').and.returnValue(deferred2.promise); - element = $compile('')(scope); - scope.$digest(); - })); - it('should initialize the controller', function() { - expect(oc.Buyers.List).toHaveBeenCalled(); - expect(oc.Buyers.Get).toHaveBeenCalledWith(oc.BuyerID.Get()); - expect(element.isolateScope().selectBuyer).not.toBe(undefined); - }); - it('should initialize a list of buyers', function() { - expect(element.isolateScope().selectBuyer.BuyerList).toBe('Buyers'); - }); - it('should initialize a the selected buyer', function() { - expect(element.isolateScope().selectBuyer.selectedBuyer).toBe('Buyer'); - }); - it('should initialize a list of buyers', function() { - expect(element.isolateScope().selectBuyer.BuyerList).toBe('Buyers'); - }); - }); - - describe('Controller: SelectBuyerCtrl', function() { - var buyerSelectCtrl, - mock_buyer = { - ID: 'buyer_id', - name: 'fake_buyer' - }, - mock_list = { - Meta: { - Page: 1, - TotalPages: 2, - PageSize: 1 - }, - Items: [ - 'buyer1', - 'buyer2' - ] - }; - beforeEach(inject(function($controller, $state) { - var deferred1 = q.defer(); - var deferred2 = q.defer(); - deferred1.resolve(mock_buyer); - deferred2.resolve(mock_list); - spyOn(oc.Buyers, 'Get').and.returnValue(deferred1.promise); - spyOn(oc.Buyers, 'List').and.returnValue(deferred2.promise); - spyOn($state, 'reload').and.returnValue(true); - spyOn(oc.BuyerID, 'Set').and.returnValue(true); - buyerSelectCtrl = $controller('SelectBuyerCtrl', { - $scope: scope - }); - })); - describe('ChangeBuyer', function() { - beforeEach(function() { - buyerSelectCtrl.ChangeBuyer(mock_buyer); - scope.$digest(); - }); - it('should called the Get method of the Buyers service', function() { - expect(oc.Buyers.Get).toHaveBeenCalledWith(mock_buyer.ID); - }); - it('should change the selected buyer to the one passed in', function() { - expect(buyerSelectCtrl.selectedBuyer).toBe(mock_buyer); - }); - it('should call the Set method of BuyerID to change the saved buyer ID value stored in the cookies', function() { - expect(oc.BuyerID.Set).toHaveBeenCalledWith(mock_buyer.ID); - }); - it('should reload the state', inject(function($state) { - expect($state.reload).toHaveBeenCalledWith($state.current); - })); - }); - describe('pagingfunction', function() { - beforeEach(function() { - scope.$digest(); - buyerSelectCtrl.pagingfunction(); - }); - it('should call the List method of Buyers when there are more pages to get', function() { - scope.$digest(); - expect(oc.Buyers.List).toHaveBeenCalledWith(null, mock_list.Meta.Page + 1, mock_list.Meta.PageSize); - expect(buyerSelectCtrl.BuyerList.Items.length).toBe(4); - }); - it('should not call the List method when there are no more pages to get', function() { - buyerSelectCtrl.BuyerList.Meta.Page = 2; - scope.$digest(); - expect(oc.Buyers.List).not.toHaveBeenCalledWith(null, mock_list.Meta.Page + 1, mock_list.Meta.PageSize); - }); - }); - }); -}); diff --git a/src/app/common/buyer-select/tests/buyer_select.test.js b/src/app/common/buyer-select/tests/buyer_select.test.js deleted file mode 100644 index e69de29b..00000000 diff --git a/src/app/common/confirmPassword/confirmPassword.js b/src/app/common/confirmPassword/confirmPassword.js deleted file mode 100644 index f04d1731..00000000 --- a/src/app/common/confirmPassword/confirmPassword.js +++ /dev/null @@ -1,32 +0,0 @@ -angular.module('orderCloud') - .directive('confirmpassword', confirmpassword) -; - -function confirmpassword() { - return { - restrict: 'A', - require: 'ngModel', - link: function (scope, element, attrs, ngModel) { - if (!ngModel) return; - - //watch own value and re-validate on change - scope.$watch(attrs.ngModel, function() { - validate(); - }); - - //watch other value and re-validate on change - attrs.$observe('confirmpassword', function(val) { - validate(); - }); - - var validate = function() { - var val1 = ngModel.$viewValue; - var val2 = attrs.confirmpassword; - - (!val1 || !val2 || val1 === val2) ? ngModel.$setValidity('confirmpassword', true) : ngModel.$setValidity('confirmpassword', false); - }; - } - } -} - - diff --git a/src/app/common/current-order/current-order.js b/src/app/common/current-order/current-order.js deleted file mode 100644 index ff3c7c86..00000000 --- a/src/app/common/current-order/current-order.js +++ /dev/null @@ -1,89 +0,0 @@ -angular.module('ordercloud-current-order', []) - .factory('CurrentOrder', CurrentOrderService) -; - -function CurrentOrderService($q, $localForage, OrderCloud, appname) { - var StorageName = appname + '.CurrentOrderID'; - return { - Get: _get, - GetID: _getID, - Set: _set, - Remove: _remove, - GetLineItems: _getLineItems - }; - - function _get() { - var dfd = $q.defer(); - _getID() - .then(function(OrderID) { - OrderCloud.Orders.Get(OrderID) - .then(function(order) { - dfd.resolve(order); - }) - .catch(function() { - _remove(); - dfd.reject(); - }); - }) - .catch(function() { - dfd.reject(); - }); - return dfd.promise; - } - - function _getID() { - var dfd = $q.defer(); - $localForage.getItem(StorageName) - .then(function(orderID) { - if (orderID) - dfd.resolve(orderID); - else { - _remove(); - dfd.reject(); - } - }) - .catch(function() { - dfd.reject(); - }); - return dfd.promise; - } - - function _set(OrderID) { - $localForage.setItem(StorageName, OrderID) - .then(function(data) { - return data; - }) - .catch(function(error) { - return error; - }); - } - - function _remove() { - return $localForage.removeItem(StorageName); - } - - function _getLineItems(orderID) { - var deferred = $q.defer(); - var lineItems = []; - var queue = []; - - _getID() - .then(function(OrderID) { - OrderCloud.LineItems.List(OrderID, 1, 100) - .then(function(data) { - lineItems = lineItems.concat(data.Items); - for (var i = 2; i <= data.Meta.TotalPages; i++) { - queue.push(OrderCloud.LineItems.List(OrderID, i, 100)); - } - $q.all(queue).then(function(results) { - angular.forEach(results, function(result) { - lineItems = lineItems.concat(result.Items); - }); - deferred.resolve(lineItems); - }); - }); - }); - - return deferred.promise; - } -} \ No newline at end of file diff --git a/src/app/common/files/files.js b/src/app/common/files/files.js deleted file mode 100644 index 5cc99e9a..00000000 --- a/src/app/common/files/files.js +++ /dev/null @@ -1,184 +0,0 @@ -angular.module('orderCloud') - .factory('FileReader', fileReader) - .factory('FilesService', FilesService) - .directive('ordercloudFileUpload', ordercloudFileUpload) -; - -//TODO: update the New SDK to have a file Upload method similar to how this works. Minus attaching the file info to any XP -function fileReader($q) { - var service = { - ReadAsDataUrl: _readAsDataURL - }; - - function onLoad(reader, deferred, scope) { - return function() { - scope.$apply(function() { - deferred.resolve(reader); - }); - }; - } - - function onError(reader, deferred, scope) { - return function() { - scope.$apply(function() { - deferred.reject(reader); - }); - }; - } - - function onProgress(reader, scope) { - return function(event) { - scope.$broadcast('fileProgress', - { - total: event.total, - loaded: event.loaded - }); - }; - } - - function getReader(deferred, scope) { - var reader = new FileReader(); - reader.onload = onLoad(reader, deferred, scope); - reader.onerror = onError(reader, deferred, scope); - reader.onprogress = onProgress(reader, scope); - return reader; - } - - function _readAsDataURL(file, scope) { - var deferred = $q.defer(); - - var reader = getReader(deferred, scope); - reader.readAsDataURL(file); - - return deferred.promise; - } - - return service; -} - -function FilesService($q, $http, OrderCloud, apiurl) { - var service = { - Upload: _upload - }; - - var fileURL = apiurl + '/v1/files'; - - function _upload(file, fileName) { - var deferred = $q.defer(); - - var fd = new FormData(); - fd.append('file', file); - - $http.post(fileURL + '?filename=' + fileName, fd, {transformRequest: angular.identity, headers: {'Content-Type': undefined, 'Authorization': 'Bearer ' + OrderCloud.Auth.ReadToken()}}) - .success(function(data) { - deferred.resolve(data); - }) - .error(function(error) { - deferred.reject(error) - }); - - return deferred.promise; - } - - return service; -} - -function ordercloudFileUpload($parse, Underscore, FileReader, FilesService) { - var directive = { - scope: { - model: '=', - keyname: '@', - label: '@', - extensions: '@', - invalidExtension: '@' - }, - restrict: 'E', - templateUrl: 'common/files/templates/files.tpl.html', - replace: true, - link: link - }; - - function link(scope, element, attrs) { - var file_input = $parse('file'); - var file_control = angular.element(element.find('input'))[0]; - var el = element; - scope.invalidExtension = false; - - scope.upload = function() { - $('#orderCloudUpload').click(); - }; - - scope.remove = function() { - delete scope.model.xp[scope.keyname]; - }; - - function afterSelection(file, fileName) { - FilesService.Upload(file, fileName) - .then(function(fileData) { - if (!scope.model.xp) scope.model.xp = {}; - scope.model.xp[scope.keyname] = fileData; - scope.model.xp[scope.keyname].Type = file.type; - }); - } - - var allowed = { - Extensions: [], - Types: [] - }; - if (scope.extensions) { - var items = Underscore.map(scope.extensions.split(','), function(ext) { return ext.replace(/ /g ,'').replace(/\./g, '').toLowerCase() }); - angular.forEach(items, function(item) { - if (item.indexOf('/') > -1) { - if (item.indexOf('*') > -1) { - allowed.Types.push(item.split('/')[0]); - } - else { - allowed.Extensions.push(item.split('/')[1]); - } - } - else { - allowed.Extensions.push(item); - } - }); - } - - function updateModel(event) { - switch (event.target.name) { - case 'upload': - if (event.target.files[0] == null) return; - var fileName = event.target.files[0].name; - var valid = true; - if ((allowed.Extensions.length || allowed.Types.length) && fileName) { - var ext = fileName.split('.').pop().toLowerCase(); - valid = (allowed.Extensions.indexOf(ext) != -1 || allowed.Types.indexOf(event.target.files[0].type.split('/')[0]) > -1); - } - if (valid) { - scope.invalidExtension = false; - scope.$apply(function() { - FileReader.ReadAsDataUrl(event.target.files[0], scope) - .then(function(f) { - afterSelection(event.target.files[0], fileName); - }); - file_input.assign(scope, event.target.files[0]); - }); - } - else { - scope.$apply(function() { - scope.invalidExtension = true; - var input; - event.target.files[0] = null; - el.find('input').replaceWith(input = el.find('input').clone(true)); - if (!scope.model.xp) scope.model.xp = {}; - scope.model.xp[scope.keyname] = null; - }); - } - break; - } - } - - element.bind('change', updateModel); - } - - return directive; -} - diff --git a/src/app/common/files/templates/files.tpl.html b/src/app/common/files/templates/files.tpl.html deleted file mode 100644 index 62503dd8..00000000 --- a/src/app/common/files/templates/files.tpl.html +++ /dev/null @@ -1,12 +0,0 @@ -
-
- Product Image -
- -

- - -

- - Invalid File Type -
diff --git a/src/app/common/files/tests/files.spec.js b/src/app/common/files/tests/files.spec.js deleted file mode 100644 index 13c5cebd..00000000 --- a/src/app/common/files/tests/files.spec.js +++ /dev/null @@ -1,33 +0,0 @@ -describe('Component: Files', function() { - var scope; - beforeEach(module('orderCloud')); - beforeEach(module('orderCloud.sdk')); - beforeEach(inject(function($rootScope) { - scope = $rootScope.$new(); - })); - describe('Factory: FileReader', function() { - var fileReader; - beforeEach(inject(function(FileReader) { - fileReader = FileReader; - })); - }); - describe('Factory: FileService', function() { - var fileService; - beforeEach(inject(function(FileService) { - fileService = FileService; - })); - }); - describe('Directive: ordercloudFileUpload', function() { - var element; - beforeEach(inject(function($compile) { - scope.model = {}; - element = $compile('')(scope); - scope.$digest(); - })); - it('should initialize the values into the isolated scope', function() { - expect(element.isolateScope().model).toEqual({}); - expect(element.isolateScope().keyname).toBe('text_files'); - expect(element.isolateScope().label).toBe('label_for_field'); - }); - }); -}); \ No newline at end of file diff --git a/src/app/common/files/tests/files.test.js b/src/app/common/files/tests/files.test.js deleted file mode 100644 index 1ce009f3..00000000 --- a/src/app/common/files/tests/files.test.js +++ /dev/null @@ -1,5 +0,0 @@ -(function () { - 'use strict'; - - -}()); diff --git a/src/app/common/geography/geography.js b/src/app/common/geography/geography.js deleted file mode 100644 index 0a9ab08e..00000000 --- a/src/app/common/geography/geography.js +++ /dev/null @@ -1,347 +0,0 @@ -angular.module('ordercloud-geography', []) - .factory('OCGeography', OCGeography) -; - -function OCGeography() { - var _countries = [ - { "label": "United States of America", "value": "US"}, - { "label": "Afghanistan", "value": "AF"}, - { "label": "Åland Islands", "value": "AX"}, - { "label": "Albania", "value": "AL"}, - { "label": "Algeria", "value": "DZ"}, - { "label": "American Samoa", "value": "AS"}, - { "label": "Andorra", "value": "AD"}, - { "label": "Angola", "value": "AO"}, - { "label": "Anguilla", "value": "AI"}, - { "label": "Antarctica", "value": "AQ"}, - { "label": "Antigua and Barbuda", "value": "AG"}, - { "label": "Argentina", "value": "AR"}, - { "label": "Armenia", "value": "AM"}, - { "label": "Aruba", "value": "AW"}, - { "label": "Australia", "value": "AU"}, - { "label": "Austria", "value": "AT"}, - { "label": "Azerbaijan", "value": "AZ"}, - { "label": "Bahamas", "value": "BS"}, - { "label": "Bahrain", "value": "BH"}, - { "label": "Bangladesh", "value": "BD"}, - { "label": "Barbados", "value": "BB"}, - { "label": "Belarus", "value": "BY"}, - { "label": "Belgium", "value": "BE"}, - { "label": "Belize", "value": "BZ"}, - { "label": "Benin", "value": "BJ"}, - { "label": "Bermuda", "value": "BM"}, - { "label": "Bhutan", "value": "BT"}, - { "label": "Bolivia", "value": "BO"}, - { "label": "Bosnia and Herzegovina", "value": "BA"}, - { "label": "Botswana", "value": "BW"}, - { "label": "Bouvet Island", "value": "BV"}, - { "label": "Brazil", "value": "BR"}, - { "label": "British Indian Ocean Territory", "value": "IO"}, - { "label": "Brunei Darussalam", "value": "BN"}, - { "label": "Bulgaria", "value": "BG"}, - { "label": "Burkina Faso", "value": "BF"}, - { "label": "Burundi", "value": "BI"}, - { "label": "Cambodia", "value": "KH"}, - { "label": "Cameroon", "value": "CM"}, - { "label": "Canada", "value": "CA"}, - { "label": "Cape Verde", "value": "CV"}, - { "label": "Cayman Islands", "value": "KY"}, - { "label": "Central African Republic", "value": "CF"}, - { "label": "Chad", "value": "TD"}, - { "label": "Chile", "value": "CL"}, - { "label": "China", "value": "CN"}, - { "label": "Christmas Island Australia", "value": "CX"}, - { "label": "Cocos Keeling Islands", "value": "CC"}, - { "label": "Colombia", "value": "CO"}, - { "label": "Comoros", "value": "KM"}, - { "label": "Congo", "value": "CG"}, - { "label": "Congo, D.R.", "value": "CD"}, - { "label": "Cook Islands", "value": "CK"}, - { "label": "Costa Rica", "value": "CR"}, - { "label": "Cote D'Ivoire Ivory Coast", "value": "CI"}, - { "label": "Croatia Hrvatska", "value": "HR"}, - { "label": "Cuba", "value": "CU"}, - { "label": "Cyprus", "value": "CY"}, - { "label": "Czech Republic", "value": "CZ"}, - { "label": "Denmark", "value": "DK"}, - { "label": "Djibouti", "value": "DJ"}, - { "label": "Dominica", "value": "DM"}, - { "label": "Dominican Republic", "value": "DO"}, - { "label": "Ecuador", "value": "EC"}, - { "label": "Egypt", "value": "EG"}, - { "label": "El Salvador", "value": "SV"}, - { "label": "Equatorial Guinea", "value": "GQ"}, - { "label": "Eritrea", "value": "ER"}, - { "label": "Estonia", "value": "EE"}, - { "label": "Ethiopia", "value": "ET"}, - { "label": "Faeroe Islands", "value": "FO"}, - { "label": "Falkland Islands Malvinas", "value": "FK"}, - { "label": "Fiji", "value": "FJ"}, - { "label": "Finland", "value": "FI"}, - { "label": "France", "value": "FR"}, - { "label": "France, Metropolitan", "value": "FX"}, - { "label": "French Guiana", "value": "GF"}, - { "label": "French Polynesia", "value": "PF"}, - { "label": "French Southern Territories", "value": "TF"}, - { "label": "Gabon", "value": "GA"}, - { "label": "Gambia", "value": "GM"}, - { "label": "Georgia", "value": "GE"}, - { "label": "Germany", "value": "DE"}, - { "label": "Ghana", "value": "GH"}, - { "label": "Gibraltar", "value": "GI"}, - { "label": "Greece", "value": "GR"}, - { "label": "Greenland", "value": "GL"}, - { "label": "Grenada", "value": "GD"}, - { "label": "Guadeloupe", "value": "GP"}, - { "label": "Guam", "value": "GU"}, - { "label": "Guatemala", "value": "GT"}, - { "label": "Guinea", "value": "GN"}, - { "label": "Guinea Bissau", "value": "GW"}, - { "label": "Guyana", "value": "GY"}, - { "label": "Haiti", "value": "HT"}, - { "label": "Heard and McDonald Is.", "value": "HM"}, - { "label": "Honduras", "value": "HN"}, - { "label": "Hong Kong", "value": "HK"}, - { "label": "Hungary", "value": "HU"}, - { "label": "Iceland", "value": "IS"}, - { "label": "India", "value": "IN"}, - { "label": "Indonesia", "value": "ID"}, - { "label": "Iran", "value": "IR"}, - { "label": "Iraq", "value": "IQ"}, - { "label": "Isle of Man", "value": "IM"}, - { "label": "Ireland", "value": "IE"}, - { "label": "Israel", "value": "IL"}, - { "label": "Italy", "value": "IT"}, - { "label": "Jamaica", "value": "JM"}, - { "label": "Japan", "value": "JP"}, - { "label": "Jersey", "value": "JE"}, - { "label": "Jordan", "value": "JO"}, - { "label": "Kazakhstan", "value": "KZ"}, - { "label": "Kenya", "value": "KE"}, - { "label": "Kiribati", "value": "KI"}, - { "label": "Korea North", "value": "KP"}, - { "label": "Korea South", "value": "KR"}, - { "label": "Kuwait", "value": "KW"}, - { "label": "Kyrgyzstan", "value": "KG"}, - { "label": "Lao P.Dem.R.", "value": "LA"}, - { "label": "Latvia", "value": "LV"}, - { "label": "Lebanon", "value": "LB"}, - { "label": "Lesotho", "value": "LS"}, - { "label": "Liberia", "value": "LR"}, - { "label": "Libyan Arab Jamahiriya", "value": "LY"}, - { "label": "Liechtenstein", "value": "LI"}, - { "label": "Lithuania", "value": "LT"}, - { "label": "Luxembourg", "value": "LU"}, - { "label": "Macau", "value": "MO"}, - { "label": "Macedonia", "value": "MK"}, - { "label": "Madagascar", "value": "MG"}, - { "label": "Malawi", "value": "MW"}, - { "label": "Malaysia", "value": "MY"}, - { "label": "Maldives", "value": "MV"}, - { "label": "Mali", "value": "ML"}, - { "label": "Malta", "value": "MT"}, - { "label": "Marshall Islands", "value": "MH"}, - { "label": "Martinique", "value": "MQ"}, - { "label": "Mauritania", "value": "MR"}, - { "label": "Mauritius", "value": "MU"}, - { "label": "Mayotte", "value": "YT"}, - { "label": "Mexico", "value": "MX"}, - { "label": "Micronesia", "value": "FM"}, - { "label": "Moldova", "value": "MD"}, - { "label": "Monaco", "value": "MC"}, - { "label": "Mongolia", "value": "MN"}, - { "label": "Montenegro", "value": "ME"}, - { "label": "Montserrat", "value": "MS"}, - { "label": "Morocco", "value": "MA"}, - { "label": "Mozambique", "value": "MZ"}, - { "label": "Myanmar", "value": "MM"}, - { "label": "Namibia", "value": "NA"}, - { "label": "Nauru", "value": "NR"}, - { "label": "Nepal", "value": "NP"}, - { "label": "Netherlands", "value": "NL"}, - { "label": "Netherlands Antilles", "value": "AN"}, - { "label": "New Caledonia", "value": "NC"}, - { "label": "New Zealand", "value": "NZ"}, - { "label": "Nicaragua", "value": "NI"}, - { "label": "Niger", "value": "NE"}, - { "label": "Nigeria", "value": "NG"}, - { "label": "Niue", "value": "NU"}, - { "label": "Norfolk Island", "value": "NF"}, - { "label": "Northern Mariana Islands", "value": "MP"}, - { "label": "Norway", "value": "NO"}, - { "label": "Oman", "value": "OM"}, - { "label": "Pakistan", "value": "PK"}, - { "label": "Palau", "value": "PW"}, - { "label": "Palestinian Territory, Occupied", "value": "PS"}, - { "label": "Panama", "value": "PA"}, - { "label": "Papua New Guinea", "value": "PG"}, - { "label": "Paraguay", "value": "PY"}, - { "label": "Peru", "value": "PE"}, - { "label": "Philippines", "value": "PH"}, - { "label": "Pitcairn", "value": "PN"}, - { "label": "Poland", "value": "PL"}, - { "label": "Portugal", "value": "PT"}, - { "label": "Puerto Rico", "value": "PR"}, - { "label": "Qatar", "value": "QA"}, - { "label": "Reunion", "value": "RE"}, - { "label": "Romania", "value": "RO"}, - { "label": "Russian Federation", "value": "RU"}, - { "label": "Rwanda", "value": "RW"}, - { "label": "Saint Helena", "value": "SH"}, - { "label": "Saint Kitts and Nevis", "value": "KN"}, - { "label": "Saint Lucia", "value": "LC"}, - { "label": "Saint Pierre and Miquelon", "value": "PM"}, - { "label": "Saint Vincent and the Grenadines", "value": "VC"}, - { "label": "Samoa", "value": "WS"}, - { "label": "San Marino", "value": "SM"}, - { "label": "Sao Tome and Principe", "value": "ST"}, - { "label": "Saudi Arabia", "value": "SA"}, - { "label": "Senegal", "value": "SN"}, - { "label": "Serbia", "value": "RS"}, - { "label": "Seychelles", "value": "SC"}, - { "label": "Sierra Leone", "value": "SL"}, - { "label": "Singapore", "value": "SG"}, - { "label": "Slovakia", "value": "SK"}, - { "label": "Slovenia", "value": "SI"}, - { "label": "Solomon Islands", "value": "SB"}, - { "label": "Somalia", "value": "SO"}, - { "label": "South Africa", "value": "ZA"}, - { "label": "S. Georgia & S. Sandwich Is.", "value": "GS"}, - { "label": "Spain", "value": "ES"}, - { "label": "Sri Lanka", "value": "LK"}, - { "label": "Sudan", "value": "SD"}, - { "label": "Suriname", "value": "SR"}, - { "label": "Svalbard & Jan Mayen Is.", "value": "SJ"}, - { "label": "Swaziland", "value": "SZ"}, - { "label": "Sweden", "value": "SE"}, - { "label": "Switzerland", "value": "CH"}, - { "label": "Syrian Arab Rep.", "value": "SY"}, - { "label": "Taiwan", "value": "TW"}, - { "label": "Tajikistan", "value": "TJ"}, - { "label": "Tanzania", "value": "TZ"}, - { "label": "Thailand", "value": "TH"}, - { "label": "Timor-Leste", "value": "TG"}, - { "label": "Togo", "value": "TG"}, - { "label": "Tokelau", "value": "TK"}, - { "label": "Tonga", "value": "TO"}, - { "label": "Trinidad and Tobago", "value": "TT"}, - { "label": "Tunisia", "value": "TN"}, - { "label": "Turkey", "value": "TR"}, - { "label": "Turkmenistan", "value": "TM"}, - { "label": "Turks and Caicos Islands", "value": "TC"}, - { "label": "Tuvalu", "value": "TU"}, - { "label": "Uganda", "value": "UG"}, - { "label": "Ukraine", "value": "UA"}, - { "label": "United Kingdom", "value": "GB"}, - { "label": "United Arab Emirates", "value": "AE"}, - { "label": "US Minor Outlying Is.", "value": "UM"}, - { "label": "Uruguay", "value": "UY"}, - { "label": "Uzbekistan", "value": "UZ"}, - { "label": "Vanuatu", "value": "VU"}, - { "label": "Vatican City State", "value": "VC"}, - { "label": "Venezuela", "value": "VE"}, - { "label": "Viet Nam", "value": "VN"}, - { "label": "Virgin Islands British", "value": "VG"}, - { "label": "Virgin Islands US", "value": "VI"}, - { "label": "Wallis and Futuna Islnds", "value": "WF"}, - { "label": "Western Sahara", "value": "EH"}, - { "label": "Yemen", "value": "YE"}, - { "label": "Yugoslavia", "value": "YU"}, - { "label": "Zambia", "value": "ZM"}, - { "label": "Zimbabwe", "value": "ZW"} - ]; - var _states = [ - { "label": "Alabama", "value": "AL", "country": "US" }, - { "label": "Alaska", "value": "AK", "country": "US" }, - { "label": "Arizona", "value": "AZ", "country": "US" }, - { "label": "Arkansas", "value": "AR", "country": "US" }, - { "label": "California", "value": "CA", "country": "US" }, - { "label": "Colorado", "value": "CO", "country": "US" }, - { "label": "Connecticut", "value": "CT", "country": "US" }, - { "label": "Delaware", "value": "DE", "country": "US" }, - { "label": "District of Columbia", "value": "DC", "country": "US" }, - { "label": "Florida", "value": "FL", "country": "US" }, - { "label": "Georgia", "value": "GA", "country": "US" }, - { "label": "Hawaii", "value": "HI", "country": "US" }, - { "label": "Idaho", "value": "ID", "country": "US" }, - { "label": "Illinois", "value": "IL", "country": "US" }, - { "label": "Indiana", "value": "IN", "country": "US" }, - { "label": "Iowa", "value": "IA", "country": "US" }, - { "label": "Kansas", "value": "KS", "country": "US" }, - { "label": "Kentucky", "value": "KY", "country": "US" }, - { "label": "Louisiana", "value": "LA", "country": "US" }, - { "label": "Maine", "value": "ME", "country": "US" }, - { "label": "Maryland", "value": "MD", "country": "US" }, - { "label": "Massachusetts", "value": "MA", "country": "US" }, - { "label": "Michigan", "value": "MI", "country": "US" }, - { "label": "Minnesota", "value": "MN", "country": "US" }, - { "label": "Mississippi", "value": "MS", "country": "US" }, - { "label": "Missouri", "value": "MO", "country": "US" }, - { "label": "Montana", "value": "MT", "country": "US" }, - { "label": "Nebraska", "value": "NE", "country": "US" }, - { "label": "Nevada", "value": "NV", "country": "US" }, - { "label": "New Hampshire", "value": "NH", "country": "US" }, - { "label": "New Jersey", "value": "NJ", "country": "US" }, - { "label": "New Mexico", "value": "NM", "country": "US" }, - { "label": "New York", "value": "NY", "country": "US" }, - { "label": "North Carolina", "value": "NC", "country": "US" }, - { "label": "North Dakota", "value": "ND", "country": "US" }, - { "label": "Ohio", "value": "OH", "country": "US" }, - { "label": "Oklahoma", "value": "OK", "country": "US" }, - { "label": "Oregon", "value": "OR", "country": "US" }, - { "label": "Pennsylvania", "value": "PA", "country": "US" }, - { "label": "Rhode Island", "value": "RI", "country": "US" }, - { "label": "South Carolina", "value": "SC", "country": "US" }, - { "label": "South Dakota", "value": "SD", "country": "US" }, - { "label": "Tennessee", "value": "TN", "country": "US" }, - { "label": "Texas", "value": "TX", "country": "US" }, - { "label": "Utah", "value": "UT", "country": "US" }, - { "label": "Vermont", "value": "VT", "country": "US" }, - { "label": "Virginia", "value": "VA", "country": "US" }, - { "label": "Washington", "value": "WA", "country": "US" }, - { "label": "West Virginia", "value": "WV", "country": "US" }, - { "label": "Wisconsin", "value": "WI", "country": "US" }, - { "label": "Wyoming", "value": "WY", "country": "US" }, - { "label": "Armed Forces Americas (AA)", "value": "AA", "country": "US" }, - { "label": "Armed Forces Africa/Canada/Europe/Middle East (AE)", "value": "AE", "country": "US" }, - { "label": "Armed Forces Pacific (AP)", "value": "AP", "country": "US" }, - { "label": "American Samoa", "value": "AS", "country": "US" }, - { "label": "Federated States of Micronesia", "value": "FM", "country": "US" }, - { "label": "Guam", "value": "GU", "country": "US" }, - { "label": "Marshall Islands", "value": "MH", "country": "US" }, - { "label": "Northern Mariana Islands", "value": "MP", "country": "US" }, - { "label": "Palau", "value": "PW", "country": "US" }, - { "label": "Puerto Rico", "value": "PR", "country": "US" }, - { "label": "Virgin Islands", "value": "VI", "country": "US" }, - { "label": "Drenthe", "value": "Drenthe", "country": "NL" }, - { "label": "Flevoland", "value": "Flevoland", "country": "NL" }, - { "label": "Friesland", "value": "Friesland", "country": "NL" }, - { "label": "Gelderland", "value": "Gelderland", "country": "NL" }, - { "label": "Groningen", "value": "Groningen", "country": "NL" }, - { "label": "Limburg", "value": "Limburg", "country": "NL" }, - { "label": "Noord-Brabant", "value": "Noord-Brabant", "country": "NL" }, - { "label": "Noord-Holland", "value": "Noord-Holland", "country": "NL" }, - { "label": "Overijssel", "value": "Overijssel", "country": "NL" }, - { "label": "Utrecht", "value": "Utrecht", "country": "NL" }, - { "label": "Zeeland", "value": "Zeeland", "country": "NL" }, - { "label": "Zuid-Holland", "value": "Zuid-Holland", "country": "NL" }, - { "label": "Alberta", "value": "AB", "country": "CA" }, - { "label": "British Columbia", "value": "BC", "country": "CA" }, - { "label": "Manitoba", "value": "MB", "country": "CA" }, - { "label": "New Brunswick", "value": "NB", "country": "CA" }, - { "label": "Newfoundland and Labrador", "value": "NL", "country": "CA" }, - { "label": "Northwest Territories", "value": "NT", "country": "CA" }, - { "label": "Nova Scotia", "value": "NS", "country": "CA" }, - { "label": "Nunavut", "value": "NU", "country": "CA" }, - { "label": "Ontario", "value": "ON", "country": "CA" }, - { "label": "Prince Edward Island", "value": "PE", "country": "CA" }, - { "label": "Quebec", "value": "QC", "country": "CA" }, - { "label": "Saskatchewan", "value": "SK", "country": "CA" }, - { "label": "Yukon", "value": "YT", "country": "CA" } - ]; - - return { - Countries: _countries, - States: _states - }; -} \ No newline at end of file diff --git a/src/app/common/helper-factories/assignment-helpers.js b/src/app/common/helper-factories/assignment-helpers.js deleted file mode 100644 index 388a17b8..00000000 --- a/src/app/common/helper-factories/assignment-helpers.js +++ /dev/null @@ -1,57 +0,0 @@ -angular.module('ordercloud-assignment-helpers', []) - .factory('Assignments', AssignmentHelpers) -; - -function AssignmentHelpers($q, $state, Underscore) { - return { - GetAssigned: _getAssigned, - GetSelected: _getSelected, - GetUnselected: _getUnselected, - GetToAssign: _getToAssign, - GetToDelete: _getToDelete, - SaveAssignments: _saveAssignments - }; - - function _getAssigned(AssignmentsArray, ID_Name) { - //TODO: Save this result in temp variable so I don't do this operation twice every time. - return Underscore.pluck(AssignmentsArray, ID_Name); - } - - function _getSelected(ListArray) { - return Underscore.pluck(Underscore.where(ListArray, {selected: true}), 'ID'); - } - - function _getUnselected(ListArray) { - return Underscore.pluck(Underscore.filter(ListArray, function(item) { - return !item.selected; - }), 'ID'); - } - - function _getToAssign(ListArray, AssignmentsArray, ID_Name) { - return Underscore.difference(_getSelected(ListArray), _getAssigned(AssignmentsArray, ID_Name)); - } - - function _getToDelete(ListArray, AssignmentsArray, ID_Name) { - return Underscore.intersection(_getUnselected(ListArray), _getAssigned(AssignmentsArray, ID_Name)); - } - - function _saveAssignments(ListArray, AssignmentsArray, SaveFunc, DeleteFunc, ID_Name) { - var id_name = ID_Name ? ID_Name : 'UserGroupID'; - var toAssign = _getToAssign(ListArray, AssignmentsArray, id_name); - var toDelete = _getToDelete(ListArray, AssignmentsArray, id_name); - var queue = []; - var dfd = $q.defer(); - angular.forEach(toAssign, function(ItemID) { - queue.push(SaveFunc(ItemID)); - }); - angular.forEach(toDelete, function(ItemID) { - queue.push(DeleteFunc(ItemID)); - }); - $q.all(queue).then(function() { - dfd.resolve(); - }).then(function() { - $state.reload($state.current); - }); - return dfd.promise; - } -} \ No newline at end of file diff --git a/src/app/common/helper-factories/paging-helpers.js b/src/app/common/helper-factories/paging-helpers.js deleted file mode 100644 index c5af7dfc..00000000 --- a/src/app/common/helper-factories/paging-helpers.js +++ /dev/null @@ -1,51 +0,0 @@ -angular.module('ordercloud-paging-helpers', ['ordercloud-assignment-helpers']) - .factory('Paging', PagingHelpers) -; - -function PagingHelpers($q, OrderCloud, Assignments) { - return { - SetSelected:_setSelected, - Paging: _paging - }; - - function _setSelected(ListArray, AssignmentsArray, ID_Name) { - if (!ListArray || !AssignmentsArray || !ID_Name) return; - var assigned = Assignments.GetAssigned(AssignmentsArray, ID_Name); - angular.forEach(ListArray, function(item) { - if (assigned.indexOf(item.ID) > -1) { - item.selected = true; - } - }); - } - - function _paging(ListObject, ServiceName, AssignmentObjects, AssignmentFunc) { - var Service = OrderCloud[ServiceName]; - if (Service && ListObject.Meta.Page < ListObject.Meta.TotalPages) { - var queue = []; - var dfd = $q.defer(); - if (ServiceName !== 'Orders' && ServiceName !== 'Categories') { - queue.push(Service.List(null, ListObject.Meta.Page + 1, ListObject.Meta.PageSize)); - } - if (ServiceName === 'Orders') { - queue.push(Service.ListIncoming(null, null, null, ListObject.Meta.Page + 1, ListObject.Meta.PageSize)); - } - if (ServiceName === 'Categories') { - queue.push(Service.List(null, 'all', ListObject.Meta.Page + 1, ListObject.Meta.PageSize)); - } - if (AssignmentFunc !== undefined && (AssignmentObjects.Meta.Page < AssignmentObjects.Meta.TotalPages)) { - queue.push(AssignmentFunc()); - } - $q.all(queue).then(function(results) { - dfd.resolve(); - ListObject.Meta = results[0].Meta; - ListObject.Items = [].concat(ListObject.Items, results[0].Items); - if (results[1]) { - AssignmentObjects.Meta = results[1].Meta; - AssignmentObjects.Items = [].concat(AssignmentObjects.Items, results[1].Items); - } - }); - return dfd.promise; - } - else return null; - } -} diff --git a/src/app/common/helper-factories/tests/assignment-helpers.spec.js b/src/app/common/helper-factories/tests/assignment-helpers.spec.js deleted file mode 100644 index c819b5d9..00000000 --- a/src/app/common/helper-factories/tests/assignment-helpers.spec.js +++ /dev/null @@ -1,66 +0,0 @@ -describe('Factory: Assignments', function() { - var q, - scope, - assignments, - sampleList; - beforeEach(module('orderCloud')); - beforeEach(module('orderCloud.sdk')); - beforeEach(module('ordercloud-assignment-helpers')); - beforeEach(inject(function($q, $rootScope, $state, Assignments) { - q = $q; - sampleList = [{ID: 1, selected: true}, {ID: 2, selected: false}, {ID: 3}]; - scope = $rootScope.$new(); - spyOn($state, 'reload').and.returnValue(true); - assignments = Assignments; - })); - it('getAssigned should return a list of IDs', function() { - var result = assignments.GetAssigned(sampleList, 'ID'); - expect(result).toEqual([1, 2, 3]); - }); - it('getSelected should return a list of IDs that also have selected set to true', function() { - var result = assignments.GetSelected(sampleList, 'ID'); - expect(result).toEqual([1]); - }); - it('getUnselected should return a list of IDs where selected is false or undefined', function() { - var result = assignments.GetUnselected(sampleList, 'ID'); - expect(result).toEqual([2, 3]); - }); - it('getToAssign should return a list of IDs that are different between the two lists', function() { - var result = assignments.GetToAssign(sampleList, [], 'ID'); - expect(result).toEqual([1]); - }); - it('getToDelete should return a list of IDs that are the same between the two lists', function() { - var result = assignments.GetToDelete(sampleList, [{ID: 2}], 'ID'); - expect(result).toEqual([2]); - }); - describe('saveAssignments', function() { - var state, - saveFunc, - deleteFunc, - saveCount, deleteCount; - beforeEach(inject(function($state) { - state = $state; - saveCount = deleteCount = 0; - saveFunc = function() { - saveCount++; - }; - deleteFunc = function() { - deleteCount++; - }; - assignments.SaveAssignments( - [{ID: 1, selected: true}, {ID: 2, selected: true}, {ID: 3, selected: false}, {ID: 4, selected: false}], - [{ID: 3}, {ID: 4}], - saveFunc, deleteFunc, 'ID'); - scope.$digest(); - })); - it('should call the saveFunc twice', function() { - expect(saveCount).toBe(2); - }); - it('should call the deleteFunc twice', function() { - expect(deleteCount).toBe(2); - }); - it('should call the state reload function on the current state', function() { - expect(state.reload).toHaveBeenCalledWith(state.current); - }); - }); -}); \ No newline at end of file diff --git a/src/app/common/helper-factories/tests/assignment-helpers.test.js b/src/app/common/helper-factories/tests/assignment-helpers.test.js deleted file mode 100644 index e69de29b..00000000 diff --git a/src/app/common/helper-factories/tests/paging-helpers.spec.js b/src/app/common/helper-factories/tests/paging-helpers.spec.js deleted file mode 100644 index 75690a96..00000000 --- a/src/app/common/helper-factories/tests/paging-helpers.spec.js +++ /dev/null @@ -1,75 +0,0 @@ -describe('Factory: Paging', function() { - var scope, - paging, - listArray, - assignmentsArray, - oc; - beforeEach(module('orderCloud')); - beforeEach(module('orderCloud.sdk')); - beforeEach(module('ordercloud-paging-helpers')); - beforeEach(inject(function($rootScope, Paging, OrderCloud) { - listArray = [{ID: 1}, {ID: 2}, {ID: 3}]; - assignmentsArray = [{ID: 2}, {ID: 3}]; - scope = $rootScope.$new(); - paging= Paging; - oc = OrderCloud; - })); - it('setSelected should create or update a selected property on the first array if it also exists in the second assignments array', function() { - paging.setSelected(listArray, assignmentsArray, 'ID'); - expect(listArray).toEqual([{ID: 1}, {ID: 2, selected: true}, {ID: 3, selected: true}]) - }); - describe('pagingFunction', function() { - var serviceName, service, - objectList, - objectAssignmentsList, - assignFunc; - beforeEach(function() { - serviceName = 'Products'; - objectList = { - Meta: { - Page: 1, - TotalPages: 2, - PageSize: 20 - }, - Items: listArray - }; - objectAssignmentsList = { - Meta: { - Page: 1, - TotalPages: 2, - PageSize: 20 - }, - Items: assignmentsArray - }; - assignFunc = function() { - return service.ListAssignments(); - }; - service = oc[serviceName]; - spyOn(service, 'List').and.returnValue(objectList); - spyOn(service, 'ListAssignments').and.returnValue(objectAssignmentsList); - }); - it('should call the List method of the service passed in if page is less than total pages', function() { - paging.paging(objectList, serviceName); - scope.$digest(); - expect(service.List).toHaveBeenCalledWith(null, objectList.Meta.Page + 1, objectList.Meta.PageSize) - }); - it('should not call the List method of the service if pages is greater than or equal to total pages', function() { - objectList.Meta.Page = 2; - paging.paging(objectList, serviceName); - scope.$digest(); - expect(service.List).not.toHaveBeenCalledWith(null, objectList.Meta.Page + 1, objectList.Meta.PageSize) - }); - - it('should call the ListAssignments method of the service passed in if page is less than total pages', function() { - paging.paging(objectList, serviceName, objectAssignmentsList, assignFunc); - scope.$digest(); - expect(service.ListAssignments).toHaveBeenCalled() - }); - it('should not call the List method of the service if pages is greater than or equal to total pages', function() { - objectAssignmentsList.Meta.Page = 2; - paging.paging(objectList, serviceName, objectAssignmentsList, assignFunc); - scope.$digest(); - expect(service.ListAssignments).not.toHaveBeenCalled() - }); - }); -}); \ No newline at end of file diff --git a/src/app/common/helper-factories/tests/paging-helpers.test.js b/src/app/common/helper-factories/tests/paging-helpers.test.js deleted file mode 100644 index e69de29b..00000000 diff --git a/src/app/common/infinite-scroll/infinite-scroll.js b/src/app/common/infinite-scroll/infinite-scroll.js deleted file mode 100644 index 54bbef26..00000000 --- a/src/app/common/infinite-scroll/infinite-scroll.js +++ /dev/null @@ -1,51 +0,0 @@ -angular.module('ordercloud-infinite-scroll', ['ordercloud-search', 'ordercloud-paging-helpers']); - -angular.module('ordercloud-infinite-scroll') - .directive('ordercloudInfiniteScroll', InfiniteScrollDirective) - .controller('InfiniteScrollCtrl', InfiniteScrollController) -; - -function InfiniteScrollDirective(Paging) { - return { - restrict: 'A', - scope: { - servicename: '@', - controlleras: '=', - idname: '@', - threshold: '@' - }, - controller: 'InfiniteScrollCtrl', - controllerAs: 'InfiniteScroll', - link: function(scope, element) { - var threshold = scope.threshold || 0; - var ele = element[0]; - element.bind('scroll', function () { - if (ele.scrollTop + ele.offsetHeight + threshold >= ele.scrollHeight) { - if (scope.controlleras && scope.controlleras.pagingfunction !== undefined) { - scope.controlleras.pagingfunction(); - } - else if (scope.servicename && scope.controlleras && scope.controlleras.list) { - Paging.Paging(scope.controlleras.list, scope.servicename); - } - /* Else display a console error */ - else { - console.log('Error: Infinite scroll directive not fully defined.'); - } - } - }); - } - } -} - -function InfiniteScrollController($scope, Paging, TrackSearch) { - TrackSearch.SetTerm(null); - $scope.$watchCollection(function() { - if ($scope.controlleras && $scope.controlleras.assignments) { - return $scope.controlleras.assignments; - } - }, function() { - if ($scope.controlleras && $scope.controlleras.assignments && $scope.controlleras.list && $scope.idname) { - Paging.SetSelected($scope.controlleras.list.Items, $scope.controlleras.assignments.Items, $scope.idname); - } - }); -} diff --git a/src/app/common/infinite-scroll/tests/infinite-scroll.spec.js b/src/app/common/infinite-scroll/tests/infinite-scroll.spec.js deleted file mode 100644 index 1b9b61ad..00000000 --- a/src/app/common/infinite-scroll/tests/infinite-scroll.spec.js +++ /dev/null @@ -1,33 +0,0 @@ -describe('Component: Infinite Scroll', function() { - var scope; - beforeEach(module('orderCloud')); - beforeEach(module('orderCloud.sdk')); - beforeEach(module('ordercloud-infinite-scroll')) - beforeEach(inject(function($rootScope) { - scope = $rootScope.$new(); - })); - describe('Directive: ordercloudInfiniteScroll', function() { - var element; - beforeEach(inject(function($compile, Paging) { - scope.ctrl = {}; - element = $compile('
')(scope); - spyOn(Paging, 'paging').and.returnValue(true); - })); - it ('should initialize the directive', function() { - expect(element.isolateScope().controlleras).toEqual({}); - expect(element.isolateScope().servicename).toBe('Products'); - }); - }); - describe('Controller: InfiniteScrollCtrl', function() { - var infiniteScrollCtrl; - beforeEach(inject(function($controller, TrackSearch) { - spyOn(TrackSearch, 'SetTerm').and.callThrough(); - infiniteScrollCtrl = $controller('InfiniteScrollCtrl', { - $scope: scope - }); - })); - it('should initialize the search term to null', inject(function(TrackSearch) { - expect(TrackSearch.SetTerm).toHaveBeenCalledWith(null); - })); - }); -}); \ No newline at end of file diff --git a/src/app/common/infinite-scroll/tests/infinite-scroll.test.js b/src/app/common/infinite-scroll/tests/infinite-scroll.test.js deleted file mode 100644 index e69de29b..00000000 diff --git a/src/app/common/lineitems/less/lineitems.less b/src/app/common/lineitems/less/lineitems.less deleted file mode 100644 index 0212a303..00000000 --- a/src/app/common/lineitems/less/lineitems.less +++ /dev/null @@ -1,3 +0,0 @@ -.modal_buttons { - margin-bottom: 50px; -} \ No newline at end of file diff --git a/src/app/common/lineitems/lineitems.js b/src/app/common/lineitems/lineitems.js deleted file mode 100644 index aba9cabd..00000000 --- a/src/app/common/lineitems/lineitems.js +++ /dev/null @@ -1,154 +0,0 @@ -angular.module('ordercloud-lineitems', []) - .factory('LineItemHelpers', LineItemFactory) - .controller('LineItemModalCtrl', LineItemModalController) -; - -function LineItemFactory($rootScope, $q, $state, $uibModal, Underscore, OrderCloud, CurrentOrder) { - return { - SpecConvert: _specConvert, - RemoveItem: _removeItem, - UpdateQuantity: _updateQuantity, - GetProductInfo: _getProductInfo, - CustomShipping: _customShipping, - UpdateShipping: _updateShipping, - ListAll: _listAll - }; - - function _specConvert(specs) { - var results = []; - angular.forEach(specs, function (spec) { - var spec_to_push = {SpecID: spec.ID}; - if (spec.Options.length > 0) { - if (spec.DefaultOptionID) { - spec_to_push.OptionID = spec.DefaultOptionID; - } - if (spec.OptionID) { - spec_to_push.OptionID = spec.OptionID; - } - if (spec.Value) { - spec_to_push.Value = spec.Value; - } - } - else { - spec_to_push.Value = spec.Value || spec.DefaultValue || null; - } - results.push(spec_to_push); - }); - return results; - } - - function _removeItem(Order, LineItem) { - OrderCloud.LineItems.Delete(Order.ID, LineItem.ID) - .then(function () { - // If all line items are removed delete the order. - OrderCloud.LineItems.List(Order.ID) - .then(function (data) { - if (!data.Items.length) { - CurrentOrder.Remove(); - OrderCloud.Orders.Delete(Order.ID).then(function () { - $state.reload(); - $rootScope.$broadcast('OC:RemoveOrder'); - }); - } - else { - $state.reload(); - } - }); - }); - } - - function _updateQuantity(Order, LineItem) { - if (LineItem.Quantity > 0) { - OrderCloud.LineItems.Patch(Order.ID, LineItem.ID, {Quantity: LineItem.Quantity}) - .then(function () { - $rootScope.$broadcast('OC:UpdateOrder', Order.ID); - $rootScope.$broadcast('OC:UpdateLineItem',Order); - }); - } - } - - function _getProductInfo(LineItems) { - var li = LineItems.Items || LineItems; - var productIDs = Underscore.uniq(Underscore.pluck(li, 'ProductID')); - var dfd = $q.defer(); - var queue = []; - angular.forEach(productIDs, function (productid) { - queue.push(OrderCloud.Me.GetProduct(productid)); - }); - $q.all(queue) - .then(function (results) { - angular.forEach(li, function (item) { - item.Product = angular.copy(Underscore.where(results, {ID: item.ProductID})[0]); - }); - dfd.resolve(li); - }); - return dfd.promise; - } - - function _customShipping(Order, LineItem) { - var modalInstance = $uibModal.open({ - animation: true, - templateUrl: 'common/lineitems/templates/shipping.tpl.html', - controller: 'LineItemModalCtrl', - controllerAs: 'liModal', - size: 'lg' - }); - - modalInstance.result - .then(function (address) { - address.ID = Math.floor(Math.random() * 1000000).toString(); - OrderCloud.LineItems.SetShippingAddress(Order.ID, LineItem.ID, address) - .then(function () { - $rootScope.$broadcast('LineItemAddressUpdated', LineItem.ID, address); - }); - }); - } - - function _updateShipping(Order, LineItem, AddressID) { - OrderCloud.Addresses.Get(AddressID) - .then(function (address) { - OrderCloud.LineItems.SetShippingAddress(Order.ID, LineItem.ID, address); - $rootScope.$broadcast('LineItemAddressUpdated', LineItem.ID, address); - }); - } - - function _listAll(orderID) { - var li; - var dfd = $q.defer(); - var queue = []; - OrderCloud.LineItems.List(orderID, null, 1, 100) - .then(function (data) { - li = data; - if (data.Meta.TotalPages > data.Meta.Page) { - var page = data.Meta.Page; - while (page < data.Meta.TotalPages) { - page += 1; - queue.push(OrderCloud.LineItems.List(orderID, null, page, 100)); - } - } - $q.all(queue) - .then(function (results) { - angular.forEach(results, function (result) { - li.Items = [].concat(li.Items, result.Items); - li.Meta = result.Meta; - }); - dfd.resolve(li.Items); - }); - }); - return dfd.promise; - } -} - -function LineItemModalController($uibModalInstance) { - var vm = this; - vm.address = {}; - - vm.submit = function () { - $uibModalInstance.close(vm.address); - }; - - vm.cancel = function () { - vm.address = {}; - $uibModalInstance.dismiss('cancel'); - }; -} diff --git a/src/app/common/lineitems/templates/shipping.tpl.html b/src/app/common/lineitems/templates/shipping.tpl.html deleted file mode 100644 index 2c155a49..00000000 --- a/src/app/common/lineitems/templates/shipping.tpl.html +++ /dev/null @@ -1,11 +0,0 @@ - \ No newline at end of file diff --git a/src/app/common/loading-indicators/less/loading-indicators.less b/src/app/common/loading-indicators/less/loading-indicators.less deleted file mode 100644 index 1ee003d6..00000000 --- a/src/app/common/loading-indicators/less/loading-indicators.less +++ /dev/null @@ -1,65 +0,0 @@ -.cg-busy-backdrop { - background-color:@body-bg; -} - -.indicator-container { //fade the indicator in and out - position:absolute; - left:0; right:0; top:0; bottom:0; - z-index:1001; - &.ng-hide-add, - &.ng-hide-remove { - transition:all .3s ease; - display: block !important; - } - &.ng-hide-remove, - &.ng-hide-add.ng-hide-add-active { - opacity:0; - } - &.ng-hide-add-active, - &.ng-hide-remove.ng-hide-remove-active { - opacity:1; - } -} - -.indicator { - display:flex; - flex-flow:column nowrap; - align-items:center; - justify-content:center; - position:absolute; - left:0; right:0; top:0; bottom:0; - .animation { - .dot { - display:inline-block; - margin:0 2px; - width: 15px; - height: 15px; - background-color:@brand-primary; - border-radius: 2px; - animation-name:indicator-fade-in-out; - animation-iteration-count: infinite; - animation-duration:500ms; - &:nth-of-type(2) { - animation-delay:100ms; - } - &:nth-of-type(3) { - animation-delay:200ms; - } - } - } - .message { - margin-top:15px; - } -} - -@keyframes indicator-fade-in-out { - 0% { - opacity:1; - } - 50% { - opacity:0.2; - } - 100% { - opacity:1; - } -} \ No newline at end of file diff --git a/src/app/common/loading-indicators/templates/view.loading.tpl.html b/src/app/common/loading-indicators/templates/view.loading.tpl.html deleted file mode 100644 index 9203bf46..00000000 --- a/src/app/common/loading-indicators/templates/view.loading.tpl.html +++ /dev/null @@ -1,9 +0,0 @@ -
-
-
-
-
-
-
-
- diff --git a/src/app/common/localforage/localforage.config.js b/src/app/common/localforage/localforage.config.js deleted file mode 100644 index 1f49ed07..00000000 --- a/src/app/common/localforage/localforage.config.js +++ /dev/null @@ -1,12 +0,0 @@ -angular.module('orderCloud') - .config(LocalForage) -; - -function LocalForage($localForageProvider) { - $localForageProvider.config({ - version: 1.0, - name: 'OrderCloud', - storeName: 'four51', - description: 'Four51 OrderCloud Local Storage' - }); -} \ No newline at end of file diff --git a/src/app/common/media/ordercloud.media.js b/src/app/common/media/ordercloud.media.js deleted file mode 100644 index bbc61292..00000000 --- a/src/app/common/media/ordercloud.media.js +++ /dev/null @@ -1,122 +0,0 @@ -angular.module('orderCloud') - .factory('$ocMedia', ocMediaFactory) - .constant('MEDIA', MEDIA_CONSTANT) - .constant('MEDIA_PRIORITY', MEDIA_PRIORITY_CONSTANT) -; - -function MEDIA_CONSTANT() { - return { - 'sm': '(max-width: 600px)', - 'gt-sm': '(min-width: 600px)', - 'md': '(min-width: 600px) and (max-width: 960px)', - 'gt-md': '(min-width: 960px)', - 'lg': '(min-width: 960px) and (max-width: 1200px)', - 'gt-lg': '(min-width: 1200px)' - } -} - -function MEDIA_PRIORITY_CONSTANT() { - return [ - 'gt-lg', - 'lg', - 'gt-md', - 'md', - 'gt-sm', - 'sm' - ]; -} - -function ocMediaFactory(MEDIA, MEDIA_PRIORITY, $rootScope, $window) { - var queries = {}; - var mqls = {}; - var results = {}; - var normalizeCache = {}; - - $ocMedia.getResponsiveAttribute = getResponsiveAttribute; - $ocMedia.getQuery = getQuery; - $ocMedia.watchResponsiveAttributes = watchResponsiveAttributes; - - return $ocMedia; - - function $ocMedia(query) { - var validated = queries[query]; - if (angular.isUndefined(validated)) { - validated = queries[query] = validate(query); - } - - var result = results[validated]; - if (angular.isUndefined(result)) { - result = add(validated); - } - - return result; - } - - function validate(query) { - return MEDIA[query] || - ((query.charAt(0) !== '(') ? ('(' + query + ')') : query); - } - - function add(query) { - var result = mqls[query] = $window.matchMedia(query); - result.addListener(onQueryChange); - return (results[result.media] = !!result.matches); - } - - function onQueryChange(query) { - $rootScope.$evalAsync(function() { - results[query.media] = !!query.matches; - }); - } - - function getQuery(name) { - return mqls[name]; - } - - function getResponsiveAttribute(attrs, attrName) { - for (var i = 0; i < MEDIA_PRIORITY.length; i++) { - var mediaName = MEDIA_PRIORITY[i]; - if (!mqls[queries[mediaName]].matches) { - continue; - } - - var normalizedName = getNormalizedName(attrs, attrName + '-' + mediaName); - if (attrs[normalizedName]) { - return attrs[normalizedName]; - } - } - - // fallback on unprefixed - return attrs[getNormalizedName(attrs, attrName)]; - } - - function watchResponsiveAttributes(attrNames, attrs, watchFn) { - var unwatchFns = []; - attrNames.forEach(function(attrName) { - var normalizedName = getNormalizedName(attrs, attrName); - if (attrs[normalizedName]) { - unwatchFns.push( - attrs.$observe(normalizedName, angular.bind(void 0, watchFn, null))); - } - - for (var mediaName in MEDIA) { - normalizedName = getNormalizedName(attrs, attrName + '-' + mediaName); - if (!attrs[normalizedName]) { - return; - } - - unwatchFns.push(attrs.$observe(normalizedName, angular.bind(void 0, watchFn, mediaName))); - } - }); - - return function unwatch() { - unwatchFns.forEach(function(fn) { fn(); }) - }; - } - - // Improves performance dramatically - function getNormalizedName(attrs, attrName) { - return normalizeCache[attrName] || - (normalizeCache[attrName] = attrs.$normalize(attrName)); - } -} diff --git a/src/app/common/ordercloud-logo/ordercloud_logo.js b/src/app/common/ordercloud-logo/ordercloud_logo.js deleted file mode 100644 index da775284..00000000 --- a/src/app/common/ordercloud-logo/ordercloud_logo.js +++ /dev/null @@ -1,18 +0,0 @@ -angular.module('orderCloud') - .directive('ordercloudLogo', ordercloudLogo) -; - -function ordercloudLogo() { - return { - templateUrl: 'common/ordercloud-logo/templates/ordercloud-logo.tpl.html', - replace:true, - link: function(scope, element, attrs) { - scope.OrderCloudLogo = { - 'Icon': attrs.icon ? true : false, - 'maxHeight':attrs.height, - 'fillColor': attrs.color, - 'width': attrs.width - }; - } - }; -} \ No newline at end of file diff --git a/src/app/common/ordercloud-logo/templates/ordercloud-logo.tpl.html b/src/app/common/ordercloud-logo/templates/ordercloud-logo.tpl.html deleted file mode 100644 index 475605f0..00000000 --- a/src/app/common/ordercloud-logo/templates/ordercloud-logo.tpl.html +++ /dev/null @@ -1,133 +0,0 @@ -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/src/app/common/ordercloud-logo/tests/ordercloud-logo.test.js b/src/app/common/ordercloud-logo/tests/ordercloud-logo.test.js deleted file mode 100644 index e69de29b..00000000 diff --git a/src/app/common/ordercloud-logo/tests/ordercloud_logo.spec.js b/src/app/common/ordercloud-logo/tests/ordercloud_logo.spec.js deleted file mode 100644 index 3f0313b2..00000000 --- a/src/app/common/ordercloud-logo/tests/ordercloud_logo.spec.js +++ /dev/null @@ -1,28 +0,0 @@ -describe('Directive: ordercloudLogo', function() { - var scope, - element, - blank_element; - beforeEach(module('orderCloud')); - beforeEach(module('orderCloud.sdk')); - beforeEach(inject(function($rootScope) { - scope = $rootScope.$new(); - })); - it ('should initialize all values passed in as attributes', inject(function($compile) { - element = $compile('')(scope); - scope.$digest(); - expect(element.scope().OrderCloudLogo).not.toBe(undefined); - expect(element.scope().OrderCloudLogo.Icon).toBe(true); - expect(element.scope().OrderCloudLogo.maxHeight).toBe('30'); - expect(element.scope().OrderCloudLogo.width).toBe('31'); - expect(element.scope().OrderCloudLogo.fillColor).toBe('blue'); - })); - it ('should set logo to false if not passed in and all other values to undefined', inject(function($compile) { - blank_element = $compile('')(scope); - scope.$digest(); - expect(blank_element.scope().OrderCloudLogo).not.toBe(undefined); - expect(blank_element.scope().OrderCloudLogo.Icon).toBe(false); - expect(blank_element.scope().OrderCloudLogo.maxHeight).toBe(undefined); - expect(blank_element.scope().OrderCloudLogo.width).toBe(undefined); - expect(blank_element.scope().OrderCloudLogo.fillColor).toBe(undefined); - })); -}); \ No newline at end of file diff --git a/src/app/common/ordercloud-parameters/ordercloud-parameters.js b/src/app/common/ordercloud-parameters/ordercloud-parameters.js deleted file mode 100644 index 2ab2aa44..00000000 --- a/src/app/common/ordercloud-parameters/ordercloud-parameters.js +++ /dev/null @@ -1,49 +0,0 @@ -angular.module('orderCloud') - .factory('OrderCloudParameters', OrderCloudParametersService) -; - -function OrderCloudParametersService() { - var service = { - Get: _get, //get params for use in OrderCloud service - Create: _create //create params obj ready for use in OrderCloud $state.go() - }; - - function _get(stateParams, suffix) { - var parameters = angular.copy(stateParams); - var suffixParams; - parameters.filters = parameters.filters ? JSON.parse(parameters.filters) : null; - parameters.from ? parameters.from = new Date(parameters.from) : angular.noop(); //Translate date string to date obj - parameters.to ? parameters.to = new Date(parameters.to) : angular.noop(); //Translate date string to date obj - if (suffix) { - suffixParams = {}; - angular.forEach(parameters, function(val, key) { - suffixParams[key.split(suffix)[0]] = val; - }); - } - return suffixParams || parameters; - } - - function _create(params, resetPage, suffix) { - var parameters = angular.copy(params); - var suffixParams; - resetPage ? parameters.page = null : angular.noop(); //Reset page when filters are applied - if (parameters.filters) { - parameters.filters.orderType == '' ? delete parameters.filters.orderType : angular.noop(); - parameters.filters.type == '' ? delete parameters.filters.type : angular.noop(); - parameters.filters.status == '' ? delete parameters.filters.status : angular.noop(); - parameters.filters = JSON.stringify(parameters.filters); //Translate filter object to string - parameters.filters == '{}' ? parameters.filters = null : angular.noop(); //Null out the filter string if it's an empty obj - } - parameters.from ? parameters.from = parameters.from.toISOString() : angular.noop(); - parameters.to ? parameters.to = parameters.to.toISOString() : angular.noop(); - if (suffix) { - suffixParams = {}; - angular.forEach(parameters, function(val, key) { - suffixParams[key + suffix] = val; - }); - } - return suffixParams || parameters; - } - - return service; -} \ No newline at end of file diff --git a/src/app/common/search/search.js b/src/app/common/search/search.js deleted file mode 100644 index 9c065867..00000000 --- a/src/app/common/search/search.js +++ /dev/null @@ -1,135 +0,0 @@ -angular.module('ordercloud-search', []); - -angular.module('ordercloud-search') - .directive('ordercloudSearch', OrdercloudSearch) - .controller('ordercloudSearchCtrl', OrdercloudSearchController) - .factory('TrackSearch', TrackSearchService ) -; - -function OrdercloudSearch () { - return { - scope: { - placeholder: '@', - servicename: '@', - controlleras: '=', - model:'@' - }, - restrict: 'E', - templateUrl: 'common/search/templates/search.tpl.html', - controller: 'ordercloudSearchCtrl', - controllerAs: 'ocSearch', - replace: true - } -} - -function OrdercloudSearchController($timeout, $scope, OrderCloud, TrackSearch) { - $scope.searchTerm = null; - if ($scope.servicename) { - var var_name = $scope.servicename.replace(/([a-z])([A-Z])/g, '$1 $2'); - $scope.placeholder = "Search " + var_name + '...'; - var Service = OrderCloud[$scope.servicename]; - } - var searching; - $scope.$watch('searchTerm', function(n,o) { - if (n == o) { - if (searching) $timeout.cancel(searching); - } else { - if (searching) $timeout.cancel(searching); - searching = $timeout(function() { - n == '' ? n = null : angular.noop(); - TrackSearch.SetTerm(n); - if($scope.servicename === 'Orders') { - if (!$scope.controlleras.searchfunction) { - Service.ListIncoming(null, null, n) - .then(function (data){ - $scope.model ? $scope.controlleras[$scope.model] = data : $scope.controlleras.list = data; - }); - } - else { - $scope.controlleras.searchfunction($scope.searchTerm) - .then(function (data){ - $scope.model ? $scope.controlleras[$scope.model] = data : $scope.controlleras.list = data; - }); - } - } - else if ($scope.servicename === 'SpendingAccounts') { - if (!$scope.controlleras.searchfunction) { - Service.List(n, null, null, null, null, {'RedemptionCode': '!*'}) - .then(function (data){ - $scope.model ? $scope.controlleras[$scope.model] = data : $scope.controlleras.list = data; - }); - } - else { - $scope.controlleras.searchfunction($scope.searchTerm) - .then(function (data){ - $scope.model ? $scope.controlleras[$scope.model] = data : $scope.controlleras.list = data; - }); - } - } - else if ($scope.servicename === 'Users') { - if (!$scope.controlleras.searchfunction) { - Service.List(null, n) - .then(function (data){ - $scope.model ? $scope.controlleras[$scope.model] = data : $scope.controlleras.list = data; - }); - } - else { - $scope.controlleras.searchfunction($scope.searchTerm) - .then(function (data){ - $scope.model ? $scope.controlleras[$scope.model] = data : $scope.controlleras.list = data; - }); - } - } - else if ($scope.servicename === 'Shipments') { - if (!$scope.controlleras.searchfunction) { - Service.List(null, n, null, null) - .then(function (data) { - $scope.model ? $scope.controlleras[$scope.model] = data : $scope.controlleras.list = data; - }); - } - else { - $scope.controlleras.searchfunction($scope.searchTerm) - .then(function (data){ - $scope.model ? $scope.controlleras[$scope.model] = data : $scope.controlleras.list = data; - }); - } - } - else { - if (!$scope.controlleras.searchfunction) { - Service.List(n) - .then(function (data){ - $scope.model ? $scope.controlleras[$scope.model] = data : $scope.controlleras.list = data; - }); - } - else { - $scope.controlleras.searchfunction($scope.searchTerm) - .then(function (data){ - $scope.model ? $scope.controlleras[$scope.model] = data : $scope.controlleras.list = data; - }); - } - } - - }, 300); - } - }); -} - -function TrackSearchService() { - var service = { - SetTerm: _setTerm, - GetTerm: _getTerm - }; - - var term = null; - - function _setTerm(value) { - term = value; - } - - function _getTerm() { - return term; - } - - return service; -} - diff --git a/src/app/common/search/templates/search.tpl.html b/src/app/common/search/templates/search.tpl.html deleted file mode 100644 index 8d471449..00000000 --- a/src/app/common/search/templates/search.tpl.html +++ /dev/null @@ -1,5 +0,0 @@ -
-
- -
-
\ No newline at end of file diff --git a/src/app/common/search/tests/search.spec.js b/src/app/common/search/tests/search.spec.js deleted file mode 100644 index c5b9ff5d..00000000 --- a/src/app/common/search/tests/search.spec.js +++ /dev/null @@ -1,58 +0,0 @@ -describe('Component: Search', function() { - var scope; - beforeEach(module('orderCloud')); - beforeEach(module('orderCloud.sdk')); - beforeEach(module('ordercloud-search')); - beforeEach(inject(function($rootScope) { - scope = $rootScope.$new(); - })); - describe('Directive: ordercloudSearch', function() { - var element; - beforeEach(inject(function($compile) { - scope.ctrl = { - searchTerm: '' - }; - element = $compile('')(scope); - scope.$digest(); - })); - it('should initialize the isolate scope', function() { - expect(element.isolateScope().servicename).toBe('Products'); - expect(element.isolateScope().controlleras).toEqual({searchTerm: ''}); - }); - }); - describe('Controller: ordercloudSearchCtrl', function() { - var searchCtrl; - beforeEach(inject(function($controller) { - scope.servicename = 'Products'; - spyOn(scope, '$watch').and.callThrough(); - searchCtrl = $controller('ordercloudSearchCtrl', { - $scope: scope - }); - scope.$digest(); - })); - it('should initialize the placeholder for the search', function() { - expect(scope.placeholder).toBe('Search Products...') - }); - it('should initialize the search term to null', function() { - expect(scope.searchTerm).toBe(null); - }); - it('should trigger the watch function when searchTerm is changed', function() { - scope.searchTerm = 'potato'; - scope.$digest(); - expect(scope.$watch).toHaveBeenCalled(); - }); - }); - describe('Factory: TrackSearch', function() { - var trackSearch; - beforeEach(inject(function(TrackSearch) { - trackSearch = TrackSearch; - })); - it('should initialize term to null', function() { - expect(trackSearch.GetTerm()).toBe(null); - }); - it('SetTerm should change the value of term', function() { - trackSearch.SetTerm('testing'); - expect(trackSearch.GetTerm()).toBe('testing'); - }); - }); -}); \ No newline at end of file diff --git a/src/app/common/search/tests/search.test.js b/src/app/common/search/tests/search.test.js deleted file mode 100644 index e69de29b..00000000 diff --git a/src/app/common/token-refresh/token-refresh.js b/src/app/common/token-refresh/token-refresh.js deleted file mode 100644 index 8244ee5e..00000000 --- a/src/app/common/token-refresh/token-refresh.js +++ /dev/null @@ -1,51 +0,0 @@ -angular.module('orderCloud') - .factory('TokenRefresh', TokenRefresh) -; - -function TokenRefresh($resource, $localForage, $injector, clientid, appname, authurl) { - var service = { - Set: _set, - Get: _get, - SetToken: _setToken, - GetToken: _getToken, - Refresh: _refresh, - RemoveToken: _removeToken - }; - var remember; - var scope = $injector.has('scope') ? $injector.get('scope') : null; - var ocscope = $injector.has('ocscope') ? $injector.get('ocscope') : null; - - return service; - //// - - function _set(value) { - remember = value; - } - - function _get() { - return remember; - } - - function _setToken(token) { - return $localForage.setItem(appname + '.refresh_token', token); - } - - function _getToken() { - return $localForage.getItem(appname + '.refresh_token'); - } - - function _removeToken(){ - $localForage.removeItem(appname + '.refresh_token'); - } - - function _refresh(token) { - var data = $.param({ - grant_type: 'refresh_token', - scope: scope ? scope : ocscope, - client_id: clientid, - refresh_token: token - }); - return $resource(authurl, {}, {refresh: {method: 'POST'}}).refresh(data).$promise; - } - -} \ No newline at end of file diff --git a/src/app/common/underscore/underscore.factory.js b/src/app/common/underscore/underscore.factory.js deleted file mode 100644 index ce517190..00000000 --- a/src/app/common/underscore/underscore.factory.js +++ /dev/null @@ -1,7 +0,0 @@ -angular.module('orderCloud') - .factory('Underscore', UnderscoreFactory) -; - -function UnderscoreFactory($window) { - return $window._; -} \ No newline at end of file diff --git a/src/app/global.less b/src/app/global.less deleted file mode 100644 index 1e2cb146..00000000 --- a/src/app/global.less +++ /dev/null @@ -1,290 +0,0 @@ -html { - height:100vh; - width:100vw; - max-width:@app-container-size; - margin:0 auto; - overflow:hidden; - background-color:@html-bg; -} - -body { - height:100%; - width:100%; - overflow:hidden; - position:relative; -} - -main { - flex:1 1 auto; - overflow:hidden; - position:relative; - > [id^="COMPONENT_"] { //Make the component container element fill the entire
for background styles - position:absolute; - left:0; - right:0; - bottom:0; - top:0; - overflow-y:auto; - overflow-x:hidden; - padding-bottom:25px; - } -} - -[ui-sref], -[ng-click]{ - cursor: pointer; -} - -.container { - max-width:100%; -} - -.pagination { - margin:0; -} - -//TABLES WITH FIXED HEADERS -.table-fixed-header { - position:relative; - padding-top:@table-header-height; - margin-bottom:@line-height-computed; - overflow:hidden; - .table-header-bg { - position:absolute; - left:0; right:0; top:0; - height:@table-header-height; - background:@table-bg; - border:1px solid @table-border-color; - border-bottom-width:2px; - } - .table-container { - background-color:@table-bg; - overflow-y:auto; - overflow-x:hidden; - max-height:@infinite-scroll-size; - border: 1px solid @table-border-color; - border-top-width:0; - table { - border-spacing:0; - margin-bottom:0; - } - td { - border:1px solid @table-border-color; - vertical-align:middle; - &:first-child { - border-left:none; - } - &:last-child { - border-left:none; - } - } - th { - height: 0; - line-height: 0; - padding: 0 25px; - color: transparent; - border: none; - white-space: nowrap; - span { - max-height:0; - height:0; - line-height:0; - margin:0; - padding:0; - } - div{ - position: absolute; - background: transparent; - padding:@table-cell-padding; - color: @text-color; - top: 0; - margin-left: -25px; - line-height: @line-height-base; - vertical-align: bottom; - border-left:1px solid @table-border-color; - } - &:first-child div{ - border: none; - } - } - tbody tr { - &:first-child { - td { - border-top:none; - } - } - &:last-child { - td { - border-bottom:none; - } - } - } - } -} -colgroup { - > col { - .action-column { - width:70px; - } - } -} - -.table > tbody > tr { - > td { - &.actions-cell { - text-align:center; - white-space: nowrap; - @media(min-width:@screen-sm-min) { - text-align: right; - width: 1%; - } - } - } -} - -// No matches message -.no-matches { - @media(min-width:@screen-sm-min) { - margin-top:15px; - } - &:extend(.well); - text-align:center; -} - -// OC Responsive Tables -// commandeered from http://codepen.io/pixelchar/pen/rfuqK -.oc-table-responsive { - &.table-bordered { - border:none; - & > tbody > tr{ - & > th { - border:none; - } - & > td { - border-width:1px 0 0 0; - } - } - } - - > thead, - > tbody, - > tfoot { - > tr { - > th, - > td { - vertical-align: middle; - } - } - } - - thead { - // Accessibly hide on narrow viewports - position: absolute; - clip: rect(1px 1px 1px 1px); /* IE6, IE7 */ - clip: rect(1px, 1px, 1px, 1px); - padding: 0; - border: 0; - height: 1px; - width: 1px; - overflow: hidden; - } - - // Set these items to display: block for narrow viewports - tbody, - tr, - th, - td { - display: block; - white-space: normal; - } - - tr { - &:extend(.panel); //Mobile table row looks like a bootstrap panel - border-color: @panel-default-border; - overflow:hidden; - } - - tbody { - & > tr > th { - border-top: none; - background-color: @panel-default-heading-bg; - } - td { - &[data-title] { - .clearfix(); //Clearfix solution for empty table cells on mobile - &:before { - content: attr(data-title); - float: left; - color: @gray-light; - } - } - @media(max-width:@screen-sm-min) { - text-align:right; - } - } - } - - @media(min-width:@screen-sm-min) { - // Condensed tables on desktop - > thead, - > tbody, - > tfoot { - > tr { - > th, - > td { - padding: @table-condensed-cell-padding; - } - } - } - &.table-bordered { - border:1px solid @table-border-color; - & > tbody > tr{ - & > th { - border:1px solid @table-border-color; - } - & > td { - border-width:1px; - } - } - } - thead { - position: relative; - clip: auto; - height: auto; - width: auto; - overflow: auto; - } - tr { - display: table-row; - margin-bottom: 0; - border: none; - background-color:transparent; - } - th, - td { - // Undo display: block - display: table-cell; - } - tbody { - display:table-row-group; - tr { - display:table-row; - } - & > tr > th { - border-top: 1px solid @table-border-color; - background-color: transparent; - } - td { - &[data-title]:before { - content: none; - } - } - } - } - .fa-circle { - color:@gray-light; - &.active { - color:@brand-success; - } - } -} \ No newline at end of file diff --git a/src/app/home/home.js b/src/app/home/home.js index c5680f00..cc54af25 100644 --- a/src/app/home/home.js +++ b/src/app/home/home.js @@ -10,14 +10,10 @@ function HomeConfig($stateProvider) { url: '/home', templateUrl: 'home/templates/home.tpl.html', controller: 'HomeCtrl', -<<<<<<< HEAD - controllerAs: 'home' -======= controllerAs: 'home', data: { pageTitle: 'Home' } ->>>>>>> 281bb9e29d0e44c929457c755c5b59714e368ee2 }) ; } diff --git a/src/app/home/less/home.less b/src/app/home/less/home.less deleted file mode 100644 index cda5e092..00000000 --- a/src/app/home/less/home.less +++ /dev/null @@ -1,4 +0,0 @@ -#COMPONENT_Home { - padding-top:15px; - background-color:@component-home-bg; -} \ No newline at end of file diff --git a/src/app/home/less/variables.less b/src/app/home/less/variables.less deleted file mode 100644 index 38936347..00000000 --- a/src/app/home/less/variables.less +++ /dev/null @@ -1 +0,0 @@ -@component-home-bg: @global-component-bg; \ No newline at end of file diff --git a/src/app/home/templates/home.tpl.html b/src/app/home/templates/home.tpl.html index 49fa3fe8..7514561a 100644 --- a/src/app/home/templates/home.tpl.html +++ b/src/app/home/templates/home.tpl.html @@ -1,674 +1,7 @@ -<<<<<<< HEAD -
-
-
-

-

A quick preview of common UI elements within an OrderCloud Application. Feel free to delete this content or use it as a reference when you theme your Application!

-

Learn more »

-
-
-
-
-
Headings
-
-

Page Header With Small Text

-

This is an h1 heading

-

This is an h2 heading

-

This is an h3 heading

-

This is an h4 heading

-
This is an h5 heading
-
This is an h6 heading
-
-
-
-
Tables -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#First NameTables
1MichaelAre formatted like this
2LucilleDo you like them?
3Success
4Danger
5Warning
6Active
- - - - - - - - - - - - - - - - - - - - -
#First NameTables
1MichaelThis one is bordered and condensed
2LucilleDo you still like it?
-
-
-
-
-
-
Content Formatting -
-
-

This is a lead paragraph.

-

This is an ordinary paragraph that is long enough to wrap to multiple lines so that you can see how the line spacing looks.

-

Muted color paragraph.

-

Warning color paragraph.

-

Danger color paragraph.

-

Info color paragraph.

-

Success color paragraph.

-

This is text in a small wrapper. NBD, right?

-
-
Twitter, Inc.
795 Folsom Ave, Suite 600
San Francisco, CA 94107
P: (123) 456-7890
Full Name
first.last@example.com
-
-
Here's what a blockquote looks like in Bootstrap. Use small to identify the source. -
-
-
-
-
    -
  • Normal Unordered List
  • -
  • Can Also Work -
      -
    • With Nested Children
    • -
    -
  • -
  • Adds Bullets to Page
  • -
-
-
-
    -
  1. Normal Ordered List
  2. -
  3. Can Also Work -
      -
    1. With Nested Children
    2. -
    -
  4. -
  5. Adds Bullets to Page
  6. -
-
-
-
-
function preFormatting() {  // looks like this;  var something = somethingElse;  return true;}
-
-
-
-
-
-
Forms -
-
-
-
- Legend -
- - -
-
- - -
-
- - -

Example block-level help text here.

-
-
- -
- -
-
-
-
- - -
- -
- -
-
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
- -
- -
-
-
-
-
-
-
-
-
Buttons -
-
-

- - - - - - - -

-

- - - - - - - -

-

- - - - - - - -

-

- - - - - - - -

-

- - - - - - - -

-
-
-
-
-
-
Images -
-
-

- -

-
-
-
-
-
-
- -
-
-
-
Input Groups -
-
-
- -

-
- - .00 -

-
- $ - .00 -
-
-
-
-
-
-
- -
- -
-
-
- -
-
Labels and Badges -
-
-

Default Success Warning Danger Info

-

Inbox 42

-
-
-
-
-
-
Alerts -
-
-
-
- - Oh snap! Change a few things up and try submitting again. -
-
- - Well done! You successfully read this important alert message. -
-
- - Heads up! This alert needs your attention, but it's not super important. -
-
- - Heads up! This alert needs your attention, but it's not super important. -
-
- -

Warning!

-

This is a block style alert.

-
-
-
-
-
-
-
-
-
-
Progress Bars -
-
-
-
60% Complete
-
-
-
40% Complete (success)
-
-
-
20% Complete
-
-
-
60% Complete (warning)
-
-
-
80% Complete (danger)
-
-
-
35% Complete (success)
-
20% Complete (warning)
-
10% Complete (danger)
-
-
-
-
-
-
-
Media Object -
-
-

-
- -
-

Media heading

-

This is the content for your media.

-
- -
-

Media heading

-

This is the content for your media.

-
-
-
-
-
-
-
-
- -
-
-
-
This is a header -
-

This is a panel

- -
-
-
-
-
This is a header -
-
This is a panel
- -
-
-
-
-
This is a header -
-
This is a panel
- -
-
-
-
-
This is a header -
-
This is a panel
- -
-
-
-
-
-
-
This is a header -
-

This is a panel

- -
-
-
-
-
This is a header -
-
This is a panel
-
    -
  • First Item
  • -
  • Second Item
  • -
  • Third Item
  • -
- -
-
-
-
Default Well -
-
Small Well -
-
-
-
Large Padding Well -
-
-
-
-=======

Welcome to the OrderCloud Marketplace App!

Learn more »

->>>>>>> 281bb9e29d0e44c929457c755c5b59714e368ee2
\ No newline at end of file diff --git a/src/app/login/less/login.less b/src/app/login/less/login.less deleted file mode 100644 index 7fc60580..00000000 --- a/src/app/login/less/login.less +++ /dev/null @@ -1,10 +0,0 @@ -#COMPONENT_Login { - height:100vh; - display:flex; - align-items:center; - justify-content: center; - background-color:@component-login-bg; - .panel { - max-width:@component-login-width; - } -} \ No newline at end of file diff --git a/src/app/login/less/variables.less b/src/app/login/less/variables.less deleted file mode 100644 index 0520f495..00000000 --- a/src/app/login/less/variables.less +++ /dev/null @@ -1,3 +0,0 @@ -// Variables specific to the Login Screen -@component-login-width: 300px; -@component-login-bg: @global-component-bg; \ No newline at end of file diff --git a/src/app/login/login.js b/src/app/login/login.js index 948ace7a..30f62bd3 100644 --- a/src/app/login/login.js +++ b/src/app/login/login.js @@ -2,8 +2,6 @@ angular.module('orderCloud') .config(LoginConfig) .factory('LoginService', LoginService) .controller('LoginCtrl', LoginController) -<<<<<<< HEAD -======= .directive('prettySubmit', function () { return function (scope, element) { $(element).submit(function(event) { @@ -11,7 +9,6 @@ angular.module('orderCloud') }); }; }) ->>>>>>> 281bb9e29d0e44c929457c755c5b59714e368ee2 ; function LoginConfig($stateProvider) { @@ -25,19 +22,12 @@ function LoginConfig($stateProvider) { ; } -<<<<<<< HEAD -function LoginService($q, $window, $state, toastr, OrderCloud, TokenRefresh, clientid, buyerid, anonymous) { -======= function LoginService($q, $window, $state, $cookies, toastr, OrderCloud, clientid, buyerid, anonymous) { ->>>>>>> 281bb9e29d0e44c929457c755c5b59714e368ee2 return { SendVerificationCode: _sendVerificationCode, ResetPassword: _resetPassword, RememberMe: _rememberMe, -<<<<<<< HEAD -======= AuthAnonymous: _authAnonymous, ->>>>>>> 281bb9e29d0e44c929457c755c5b59714e368ee2 Logout: _logout }; @@ -81,13 +71,6 @@ function LoginService($q, $window, $state, $cookies, toastr, OrderCloud, clienti return deferred.promise; } -<<<<<<< HEAD - function _logout(){ - OrderCloud.Auth.RemoveToken(); - OrderCloud.Auth.RemoveImpersonationToken(); - OrderCloud.BuyerID.Set(null); - TokenRefresh.RemoveToken(); -======= function _authAnonymous() { return OrderCloud.Auth.GetToken('') .then(function(data) { @@ -101,33 +84,10 @@ function LoginService($q, $window, $state, $cookies, toastr, OrderCloud, clienti angular.forEach($cookies.getAll(), function(val, key) { $cookies.remove(key); }); ->>>>>>> 281bb9e29d0e44c929457c755c5b59714e368ee2 $state.go(anonymous ? 'home' : 'login', {}, {reload: true}); } function _rememberMe() { -<<<<<<< HEAD - TokenRefresh.GetToken() - .then(function (refreshToken) { - if (refreshToken) { - TokenRefresh.Refresh(refreshToken) - .then(function(token) { - OrderCloud.BuyerID.Set(buyerid); - OrderCloud.Auth.SetToken(token.access_token); - $state.go('home'); - }) - .catch(function () { - toastr.error('Your token has expired, please log in again.'); - }); - } else { - _logout(); - } - }); - } -} - -function LoginController($state, $stateParams, $exceptionHandler, OrderCloud, LoginService, TokenRefresh, buyerid) { -======= var availableRefreshToken = OrderCloud.Refresh.ReadToken() || null; if (availableRefreshToken) { @@ -148,7 +108,6 @@ function LoginController($state, $stateParams, $exceptionHandler, OrderCloud, Lo } function LoginController($state, $stateParams, $exceptionHandler, OrderCloud, LoginService, buyerid) { ->>>>>>> 281bb9e29d0e44c929457c755c5b59714e368ee2 var vm = this; vm.credentials = { Username: null, @@ -162,11 +121,6 @@ function LoginController($state, $stateParams, $exceptionHandler, OrderCloud, Lo vm.rememberStatus = false; vm.submit = function() { -<<<<<<< HEAD - OrderCloud.Auth.GetToken(vm.credentials) - .then(function(data) { - vm.rememberStatus ? TokenRefresh.SetToken(data['refresh_token']) : angular.noop(); -======= $('#Username').blur(); $('#Password').blur(); $('#Remember').blur(); @@ -174,7 +128,6 @@ function LoginController($state, $stateParams, $exceptionHandler, OrderCloud, Lo vm.loading = OrderCloud.Auth.GetToken(vm.credentials) .then(function(data) { vm.rememberStatus ? OrderCloud.Refresh.SetToken(data['refresh_token']) : angular.noop(); ->>>>>>> 281bb9e29d0e44c929457c755c5b59714e368ee2 OrderCloud.BuyerID.Set(buyerid); OrderCloud.Auth.SetToken(data['access_token']); $state.go('home'); diff --git a/src/app/login/templates/login.tpl.html b/src/app/login/templates/login.tpl.html index b1d0aa64..dbb04ac8 100644 --- a/src/app/login/templates/login.tpl.html +++ b/src/app/login/templates/login.tpl.html @@ -1,12 +1,3 @@ -<<<<<<< HEAD -
-
-
-

Login

-
- - -=======
@@ -14,7 +5,6 @@

Login

->>>>>>> 281bb9e29d0e44c929457c755c5b59714e368ee2
@@ -22,11 +12,7 @@

Login

diff --git a/src/app/login/tests/login.spec.js b/src/app/login/tests/login.spec.js index 0d47d72c..a585d59b 100644 --- a/src/app/login/tests/login.spec.js +++ b/src/app/login/tests/login.spec.js @@ -2,10 +2,6 @@ describe('Component: Login', function() { var scope, q, loginFactory, -<<<<<<< HEAD - Token_Refresh, -======= ->>>>>>> 281bb9e29d0e44c929457c755c5b59714e368ee2 oc, credentials = { Username: 'notarealusername', @@ -13,28 +9,16 @@ describe('Component: Login', function() { }; beforeEach(module('orderCloud')); beforeEach(module('orderCloud.sdk')); -<<<<<<< HEAD - beforeEach(inject(function($q, $rootScope, OrderCloud, LoginService, TokenRefresh) { -======= beforeEach(inject(function($q, $rootScope, OrderCloud, LoginService) { ->>>>>>> 281bb9e29d0e44c929457c755c5b59714e368ee2 q = $q; scope = $rootScope.$new(); loginFactory = LoginService; oc = OrderCloud; -<<<<<<< HEAD - Token_Refresh = TokenRefresh; -======= ->>>>>>> 281bb9e29d0e44c929457c755c5b59714e368ee2 })); describe('Factory: LoginService', function() { var client_id; -<<<<<<< HEAD - beforeEach(inject(function(clientid, TokenRefresh) { -======= beforeEach(inject(function(clientid) { ->>>>>>> 281bb9e29d0e44c929457c755c5b59714e368ee2 client_id = clientid; })); describe('SendVerificationCode', function() { @@ -56,8 +40,6 @@ describe('Component: Login', function() { }); }); -<<<<<<< HEAD -======= describe('Logout', function() { var cookies, state; @@ -88,7 +70,6 @@ describe('Component: Login', function() { }) }); ->>>>>>> 281bb9e29d0e44c929457c755c5b59714e368ee2 describe('ResetPassword', function() { var creds = { ResetUsername: credentials.Username, @@ -107,18 +88,6 @@ describe('Component: Login', function() { }); describe('RememberMe', function(){ -<<<<<<< HEAD - beforeEach(inject(function(){ - var deferred = q.defer(); - deferred.resolve(true); - spyOn(Token_Refresh, 'GetToken').and.returnValue(deferred.promise); - loginFactory.RememberMe(); - - })); - - it('should call the TokenRefresh.GetToken method', function(){ - expect(Token_Refresh.GetToken).toHaveBeenCalled(); -======= beforeEach(function(){ var deferred = q.defer(); deferred.resolve({access_token:'ACCESS_TOKEN'}); @@ -147,7 +116,6 @@ describe('Component: Login', function() { loginFactory.RememberMe(); expect(oc.Refresh.ReadToken).toHaveBeenCalled(); expect(oc.Refresh.GetToken).not.toHaveBeenCalled(); ->>>>>>> 281bb9e29d0e44c929457c755c5b59714e368ee2 }) }); diff --git a/src/app/themeDark.less b/src/app/themeDark.less deleted file mode 100644 index 443f54b2..00000000 --- a/src/app/themeDark.less +++ /dev/null @@ -1,143 +0,0 @@ -/* -// -// OrderCloud Dark UI -// -------------------------------------------------- - -//== Colors -@gray-base: desaturate(shade(@brand-secondary,86%),65%); -@gray-darker: tint(@gray-base, 10%); -@gray-dark: tint(@gray-base, 15%); -@gray: tint(@gray-base, 50%); -@gray-light: tint(@gray-base, 85%); -@gray-lighter: tint(@gray-base, 90%); - -@brand-primary: #008FDC; //OrderCloud Blue -@brand-secondary: @brand-primary; - -@brand-success: #5cb85c; -@brand-info: #51CEF6; -@brand-warning: darken(#FBD764,15); -@brand-danger: #E13D00; - -//== Scaffolding -@body-bg: @gray-base; -@text-color: @gray-lighter; -@link-hover-color: tint(@link-color, 15%); - -//== Tables -@table-bg-accent: @gray-dark; -@table-bg-hover: @gray-dark; -@table-border-color: @gray-dark; - -//== Buttons -@btn-default-color: @gray-lighter; -@btn-default-bg: @gray-dark; -@btn-default-border: @gray-darker; - -//== Forms -@legend-color: @gray-light; -@legend-border-color: @gray-light; - -//== Dropdowns -@dropdown-bg: @body-bg; -@dropdown-border: @gray-dark; -@dropdown-divider-bg: @gray-dark; -@dropdown-link-color: @gray-lighter; -@dropdown-link-hover-color: darken(@gray-light, 5%); -@dropdown-link-hover-bg: @gray-dark; -@dropdown-link-disabled-color: @gray; -@dropdown-header-color: @gray-light; - -//== Navbar -@navbar-default-color: @gray-lighter; -@navbar-default-bg: @gray-base; -@navbar-default-border: @gray-dark; -@navbar-default-link-color: @gray-light; -@navbar-default-link-hover-color: @gray-lighter; -@navbar-default-link-active-color: @gray-lighter; -@navbar-default-brand-hover-color: @navbar-default-link-hover-color; - -//=== Inverted navbar -@navbar-inverse-color: @gray-darker; -@navbar-inverse-bg: @gray-lighter; -@navbar-inverse-border: @gray-dark; -@navbar-inverse-link-color: @gray-darker; -@navbar-inverse-link-hover-color: @gray-dark; -@navbar-inverse-link-active-bg: @gray-light; -@navbar-inverse-brand-color: @navbar-inverse-link-color; -@navbar-inverse-brand-hover-color: @gray-dark; - -//== Navs -@nav-link-hover-bg: @gray-darker; -@nav-tabs-border-color: @gray-dark; -@nav-tabs-link-hover-border-color: @gray-dark; -@nav-tabs-active-link-hover-bg: @gray-darker; -@nav-tabs-active-link-hover-border-color: @gray-dark; - -//== Pagination -@pagination-bg: @body-bg; -@pagination-border: @gray-darker; -@pagination-hover-bg: @gray-darker; -@pagination-hover-border: @gray-darker; -@pagination-active-border: @gray-darker; -@pagination-disabled-color: @gray-darker; -@pagination-disabled-bg: @body-bg; -@pagination-disabled-border: @gray-darker; - -//== Jumbotron -@jumbotron-bg: @gray-darker; - -//== Form states and alerts -@state-success-text: lighten(@brand-success,60); -@state-success-bg: darken(@brand-success,5); -@state-success-border: darken(@state-success-bg, 5%); -@state-info-text: lighten(@brand-info,60); -@state-info-bg: darken(@brand-info,15); -@state-info-border: darken(@state-info-bg, 7%); -@state-warning-text: lighten(@brand-warning,60); -@state-warning-bg: darken(@brand-warning,5); -@state-warning-border: darken(@state-warning-bg, 5%); -@state-danger-text: lighten(@brand-danger,60); -@state-danger-bg: darken(@brand-danger,5); -@state-danger-border: darken(@state-danger-bg, 5%); - -//== Labels -@label-default-bg: @gray; - -//== Modals -@modal-content-bg: @gray-darker; -@modal-content-border-color: @gray-darker; -@modal-header-border-color: @gray-dark; - -//== List group -@list-group-bg: @body-bg; -@list-group-border: @gray-darker; -@list-group-hover-bg: @gray-darker; -@list-group-disabled-color: @gray-dark; -@list-group-disabled-bg: @gray-darker; -@list-group-link-color: @gray-light; -@list-group-link-heading-color: @gray-lighter; - -//== Panels -@panel-bg: @gray-darker; -@panel-inner-border: @gray-dark; -@panel-footer-bg: @gray-darker; -@panel-default-text: @gray-lighter; -@panel-default-border: @gray-dark; -@panel-default-heading-bg: @gray-dark; - -//== Thumbnails -@thumbnail-border: @gray-dark; - -//== Wells -@well-bg: @gray-dark; -@well-border: @gray-darker; - -//== Badges -@badge-bg: @brand-primary; - -//== Type -@text-muted: @gray; -@headings-small-color: @gray; -@blockquote-small-color: @gray; -*/ diff --git a/src/app/themeLight.less b/src/app/themeLight.less deleted file mode 100644 index 8e1d3f5e..00000000 --- a/src/app/themeLight.less +++ /dev/null @@ -1,143 +0,0 @@ -/* -// -// OrderCloud Light UI -// -------------------------------------------------- - -//== Colors -@gray-base: desaturate(shade(@brand-secondary,86%),100%); -@gray-darker: tint(@gray-base, 5%); -@gray-dark: tint(@gray-base, 10%); -@gray: tint(@gray-base, 50%); -@gray-light: tint(@gray-base, 85%); -@gray-lighter: tint(@gray-base, 95%); - -@brand-primary: #008FDC; //OrderCloud Blue -@brand-secondary: @brand-primary; - -@brand-success: #5cb85c; -@brand-info: #51CEF6; -@brand-warning: #FBD764; -@brand-danger: #E13D00; - -//== Scaffolding -@body-bg: #FFFFFF; -@text-color: @gray-dark; -@link-hover-color: darken(@link-color, 15%); - -//== Tables -@table-bg-accent: @gray-light; -@table-bg-hover: darken(@gray-lighter, 2.5%); -@table-border-color: @gray-light; - -//== Buttons -@btn-default-color: @gray-darker; -@btn-default-bg: #fff; -@btn-default-border: @gray-light; - -//== Forms -@legend-color: @gray-dark; -@legend-border-color: @gray-light; - -//== Dropdowns -@dropdown-bg: @body-bg; -@dropdown-border: @gray-light; -@dropdown-divider-bg: @gray-light; -@dropdown-link-color: @gray-darker; -@dropdown-link-hover-color: darken(@gray-dark, 5%); -@dropdown-link-hover-bg: @gray-lighter; -@dropdown-link-disabled-color: @gray; -@dropdown-header-color: @gray; - -//== Navbar -@navbar-default-color: @gray-darker; -@navbar-default-bg: @gray-lighter; -@navbar-default-border: @gray-light; -@navbar-default-link-color: @gray-dark; -@navbar-default-link-hover-color: @gray-darker; -@navbar-default-link-active-color: @gray-darker; -@navbar-default-brand-hover-color: @navbar-default-link-hover-color; - -//=== Inverted navbar -@navbar-inverse-color: @gray-lighter; -@navbar-inverse-bg: @gray-darker; -@navbar-inverse-border: @gray-light; -@navbar-inverse-link-color: @gray-lighter; -@navbar-inverse-link-hover-color: @gray-light; -@navbar-inverse-link-active-bg: @gray-dark; -@navbar-inverse-brand-color: @navbar-inverse-link-color; -@navbar-inverse-brand-hover-color: @gray-light; - -//== Navs -@nav-link-hover-bg: @gray-lighter; -@nav-tabs-border-color: @gray-light; -@nav-tabs-link-hover-border-color: @gray-light; -@nav-tabs-active-link-hover-bg: @gray-lighter; -@nav-tabs-active-link-hover-border-color: @gray-light; - -//== Pagination -@pagination-bg: @body-bg; -@pagination-border: @gray-light; -@pagination-hover-bg: @gray-lighter; -@pagination-hover-border: @gray-lighter; -@pagination-active-border: @gray-lighter; -@pagination-disabled-color: @gray; -@pagination-disabled-bg: @body-bg; -@pagination-disabled-border: @gray-light; - -//== Jumbotron -@jumbotron-bg: @gray-lighter; - -//== Form states and alerts -@state-success-text: #3c763d; -@state-success-bg: #dff0d8; -@state-success-border: darken(spin(@state-success-bg, -10), 5%); -@state-info-text: #31708f; -@state-info-bg: #d9edf7; -@state-info-border: darken(spin(@state-info-bg, -10), 7%); -@state-warning-text: #8a6d3b; -@state-warning-bg: #fcf8e3; -@state-warning-border: darken(spin(@state-warning-bg, -10), 5%); -@state-danger-text: #a94442; -@state-danger-bg: #f2dede; -@state-danger-border: darken(spin(@state-danger-bg, -10), 5%); - -//== Labels -@label-default-bg: @gray; - - //== Modals -@modal-content-bg: @gray-lighter; -@modal-content-border-color: @gray-lighter; -@modal-header-border-color: @gray-light; - -//== List group -@list-group-bg: @body-bg; -@list-group-border: @gray-light; -@list-group-hover-bg: @gray-lighter; -@list-group-disabled-color: @gray-light; -@list-group-disabled-bg: @gray-lighter; -@list-group-link-color: @gray-dark; -@list-group-link-heading-color: @gray-darker; - -//== Panels -@panel-bg: @gray-lighter; -@panel-inner-border: @gray-lighter; -@panel-footer-bg: @gray-lighter; -@panel-default-text: @gray-darker; -@panel-default-border: @gray-light; -@panel-default-heading-bg: @gray-light; - -//== Thumbnails -@thumbnail-border: @gray-light; - -//== Wells -@well-bg: @gray-light; -@well-border: @gray-lighter; - -//== Badges -@badge-bg: @brand-primary; - -//== Type -@text-muted: @gray; -@headings-small-color: @gray; -@blockquote-small-color: @gray; -*/ diff --git a/src/app/variables.less b/src/app/variables.less deleted file mode 100644 index fc5ee368..00000000 --- a/src/app/variables.less +++ /dev/null @@ -1,14 +0,0 @@ -//These are the variables used throughout the application. This is where -//overwrites that are not specific to components should be maintained. -//Interconnected table color styles - -//Global Application Styles -@app-container-size: 100%; -@html-bg:darken(@body-bg, 25); - -//Table Infinite Scroll -@table-header-height:@table-cell-padding*2 + @line-height-computed; -@infinite-scroll-size: ~'calc(100vh - 420px)'; - -//Global Component Styles -@global-component-bg:@body-bg; \ No newline at end of file diff --git a/src/index.html b/src/index.html index 0f0aba9a..a479374c 100644 --- a/src/index.html +++ b/src/index.html @@ -4,23 +4,13 @@ -<<<<<<< HEAD - OrderCloud -======= OrderCloud ->>>>>>> 281bb9e29d0e44c929457c755c5b59714e368ee2 -<<<<<<< HEAD - - - - -======= @@ -36,7 +26,6 @@
->>>>>>> 281bb9e29d0e44c929457c755c5b59714e368ee2