--- /dev/null
+<span ng-if='mentity.mpackage'>
+ <entity-link mentity='mentity.mpackage' /> ::
+</span>
+<span ng-if='mentity.mmodule'>
+ <entity-link mentity='mentity.mmodule' /> ::
+</span>
+<span ng-if='mentity.intro_mclassdef'>
+ <entity-link mentity='mentity.intro_mclassdef' /> ::
+</span>
+<span ng-if='mentity.mclassdef'>
+ <entity-link mentity='mentity.mclassdef' /> ::
+</span>
+{{mentity.name}}
integrity='sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7'
crossorigin='anonymous' rel='stylesheet'>
+ <link href='//cdnjs.cloudflare.com/ajax/libs/angular-loading-bar/0.9.0/loading-bar.min.css'
+ type='text/css' rel='stylesheet' media='all'>
+
+
<link href='/stylesheets/nitweb_bootstrap.css' rel='stylesheet'>
<link href='/stylesheets/nitweb.css' rel='stylesheet'>
</head>
</script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.5/angular-sanitize.js'>
</script>
+ <script type='text/javascript'
+ src='//cdnjs.cloudflare.com/ajax/libs/angular-loading-bar/0.9.0/loading-bar.min.js'>
+ </script>
<script src='/javascripts/nitweb.js'></script>
<script src='/javascripts/model.js'></script>
.module('entities', ['ngSanitize', 'ui', 'model'])
.controller('EntityCtrl', ['Model', '$routeParams', '$scope', '$sce', function(Model, $routeParams, $scope, $sce) {
+ $scope.entityId = $routeParams.id;
+
this.loadEntityLinearization = function() {
Model.loadEntityLinearization($routeParams.id,
function(data) {
Model.loadEntity($routeParams.id,
function(data) {
$scope.mentity = data;
- }, function(err) {
- $scope.error = err;
+ }, function(message, status) {
+ $scope.error = {message: message, status: status};
});
}])
};
})
+ .directive('entityNamespace', function() {
+ return {
+ restrict: 'E',
+ scope: {
+ mentity: '='
+ },
+ templateUrl: '/directives/entity/namespace.html'
+ };
+ })
+
.directive('entityTag', function() {
return {
restrict: 'E',
*/
(function() {
- angular.module('nitweb', ['ngRoute', 'ngSanitize', 'entities', 'index'])
-
+ angular.module('nitweb', ['ngRoute', 'ngSanitize', 'angular-loading-bar', 'entities', 'index'])
+ .config(['cfpLoadingBarProvider', function(cfpLoadingBarProvider) {
+ cfpLoadingBarProvider.includeSpinner = false;
+ }])
.config(function($routeProvider, $locationProvider) {
$routeProvider
.when('/', {
controller: 'IndexCtrl',
controllerAs: 'indexCtrl'
})
- .when('/package/:id', {
- templateUrl: 'views/package.html',
- controller: 'EntityCtrl',
- controllerAs: 'entityCtrl'
- })
- .when('/group/:id', {
- templateUrl: 'views/group.html',
- controller: 'EntityCtrl',
- controllerAs: 'entityCtrl'
- })
- .when('/module/:id', {
- templateUrl: 'views/module.html',
- controller: 'EntityCtrl',
- controllerAs: 'entityCtrl'
- })
- .when('/class/:id', {
- templateUrl: 'views/class.html',
- controller: 'EntityCtrl',
- controllerAs: 'entityCtrl'
- })
- .when('/classdef/:id', {
- templateUrl: 'views/classdef.html',
- controller: 'EntityCtrl',
- controllerAs: 'entityCtrl'
- })
- .when('/property/:id', {
- templateUrl: 'views/property.html',
- controller: 'EntityCtrl',
- controllerAs: 'entityCtrl'
- })
- .when('/propdef/:id', {
- templateUrl: 'views/propdef.html',
+ .when('/doc/:id', {
+ templateUrl: 'views/doc.html',
controller: 'EntityCtrl',
controllerAs: 'entityCtrl'
})
border-color: #eee;
}
+/* loading bar */
+
+#loading-bar .bar {
+ background: #FF8100;
+}
+
/* navs */
.nav-tabs li { cursor: pointer; }
-<div class='container-fluid'>
- <div class='page-header'>
- <h2><entity-signature mentity='mentity.intro'/></h2>
- <entity-link mentity='mentity.mpackage' /> :: {{mentity.name}}
- </div>
-
- <ul class='nav nav-tabs'>
- <li role='presentation' class='active'>
- <a data-toggle='tab' data-target='#doc'>
- <span class='glyphicon glyphicon-book'/> Doc
- </a>
- </li>
- <li role='presentation'>
- <a data-toggle='tab' data-target='#graph' ng-click="entityCtrl.loadEntityGraph()">
- <span class='glyphicon glyphicon-object-align-vertical'/> Inheritance
- </a>
- </li>
- <li role='presentation'>
- <a data-toggle='tab' data-target='#all_props'>
- <span class='glyphicon glyphicon-tags'/> All properties
- </a>
- </li>
- <li role='presentation'>
- <a data-toggle='tab' role='tab' data-target='#linearization' aria-controls='linearization' ng-click='entityCtrl.loadEntityLinearization()'>
- <span class='glyphicon glyphicon-arrow-down'/> Linearization
- </a>
- </li>
- </ul>
+<ul class='nav nav-tabs'>
+ <li role='presentation' class='active'>
+ <a data-toggle='tab' data-target='#doc'>
+ <span class='glyphicon glyphicon-book'/> Doc
+ </a>
+ </li>
+ <li role='presentation'>
+ <a data-toggle='tab' data-target='#graph' ng-click="entityCtrl.loadEntityGraph()">
+ <span class='glyphicon glyphicon-object-align-vertical'/> Inheritance
+ </a>
+ </li>
+ <li role='presentation'>
+ <a data-toggle='tab' data-target='#all_props'>
+ <span class='glyphicon glyphicon-tags'/> All properties
+ </a>
+ </li>
+ <li role='presentation'>
+ <a data-toggle='tab' role='tab' data-target='#linearization' aria-controls='linearization' ng-click='entityCtrl.loadEntityLinearization()'>
+ <span class='glyphicon glyphicon-arrow-down'/> Linearization
+ </a>
+ </li>
+</ul>
- <div class='tab-content'>
- <div role='tabpanel' class='tab-pane fade in active' id='doc'>
- <entity-doc mentity='mentity.intro'/>
+<div class='tab-content'>
+ <div role='tabpanel' class='tab-pane fade in active' id='doc'>
+ <entity-doc mentity='mentity.intro'/>
- <entity-list list-title='Parents'
- list-entities='mentity.parents'
- list-object-filter='{}' />
+ <entity-list list-title='Parents'
+ list-entities='mentity.parents'
+ list-object-filter='{}' />
- <entity-list list-title='Constructors'
- list-entities='mentity.all_mproperties'
- list-object-filter='{is_init: true}' />
+ <entity-list list-title='Constructors'
+ list-entities='mentity.all_mproperties'
+ list-object-filter='{is_init: true}' />
- <entity-list list-title='Introduced properties'
- list-entities='mentity.intro_mproperties'
- list-object-filter='{is_init: "!true"}' />
+ <entity-list list-title='Introduced properties'
+ list-entities='mentity.intro_mproperties'
+ list-object-filter='{is_init: "!true"}' />
- <entity-list list-title='Redefined properties'
- list-entities='mentity.redef_mproperties'
- list-object-filter='{is_init: "!true"}' />
- </div>
- <div role='tabpanel' class='tab-pane fade' id='all_props'>
- <entity-list list-title='All properties' list-entities='mentity.all_mproperties'
- list-object-filter='{}' />
- </div>
- <div role='tabpanel' class='tab-pane fade' id='linearization'>
- <entity-linearization
- list-title='Class definitions'
- list-entities='linearization'
- list-focus='mentity.intro' />
- </div>
- <div role='tabpanel' class='tab-pane fade' id='graph'>
- <div class='card'>
- <div class='card-body text-center'>
- <div class='graph' ng-bind-html='graph'></div>
- </div>
+ <entity-list list-title='Redefined properties'
+ list-entities='mentity.redef_mproperties'
+ list-object-filter='{is_init: "!true"}' />
+ </div>
+ <div role='tabpanel' class='tab-pane fade' id='all_props'>
+ <entity-list list-title='All properties' list-entities='mentity.all_mproperties'
+ list-object-filter='{}' />
+ </div>
+ <div role='tabpanel' class='tab-pane fade' id='linearization'>
+ <entity-linearization
+ list-title='Class definitions'
+ list-entities='linearization'
+ list-focus='mentity.intro' />
+ </div>
+ <div role='tabpanel' class='tab-pane fade' id='graph'>
+ <div class='card'>
+ <div class='card-body text-center'>
+ <div class='graph' ng-bind-html='graph'></div>
</div>
</div>
</div>
-<div class='container-fluid' ng-init='entityCtrl.loadEntityLinearization()'>
- <div class='page-header'>
- <h2><entity-signature mentity='mentity'/></h2>
- <entity-link mentity='mentity.mpackage' />
- :: <entity-link mentity='mentity.mmodule' />
- :: {{mentity.name}}
- </div>
-
- <ul class='nav nav-tabs' role='tablist'>
- <li role='presentation' class='warning'>
- <a ng-href='{{mentity.mclass.web_url}}'>
- <span class='glyphicon glyphicon-chevron-left'/> Go to class
- </a>
- </li>
- <li role='presentation' class='active'>
- <a data-toggle='tab' role='tab' data-target='#linearization' aria-controls='linearization'>
- <span class='glyphicon glyphicon-arrow-down'/> Linearization
- </a>
- </li>
- <li role='presentation'>
- <a data-toggle='tab' data-target='#code' ng-click="entityCtrl.loadEntityCode()">
- <span class='glyphicon glyphicon-console'/> Code
- </a>
- </li>
- </ul>
+<ul class='nav nav-tabs' role='tablist'>
+ <li role='presentation' class='warning'>
+ <a ng-href='{{mentity.mclass.web_url}}'>
+ <span class='glyphicon glyphicon-chevron-left'/> Go to class
+ </a>
+ </li>
+ <li role='presentation' class='active'>
+ <a data-toggle='tab' role='tab' data-target='#linearization' aria-controls='linearization'>
+ <span class='glyphicon glyphicon-arrow-down'/> Linearization
+ </a>
+ </li>
+ <li role='presentation'>
+ <a data-toggle='tab' data-target='#code' ng-click="entityCtrl.loadEntityCode()">
+ <span class='glyphicon glyphicon-console'/> Code
+ </a>
+ </li>
+</ul>
- <div class='tab-content'>
- <div role='tabpanel' class='tab-pane fade in active' id='linearization'>
- <entity-linearization
- list-title='Class definitions'
- list-entities='linearization'
- list-focus='mentity' />
- </div>
- <div role='tabpanel' class='tab-pane fade' id='code'>
- <div class='card'>
- <div class='card-body'>
- <pre ng-bind-html='code' />
- <entity-location mentity='mentity' />
- </div>
+<div class='tab-content'>
+ <div role='tabpanel' class='tab-pane fade in active' id='linearization'>
+ <entity-linearization
+ list-title='Class definitions'
+ list-entities='linearization'
+ list-focus='mentity' />
+ </div>
+ <div role='tabpanel' class='tab-pane fade' id='code'>
+ <div class='card'>
+ <div class='card-body'>
+ <pre ng-bind-html='code' />
+ <entity-location mentity='mentity' />
</div>
</div>
</div>
--- /dev/null
+<div class='container-fluid'>
+
+ <div ng-if='error' class='alert alert-danger' role='alert'>
+ <span class='glyphicon glyphicon-exclamation-sign' aria-hidden='true'></span>
+ <span class='sr-only'>Error:</span>
+ <span ng-switch='error.status'>
+ <span ng-switch-when='404'>Entity <code>{{entityId}}</code> not found!</span>
+ <span ng-switch-default>An error occured<br/>{{error.status}}: {{error.message}}</span>
+ </span>
+ </div>
+
+ <div class='page-header'>
+ <h2><entity-signature mentity='mentity' /></h2>
+ <entity-namespace mentity='mentity' />
+ </div>
+ <div ng-switch='mentity.class_name'>
+ <div ng-switch-when='MPackage'>
+ <div ng-include src='"/views/package.html"' />
+ </div>
+ <div ng-switch-when='MGroup'>
+ <div ng-include src='"/views/group.html"' />
+ </div>
+ <div ng-switch-when='MModule'>
+ <div ng-include src='"/views/module.html"' />
+ </div>
+ <div ng-switch-when='MClass'>
+ <div ng-include src='"/views/class.html"' />
+ </div>
+ <div ng-switch-when='MClassDef'>
+ <div ng-include src='"/views/classdef.html"' />
+ </div>
+ <div ng-switch-when='MMethod' ng-switch-when='MAttribute' ng-switch-when='MVirtualTypeProp'>
+ <div ng-include src='"/views/property.html"' />
+ </div>
+ <div ng-switch-when='MMethodDef' ng-switch-when='MAttributeDef' ng-switch-when='MVirtualTypeDef'>
+ <div ng-include src='"/views/propdef.html"' />
+ </div>
+ </div>
+</div>
-<div class='container-fluid'>
- <div class='page-header'>
- <h2><entity-signature mentity='mentity' /></h2>
- <entity-link mentity='mentity.mpackage' /> :: {{mentity.name}}
- </div>
-
- <ul class='nav nav-tabs'>
- <li class='active'>
- <a data-toggle='tab' data-target='#doc'>
- <span class='glyphicon glyphicon-book'/> Doc
- </a>
- </li>
- <li role='presentation'>
- <a data-toggle='tab' data-target='#graph' ng-click="entityCtrl.loadEntityGraph()">
- <span class='glyphicon glyphicon-object-align-vertical'/> Imports
- </a>
- </li>
- </ul>
+<ul class='nav nav-tabs'>
+ <li class='active'>
+ <a data-toggle='tab' data-target='#doc'>
+ <span class='glyphicon glyphicon-book'/> Doc
+ </a>
+ </li>
+ <li role='presentation'>
+ <a data-toggle='tab' data-target='#graph' ng-click="entityCtrl.loadEntityGraph()">
+ <span class='glyphicon glyphicon-object-align-vertical'/> Imports
+ </a>
+ </li>
+</ul>
- <div class='tab-content'>
- <div role='tabpanel' class='tab-pane fade in active' id='doc'>
- <entity-doc mentity='mentity'/>
+<div class='tab-content'>
+ <div role='tabpanel' class='tab-pane fade in active' id='doc'>
+ <entity-doc mentity='mentity'/>
- <entity-list list-title='Parent group' list-entities='[mentity.parent]'
- list-object-filter='{}' ng-if='mentity.parent' />
+ <entity-list list-title='Parent group' list-entities='[mentity.parent]'
+ list-object-filter='{}' ng-if='mentity.parent' />
- <entity-list list-title='Subgroups' list-entities='mentity.mgroups'
- list-object-filter='{}' />
+ <entity-list list-title='Subgroups' list-entities='mentity.mgroups'
+ list-object-filter='{}' />
- <entity-list list-title='Modules' list-entities='mentity.mmodules'
- list-object-filter='{}' />
- </div>
- <div role='tabpanel' class='tab-pane fade' id='graph'>
- <div class='card'>
- <div class='card-body text-center'>
- <div class='graph' ng-bind-html='graph'></div>
- </div>
+ <entity-list list-title='Modules' list-entities='mentity.mmodules'
+ list-object-filter='{}' />
+ </div>
+ <div role='tabpanel' class='tab-pane fade' id='graph'>
+ <div class='card'>
+ <div class='card-body text-center'>
+ <div class='graph' ng-bind-html='graph'></div>
</div>
</div>
</div>
-<div class='container-fluid'>
- <div class='page-header'>
- <h2><entity-signature mentity='mentity'/></h2>
- <entity-link mentity='mentity.mpackage' /> :: {{mentity.name}}
- </div>
-
- <ul class='nav nav-tabs'>
- <li role='presentation' class='active'>
- <a data-toggle='tab' data-target='#doc'>
- <span class='glyphicon glyphicon-book'/> Doc
- </a>
- </li>
- <li role='presentation'>
- <a data-toggle='tab' data-target='#graph' ng-click="entityCtrl.loadEntityGraph()">
- <span class='glyphicon glyphicon-object-align-vertical'/> Imports
- </a>
- </li>
- <li role='presentation'>
- <a data-toggle='tab' data-target='#code' ng-click="entityCtrl.loadEntityCode()">
- <span class='glyphicon glyphicon-console'/> Code
- </a>
- </li>
- <li role='presentation'>
- <a data-toggle='tab' data-target='#defs' ng-click="entityCtrl.loadEntityDefs()">
- <span class='glyphicon glyphicon-asterisk'/> Class definitions
- </a>
- </li>
- </ul>
+<ul class='nav nav-tabs'>
+ <li role='presentation' class='active'>
+ <a data-toggle='tab' data-target='#doc'>
+ <span class='glyphicon glyphicon-book'/> Doc
+ </a>
+ </li>
+ <li role='presentation'>
+ <a data-toggle='tab' data-target='#graph' ng-click="entityCtrl.loadEntityGraph()">
+ <span class='glyphicon glyphicon-object-align-vertical'/> Imports
+ </a>
+ </li>
+ <li role='presentation'>
+ <a data-toggle='tab' data-target='#code' ng-click="entityCtrl.loadEntityCode()">
+ <span class='glyphicon glyphicon-console'/> Code
+ </a>
+ </li>
+ <li role='presentation'>
+ <a data-toggle='tab' data-target='#defs' ng-click="entityCtrl.loadEntityDefs()">
+ <span class='glyphicon glyphicon-asterisk'/> Class definitions
+ </a>
+ </li>
+</ul>
- <div class='tab-content'>
- <div role='tabpanel' class='tab-pane fade in active' id='doc'>
- <entity-doc mentity='mentity'/>
+<div class='tab-content'>
+ <div role='tabpanel' class='tab-pane fade in active' id='doc'>
+ <entity-doc mentity='mentity'/>
- <entity-list list-title='Imported modules' list-entities='mentity.imports'
- list-object-filter='{}' />
+ <entity-list list-title='Imported modules' list-entities='mentity.imports'
+ list-object-filter='{}' />
- <entity-list list-title='Introduced classes' list-entities='mentity.intro_mclasses'
- list-object-filter='{}' />
+ <entity-list list-title='Introduced classes' list-entities='mentity.intro_mclasses'
+ list-object-filter='{}' />
- <entity-list list-title='Class redefinitions' list-entities='mentity.redef_mclassdefs'
- list-object-filter='{}' />
+ <entity-list list-title='Class redefinitions' list-entities='mentity.redef_mclassdefs'
+ list-object-filter='{}' />
- </div>
- <div role='tabpanel' class='tab-pane fade' id='code'>
- <div class='card'>
- <div class='card-body'>
- <pre ng-bind-html='code' />
- <entity-location mentity='mentity' />
- </div>
+ </div>
+ <div role='tabpanel' class='tab-pane fade' id='code'>
+ <div class='card'>
+ <div class='card-body'>
+ <pre ng-bind-html='code' />
+ <entity-location mentity='mentity' />
</div>
</div>
- <div role='tabpanel' class='tab-pane fade' id='defs'>
- <entity-list list-title='Class definitions' list-entities='defs'
- list-object-filter='{}' />
- </div>
- <div class='tab-pane fade' id='graph'>
- <div class='card'>
- <div class='card-body text-center'>
- <div class='graph' ng-bind-html='graph'></div>
- </div>
+ </div>
+ <div role='tabpanel' class='tab-pane fade' id='defs'>
+ <entity-list list-title='Class definitions' list-entities='defs'
+ list-object-filter='{}' />
+ </div>
+ <div class='tab-pane fade' id='graph'>
+ <div class='card'>
+ <div class='card-body text-center'>
+ <div class='graph' ng-bind-html='graph'></div>
</div>
</div>
</div>
-<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>
- <li role='presentation'>
- <a data-toggle='tab' data-target='#graph' ng-click="entityCtrl.loadEntityGraph()">
- <span class='glyphicon glyphicon-object-align-vertical'/> Dependencies
- </a>
- </li>
- </ul>
+<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>
+ <li role='presentation'>
+ <a data-toggle='tab' data-target='#graph' ng-click="entityCtrl.loadEntityGraph()">
+ <span class='glyphicon glyphicon-object-align-vertical'/> Dependencies
+ </a>
+ </li>
+</ul>
- <div class='tab-content'>
- <div role='tabpanel' class='tab-pane fade in active' id='doc'>
- <entity-doc mentity='mentity'/>
+<div class='tab-content'>
+ <div role='tabpanel' class='tab-pane fade in active' id='doc'>
+ <entity-doc mentity='mentity'/>
- <entity-list list-title='Groups' list-entities='mentity.mgroups'
- list-object-filter='{}' />
- </div>
- <div role='tabpanel' class='tab-pane fade' id='graph'>
- <div class='card'>
- <div class='card-body text-center'>
- <div class='graph' ng-bind-html='graph'></div>
- </div>
+ <entity-list list-title='Groups' list-entities='mentity.mgroups'
+ list-object-filter='{}' />
+ </div>
+ <div role='tabpanel' class='tab-pane fade' id='graph'>
+ <div class='card'>
+ <div class='card-body text-center'>
+ <div class='graph' ng-bind-html='graph'></div>
</div>
</div>
</div>
-<div class='container-fluid' ng-init='entityCtrl.loadEntityLinearization()'>
- <div class='page-header'>
- <h2><entity-signature mentity='mentity'/></h2>
- <entity-link mentity='mentity.mpackage' />
- :: <entity-link mentity='mentity.mmodule' />
- :: <entity-link mentity='mentity.mclassdef' />
- :: {{mentity.name}}
- </div>
-
- <ul class='nav nav-tabs'>
- <li role='presentation' class='warning'>
- <a href='{{mentity.mproperty.web_url}}'>
- <span class='glyphicon glyphicon-chevron-left'/> Go to property
- </a>
- </li>
- <li role='presentation' class='active'>
- <a data-toggle='tab' role='tab' data-target='#linearization' aria-controls='linearization'>
- <span class='glyphicon glyphicon-arrow-down'/> Linearization
- </a>
- </li>
- <li role='presentation'>
- <a data-toggle='tab' data-target='#code' ng-click="entityCtrl.loadEntityCode()">
- <span class='glyphicon glyphicon-console'/> Code
- </a>
- </li>
- </ul>
+<ul class='nav nav-tabs'>
+ <li role='presentation' class='warning'>
+ <a href='{{mentity.mproperty.web_url}}'>
+ <span class='glyphicon glyphicon-chevron-left'/> Go to property
+ </a>
+ </li>
+ <li role='presentation' class='active'>
+ <a data-toggle='tab' role='tab' data-target='#linearization' aria-controls='linearization'>
+ <span class='glyphicon glyphicon-arrow-down'/> Linearization
+ </a>
+ </li>
+ <li role='presentation'>
+ <a data-toggle='tab' data-target='#code' ng-click="entityCtrl.loadEntityCode()">
+ <span class='glyphicon glyphicon-console'/> Code
+ </a>
+ </li>
+</ul>
- <div class='tab-content'>
- <div role='tabpanel' class='tab-pane fade in active' id='linearization'>
- <entity-linearization
- list-title='Class definitions'
- list-entities='linearization'
- list-focus='mentity' />
- </div>
- <div role='tabpanel' class='tab-pane fade' id='code'>
- <div class='card'>
- <div class='card-body'>
- <pre ng-bind-html='code' />
- <entity-location mentity='mentity' />
- </div>
+<div class='tab-content'>
+ <div role='tabpanel' class='tab-pane fade in active' id='linearization'>
+ <entity-linearization
+ list-title='Class definitions'
+ list-entities='linearization'
+ list-focus='mentity' />
+ </div>
+ <div role='tabpanel' class='tab-pane fade' id='code'>
+ <div class='card'>
+ <div class='card-body'>
+ <pre ng-bind-html='code' />
+ <entity-location mentity='mentity' />
</div>
</div>
</div>
-<div class='container-fluid'>
+<ul class='nav nav-tabs'>
+ <li role='presentation' class='active'>
+ <a data-toggle='tab' data-target='#doc'>
+ <span class='glyphicon glyphicon-book'/> Doc
+ </a>
+ </li>
+ <li role='presentation'>
+ <a data-toggle='tab' role='tab' data-target='#linearization' aria-controls='linearization' ng-click='entityCtrl.loadEntityLinearization()'>
+ <span class='glyphicon glyphicon-arrow-down'/> Linearization
+ </a>
+ </li>
+</ul>
- <div class='page-header'>
- <h2><entity-signature mentity='mentity.intro'/></h2>
- <entity-link mentity='mentity.mpackage' />
- :: <entity-link mentity='mentity.intro_mclassdef' />
- :: {{mentity.name}}
+<div class='tab-content'>
+ <div role='tabpanel' class='tab-pane fade in active' id='doc'>
+ <entity-doc mentity='mentity.intro'/>
</div>
-
- <ul class='nav nav-tabs'>
- <li role='presentation' class='active'>
- <a data-toggle='tab' data-target='#doc'>
- <span class='glyphicon glyphicon-book'/> Doc
- </a>
- </li>
- <li role='presentation'>
- <a data-toggle='tab' role='tab' data-target='#linearization' aria-controls='linearization' ng-click='entityCtrl.loadEntityLinearization()'>
- <span class='glyphicon glyphicon-arrow-down'/> Linearization
- </a>
- </li>
- </ul>
-
- <div class='tab-content'>
- <div role='tabpanel' class='tab-pane fade in active' id='doc'>
- <entity-doc mentity='mentity.intro'/>
- </div>
- <div role='tabpanel' class='tab-pane fade' id='linearization'>
- <entity-linearization
- list-title='Class definitions'
- list-entities='linearization'
- list-focus='mentity.intro' />
- </div>
+ <div role='tabpanel' class='tab-pane fade' id='linearization'>
+ <entity-linearization
+ list-title='Class definitions'
+ list-entities='linearization'
+ list-focus='mentity.intro' />
</div>
</div>
import doc_base
import html_components
import ordered_tree
-import web::model_html
+import model_html
redef class MEntity
# URL of this entity’s Nitdoc page.
app.use_before("/*", new RequestClock)
app.use("/api", new APIRouter(model, modelbuilder, mainmodule, catalog))
- app.use("/doc/:namespace", new DocAction(model, mainmodule, modelbuilder))
app.use("/*", new StaticHandler(toolcontext.share_dir / "nitweb", "index.html"))
app.use_after("/*", new ConsoleLog)
# Components required to build a web server about the nit model.
module web
-import web_actions
import model_api
import api_catalog
import api_graph
+++ /dev/null
-# This file is part of NIT ( http://www.nitlanguage.org ).
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# Nitcorn actions used by the nitweb server.
-module web_actions
-
-import web_views
-import uml
-
-# Display the tree of all loaded mentities.
-class TreeAction
- super ModelHandler
-
- redef fun get(req, res) do
- var model = init_model_view(req)
- var view = new HtmlHomePage(model.to_tree)
- res.send_view(view)
- end
-end
-
-# Display the doc of a MEntity.
-class DocAction
- super ModelHandler
-
- # Modelbuilder used to access sources.
- var modelbuilder: ModelBuilder
-
- redef fun get(req, res) do
- var namespace = req.param("namespace")
- var model = init_model_view(req)
- var mentity = find_mentity(model, namespace)
- if mentity == null then
- res.error(404)
- return
- end
- var view = new HtmlDocPage(modelbuilder, mentity)
- res.send_view(view)
- end
-end
end
end
-# A NitView is rendered by an action.
-interface NitView
- # Renders this view and returns something that can be written to a HTTP response.
- fun render: Writable is abstract
-end
-
-redef class HttpResponse
- # Render a NitView as response.
- fun send_view(view: NitView, status: nullable Int) do send(view.render, status)
-end
-
redef class MEntity
# URL to `self` within the web interface.
- fun web_url: String is abstract
+ fun web_url: String do return "/doc/" / full_name
# URL to `self` within the JSON api.
fun api_url: String do return "/api/entity/" / full_name
end
end
-redef class MPackage
- redef var web_url = "/package/{full_name}" is lazy
-end
-
-redef class MGroup
- redef var web_url = "/group/{full_name}" is lazy
-end
-
redef class MModule
- redef var web_url = "/module/{full_name}" is lazy
-
redef fun api_json(handler) do
var obj = super
obj["intro_mclassdefs"] = to_mentity_refs(collect_intro_mclassdefs(private_view))
end
redef class MClass
- redef var web_url = "/class/{full_name}" is lazy
-
redef fun api_json(handler) do
var obj = super
obj["all_mproperties"] = to_mentity_refs(collect_accessible_mproperties(private_view))
end
redef class MClassDef
- redef var web_url = "/classdef/{full_name}" is lazy
-
redef fun json do
var obj = super
obj["intro"] = to_mentity_ref(mclass.intro)
end
redef class MProperty
- redef var web_url = "/property/{full_name}" is lazy
-
redef fun json do
var obj = super
obj["intro_mclass"] = to_mentity_ref(intro_mclassdef.mclass)
end
redef class MPropDef
- redef var web_url = "/propdef/{full_name}" is lazy
-
redef fun json do
var obj = super
obj["intro"] = to_mentity_ref(mproperty.intro)
+++ /dev/null
-# This file is part of NIT ( http://www.nitlanguage.org ).
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# Nitcorn actions used by the nitweb server.
-module web_views
-
-import web_base
-import model_html
-import highlight
-import markdown
-
-# Html homepage for the `nitweb` server.
-class HtmlHomePage
- super NitView
-
- # Loaded model to display.
- var tree: MEntityTree
-
- redef fun render do
- var tpl = new Template
- tpl.add new Header(1, "Loaded model")
- tpl.add tree.html_list
- return tpl
- end
-end
-
-# Display the source for each mentities
-class HtmlSourcePage
- super NitView
-
- # Modelbuilder used to access sources.
- var modelbuilder: ModelBuilder
-
- # MEntity to display
- var mentity: MEntity
-
- # HiglightVisitor used to hilight the source code
- var hl = new HighlightVisitor
-
- redef fun render do
- var tpl = new Template
- tpl.add new Header(1, "Source Code")
- tpl.add render_source
- return tpl
- end
-
- private fun render_source: Template do
- var node = modelbuilder.mentity2node(mentity)
- var tpl = new Template
- tpl.add new Header(3, "Source code")
- if node == null then
- tpl.add "<p>Source for {mentity.html_name} not found.<p>"
- else
- hl.enter_visit node
- tpl.add "<pre><code>"
- tpl.add hl.html
- tpl.add "</code></pre>"
- end
- return tpl
- end
-end
-
-# Display the mdoc of the mentities.
-class HtmlDocPage
- super HtmlSourcePage
-
- redef fun render do
- var tpl = new Template
- tpl.add new Header(1, mentity.html_name)
- tpl.add "<p>"
- tpl.add mentity.html_declaration
- tpl.add "</p>"
- tpl.add "<br>"
- var mdoc = mentity.mdoc
- if mdoc != null then
- tpl.add mdoc.content.join("\n").md_to_html
- end
- tpl.add "<br>"
- tpl.add render_source
- return tpl
- end
-end