diff --git a/app/templates/bower.json b/app/templates/bower.json index 51f1e12a..4e758bc6 100644 --- a/app/templates/bower.json +++ b/app/templates/bower.json @@ -3,17 +3,17 @@ "version": "0.0.0", "dependencies": { "jquery": "~2.1.4", - "angular": "~1.4.4", - "angular-animate": "~1.4.4", + "angular": "~1.6.5", + "angular-animate": "~1.6.5", "angular-bootstrap": "^1.1", "angular-bootstrap-confirm": "^2.3.0", - "angular-cookies": "~1.4.4", + "angular-cookies": "~1.6.5", "angular-google-maps": "2.3.2", "angular-highlightjs": "~0.6.0", - "angular-messages": "~1.4.4", - "angular-mocks": "~1.4.4", - "angular-sanitize": "~1.4.4", - "angular-ui-router": "~0.2.15", + "angular-messages": "~1.6.5", + "angular-mocks": "~1.6.5", + "angular-sanitize": "~1.6.5", + "angular-ui-router": "~0.3.1", "angular-ui-tinymce": "~0.0.9", "angular-x2js": "https://github.com/janmichaelyu/angular-x2js.git", "bootstrap": "~3.3.5", @@ -49,15 +49,16 @@ } }, "devDependencies": { - "angular-mocks": "~1.4.4", + "angular-mocks": "~1.6.5", "bardjs": "~0.1.8", "sinon": "*" }, "private": true, "resolutions": { - "angular": "~1.4.4", + "angular": "~1.6.5", "angular-bootstrap": "^1.1", "highcharts": "^4.2", - "ng-json-explorer": "f7236fa857" + "ng-json-explorer": "f7236fa857", + "angular-sanitize": "~1.6.5" } } diff --git a/app/templates/rest-api/config/options/all.xml b/app/templates/rest-api/config/options/all.xml index 8fc27b94..730fb491 100644 --- a/app/templates/rest-api/config/options/all.xml +++ b/app/templates/rest-api/config/options/all.xml @@ -79,6 +79,25 @@ + + + + + + + + + eyeColor + + + + + eyeColor + + + Delta options here diff --git a/app/templates/ui/app/search/ml-select.component.js b/app/templates/ui/app/search/ml-select.component.js new file mode 100644 index 00000000..f80e7585 --- /dev/null +++ b/app/templates/ui/app/search/ml-select.component.js @@ -0,0 +1,23 @@ +(function () { + 'use strict'; + + function MLSelectController() { + var ctrl = this; + ctrl.select = function(selectionName) { + ctrl.onSelect({selectionName: selectionName}); + }; + } + + angular.module('app.search') + .component('mlSelect', { + templateUrl: 'app/search/ml-select.html', + controller: MLSelectController, + bindings: { + label: '=', + currentSelection: '=', + selectionList: '=', + onSelect: '&' + } + }); + +})(); diff --git a/app/templates/ui/app/search/ml-select.component.spec.js b/app/templates/ui/app/search/ml-select.component.spec.js new file mode 100644 index 00000000..f603e8e2 --- /dev/null +++ b/app/templates/ui/app/search/ml-select.component.spec.js @@ -0,0 +1,44 @@ +/* jshint -W117, -W030 */ +(function () { + 'use strict'; + + describe('Component: ml-select', function () { + + var elem, controller, snippet; + + beforeEach(function() { + bard.appModule('app.search'); + bard.inject('$compile', '$rootScope', '$templateCache', '$componentController'); + + $templateCache.put( 'app/search/ml-select.html', + '
' + ); + }); + + beforeEach(function() { + var $scope = $rootScope.$new(); + $scope.setSnippet = function(selectionName) { + snippet = selectionName; + }; + elem = angular.element(''); + $compile(elem)($scope); + $scope.$digest(); + var bindings = {onSelect: $scope.setSnippet}; + controller = $componentController('mlSelect', { $scope: $scope }, bindings); + + // flush promises + $rootScope.$apply(); + }); + + it('should compile', function() { + expect(elem.children().hasClass('ml-select')).to.eq(true); + }); + + it('should set snippet', function() { + var type = 'xxx'; + controller.onSelect(type); + expect(snippet).to.eq(type); + }); + + }); +})(); diff --git a/app/templates/ui/app/search/ml-snippet.html b/app/templates/ui/app/search/ml-select.html similarity index 50% rename from app/templates/ui/app/search/ml-snippet.html rename to app/templates/ui/app/search/ml-select.html index c3d881e9..cef83fd9 100644 --- a/app/templates/ui/app/search/ml-snippet.html +++ b/app/templates/ui/app/search/ml-select.html @@ -1,10 +1,10 @@
diff --git a/app/templates/ui/app/search/ml-snippet.directive.js b/app/templates/ui/app/search/ml-snippet.directive.js deleted file mode 100644 index 2c5ae9eb..00000000 --- a/app/templates/ui/app/search/ml-snippet.directive.js +++ /dev/null @@ -1,38 +0,0 @@ -(function () { - - 'use strict'; - - angular.module('app.snippet') - .directive('mlSnippet', SnippetDirective) - .controller('SnippetCtrl', SnippetCtrl); - - function SnippetDirective() { - return { - restrict: 'E', - controller: 'SnippetCtrl', - controllerAs: '$ctrl', - replace: true, - scope: { - setSnippet: '&' - }, - templateUrl: 'app/search/ml-snippet.html' - }; - } - - SnippetCtrl.$inject = ['$scope']; - - function SnippetCtrl($scope) { - $scope.snippets = ['detailed', 'compact']; - - var ctrl = this; - angular.extend(ctrl, { - setSnippetType: setSnippetType - }); - - function setSnippetType(type) { - $scope.snippetType = type; - $scope.setSnippet({type: type}); - } - } - -}()); diff --git a/app/templates/ui/app/search/ml-snippet.directive.spec.js b/app/templates/ui/app/search/ml-snippet.directive.spec.js deleted file mode 100644 index 40a67e40..00000000 --- a/app/templates/ui/app/search/ml-snippet.directive.spec.js +++ /dev/null @@ -1,44 +0,0 @@ -/* jshint -W117, -W030 */ -(function () { - 'use strict'; - - describe('Directive: ml-snippet', function () { - - var elem, controller, snippet; - - beforeEach(function() { - bard.appModule('app.snippet'); - bard.inject('$compile', '$rootScope', '$templateCache', '$controller'); - - $templateCache.put( 'app/search/ml-snippet.html', - '
' - ); - }); - - beforeEach(function() { - var $scope = $rootScope.$new(); - $scope.setSnippet = function(type) { - snippet = type.type; // note: test framework doesn't seem to unwrap arguments in directive callbacks - }; - elem = angular.element(''); - $compile(elem)($scope); - $scope.$digest(); - - controller = $controller('SnippetCtrl', { $scope: $scope }); - - // flush promises - $rootScope.$apply(); - }); - - it('should compile', function() { - expect(elem.hasClass('ml-snippet')).to.eq(true); - }); - - it('should set snippet', function() { - var type = 'xxx'; - controller.setSnippetType(type); - expect(snippet).to.eq(type); - }); - - }); -})(); diff --git a/app/templates/ui/app/search/ml-snippet.module.js b/app/templates/ui/app/search/ml-snippet.module.js deleted file mode 100644 index 25cae1b0..00000000 --- a/app/templates/ui/app/search/ml-snippet.module.js +++ /dev/null @@ -1,8 +0,0 @@ -(function () { - 'use strict'; - - angular.module('app.snippet', [ - // html dependencies - 'ui.bootstrap' - ]); -}()); diff --git a/app/templates/ui/app/search/search.controller.js b/app/templates/ui/app/search/search.controller.js index 47ae50f0..5d333dd0 100644 --- a/app/templates/ui/app/search/search.controller.js +++ b/app/templates/ui/app/search/search.controller.js @@ -1,5 +1,5 @@ /* global MLSearchController */ -(function () { +(function() { 'use strict'; angular.module('app.search') @@ -22,5 +22,27 @@ ctrl.mlSearch.setSnippet(type); ctrl.search(); }; + + ctrl.setSort = function(type) { + ctrl.mlSearch.setSort(type); + ctrl.search(); + }; + + function listFromOperator(operatorArray, operatorType) { + return (_.filter( + operatorArray, + function(val) { + return val && val.state && val.state[0] && val.state[0][operatorType]; + } + )[0] || { state: []}).state.map(function(state) { + return state.name; + }); + } + + ctrl.mlSearch.getStoredOptions().then(function(data) { + ctrl.sortList = listFromOperator(data.options.operator, 'sort-order'); + ctrl.snippetList = listFromOperator(data.options.operator, 'transform-results'); + }); + } }()); diff --git a/app/templates/ui/app/search/search.controller.spec.js b/app/templates/ui/app/search/search.controller.spec.js index ba45ce9e..92d810e3 100644 --- a/app/templates/ui/app/search/search.controller.spec.js +++ b/app/templates/ui/app/search/search.controller.spec.js @@ -25,6 +25,13 @@ data: { results: results } + }), + queryConfig: $q.when({ + data: { + options: { + operator: [] + } + } }) }); diff --git a/app/templates/ui/app/search/search.html b/app/templates/ui/app/search/search.html index 153a9fde..189b6561 100644 --- a/app/templates/ui/app/search/search.html +++ b/app/templates/ui/app/search/search.html @@ -3,21 +3,22 @@ -