nitweb: add HTML view for ini commands
[nit.git] / share / nitweb / javascripts / entities.js
index 2ca4e04..4b08707 100644 (file)
                                        },
                                        controllerAs: 'vm',
                                })
+                               .state('doc.entity.license', {
+                                       url: '/license',
+                                       templateUrl: 'views/doc/license.html',
+                                       resolve: {
+                                               content: function(Model, $q, $stateParams, $state) {
+                                                       var d = $q.defer();
+                                                       Model.loadEntityLicenseContent($stateParams.id, d.resolve,
+                                                               function() {
+                                                                       $state.go('404', null, { location: false })
+                                                               });
+                                                       return d.promise;
+                                               }
+                                       },
+                                       controller: function(mentity, content) {
+                                               this.mentity = mentity;
+                                               this.content = content;
+                                       },
+                                       controllerAs: 'vm',
+                               })
+                               .state('doc.entity.contrib', {
+                                       url: '/contrib',
+                                       templateUrl: 'views/doc/contrib.html',
+                                       resolve: {
+                                               content: function(Model, $q, $stateParams, $state) {
+                                                       var d = $q.defer();
+                                                       Model.loadEntityContribContent($stateParams.id, d.resolve,
+                                                               function() {
+                                                                       $state.go('404', null, { location: false })
+                                                               });
+                                                       return d.promise;
+                                               }
+                                       },
+                                       controller: function(mentity, content) {
+                                               this.mentity = mentity;
+                                               this.content = content;
+                                       },
+                                       controllerAs: 'vm',
+                               })
                })
 
                /* Model */
                                                .error(cbErr);
                                },
 
+                               loadEntityLicenseContent: function(id, cb, cbErr) {
+                                       $http.get('/api/ini/license-content/' + id)
+                                               .success(cb)
+                                               .error(cbErr);
+                               },
+
+                               loadEntityContribContent: function(id, cb, cbErr) {
+                                       $http.get('/api/ini/contrib-content/' + id)
+                                               .success(cb)
+                                               .error(cbErr);
+                               },
+
+                               loadEntityGraph: function(id, cb, cbErr) {
+                                       $http.get('/api/graph/inheritance/' + id + '?format=svg&cdepth=3')
+                                               .success(cb)
+                                               .error(cbErr);
+                               },
+
                                search: function(q, p, n, cb, cbErr) {
                                        $http.get('/api/search?q=' + q + '&p=' + p + '&l=' + n)
                                                .success(cb)