nitweb/angular: add /package/:full_name page
authorAlexandre Terrasa <alexandre@moz-code.org>
Wed, 1 Jun 2016 00:56:23 +0000 (20:56 -0400)
committerAlexandre Terrasa <alexandre@moz-code.org>
Wed, 1 Jun 2016 03:54:06 +0000 (23:54 -0400)
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

share/nitweb/javascripts/entities.js
share/nitweb/javascripts/nitweb.js
share/nitweb/stylesheets/nitweb.css
share/nitweb/views/package.html [new file with mode: 0644]

index 820af42..4fe181b 100644 (file)
 
 (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 {
index 666ee60..f5e06b2 100644 (file)
  */
 
 (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: '/'
                        });
index 112ec75..18f2f4e 100644 (file)
@@ -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 (file)
index 0000000..4abcbc7
--- /dev/null
@@ -0,0 +1,19 @@
+<div class='container-fluid'>
+       <div class='page-header'>
+               <h2><entity-signature mentity='mentity'/></h2>
+       </div>
+
+       <ul class='nav nav-tabs' role='tablist'>
+               <li role='presentation' class='active'>
+                       <a data-toggle='tab' role='tab' data-target='#doc' aria-controls="doc">
+                               <span class='glyphicon glyphicon-book'/> Doc
+                       </a>
+               </li>
+       </ul>
+
+       <div class='tab-content'>
+               <div role='tabpanel' class='tab-pane fade in active' id='doc'>
+                       <entity-doc mentity='mentity'/>
+               </div>
+       </div>
+</div>