From: Alexandre Terrasa Date: Wed, 1 Jun 2016 00:56:23 +0000 (-0400) Subject: nitweb/angular: add /package/:full_name page X-Git-Url: http://nitlanguage.org nitweb/angular: add /package/:full_name page Signed-off-by: Alexandre Terrasa --- diff --git a/share/nitweb/javascripts/entities.js b/share/nitweb/javascripts/entities.js index 820af42..4fe181b 100644 --- a/share/nitweb/javascripts/entities.js +++ b/share/nitweb/javascripts/entities.js @@ -16,7 +16,16 @@ (function() { angular - .module('entities', ['model', 'ui']) + .module('entities', ['model']) + + .controller('EntityCtrl', ['Model', '$routeParams', '$scope', function(Model, $routeParams, $scope) { + Model.loadEntity($routeParams.id, + function(data) { + $scope.mentity = data; + }, function(err) { + $scope.error = err; + }); + }]) .directive('entityLink', function() { return { diff --git a/share/nitweb/javascripts/nitweb.js b/share/nitweb/javascripts/nitweb.js index 666ee60..f5e06b2 100644 --- a/share/nitweb/javascripts/nitweb.js +++ b/share/nitweb/javascripts/nitweb.js @@ -15,13 +15,18 @@ */ (function() { - angular.module('nitweb', ['ngRoute', 'ngSanitize']) + angular.module('nitweb', ['ngRoute', 'ngSanitize', 'entities']) .config(function($routeProvider, $locationProvider) { $routeProvider .when('/', { templateUrl: 'views/index.html' }) + .when('/package/:id', { + templateUrl: 'views/package.html', + controller: 'EntityCtrl', + controllerAs: 'entityCtrl' + }) .otherwise({ redirectTo: '/' }); diff --git a/share/nitweb/stylesheets/nitweb.css b/share/nitweb/stylesheets/nitweb.css index 112ec75..18f2f4e 100644 --- a/share/nitweb/stylesheets/nitweb.css +++ b/share/nitweb/stylesheets/nitweb.css @@ -18,6 +18,11 @@ a { color: #333; } +.page-header { + margin-top: 0; + border: none; +} + /* cards */ .card.active { diff --git a/share/nitweb/views/package.html b/share/nitweb/views/package.html new file mode 100644 index 0000000..4abcbc7 --- /dev/null +++ b/share/nitweb/views/package.html @@ -0,0 +1,19 @@ +
+ + + + +
+
+ +
+
+