diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 815c381..2bdf6b4 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,24 +2,12 @@ - - - - - - - - - - - - - - - + + + + - @@ -46,108 +34,48 @@ - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - + + - - + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - + + - - + + - - + + @@ -177,11 +105,11 @@ - + - - + + @@ -210,11 +138,21 @@ - + - - + + + + + + + + + + + + @@ -343,8 +281,6 @@ @@ -541,6 +479,24 @@ + + + + + + + @@ -647,13 +624,6 @@ - - - - - - - - @@ -1179,7 +1149,7 @@ - + @@ -1266,27 +1236,6 @@ - - - - - - - - - - - - - - - - - - - - - @@ -1523,22 +1472,6 @@ - - - - - - - - - - - - - - - - @@ -1599,34 +1532,34 @@ - + - - + + - + - - + + - + - - + + - + - - + + @@ -1649,10 +1582,50 @@ - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/routes/v1/models.js b/routes/v1/models.js index 001c759..4bc5a3f 100644 --- a/routes/v1/models.js +++ b/routes/v1/models.js @@ -20,10 +20,12 @@ router.get('/:model', function(req, res, next) { res.status(400).send(`Model [${req.params.model}] does not exist`); return; } - - model.findAll().then(function (data) { + console.log(req.query); + model.findAll({ where: req.query }).then(function (data) { "use strict"; res.send(data); + }).catch(function (error) { + res.status(400).send(`[${error.name}] ${error.original.code}`); }); }); diff --git a/www/app.js b/www/app.js index 6993f7b..203f668 100755 --- a/www/app.js +++ b/www/app.js @@ -5,6 +5,7 @@ angular.module('naranawm', [ 'ngRoute', 'ngResource', 'naranawm.languages', + 'naranawm.sources', 'naranawm.view1', 'naranawm.view2', 'naranawm.version', @@ -12,5 +13,5 @@ angular.module('naranawm', [ ]). config(['$locationProvider', '$routeProvider', function($locationProvider, $routeProvider) { $locationProvider.hashPrefix('!'); - $routeProvider.otherwise({redirectTo: '/view2'}); + $routeProvider.otherwise({redirectTo: '/languages'}); }]); diff --git a/www/index.html b/www/index.html index f7dd995..1acd4fc 100755 --- a/www/index.html +++ b/www/index.html @@ -70,6 +70,7 @@ + diff --git a/www/sources/sources.html b/www/sources/sources.html new file mode 100644 index 0000000..744d6f5 --- /dev/null +++ b/www/sources/sources.html @@ -0,0 +1,21 @@ + +
+ + + + + + + + + + + + + + + +
NameDescriptionLanguage
{{ row.name }}{{ row.description }}{{ row.LanguageIsoCode }}
+
\ No newline at end of file diff --git a/www/sources/sources.js b/www/sources/sources.js new file mode 100644 index 0000000..aab97da --- /dev/null +++ b/www/sources/sources.js @@ -0,0 +1,16 @@ +'use strict'; + +angular.module('naranawm.sources', ['ngRoute']) + + .config(['$routeProvider', function($routeProvider) { + $routeProvider.when('/sources', { + templateUrl: 'sources/sources.html', + controller: 'SourcesCtrl' + }); + }]) + + .controller('SourcesCtrl', ["$scope", "Models", function($scope, Models) { + $scope.sources = Models.query({model: "Source"}, function() { + + }); //query() returns all the entries + }]);