nitweb/angular: add linearization directives
authorAlexandre Terrasa <alexandre@moz-code.org>
Tue, 7 Jun 2016 13:39:10 +0000 (09:39 -0400)
committerAlexandre Terrasa <alexandre@moz-code.org>
Tue, 7 Jun 2016 15:56:36 +0000 (11:56 -0400)
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

share/nitweb/directives/entity/defcard.html [new file with mode: 0644]
share/nitweb/directives/entity/linearization.html [new file with mode: 0644]
share/nitweb/javascripts/entities.js

diff --git a/share/nitweb/directives/entity/defcard.html b/share/nitweb/directives/entity/defcard.html
new file mode 100644 (file)
index 0000000..2c0b9c8
--- /dev/null
@@ -0,0 +1,26 @@
+<div class='card card-xl' ng-class='{active: focus.full_name == definition.full_name}'>
+       <div class='card-body'>
+               <h5 class='text-muted'>
+                       <span ng-if='definition.is_intro'>
+                               <span class='glyphicon glyphicon-plus' /> Introduction</span>
+                       </span>
+                       <span ng-if='!definition.is_intro'>
+                               <span class='glyphicon glyphicon-asterisk' /> Redefinition</span>
+                       </span>
+                       <span ng-if='definition.mclass'>
+                               of <entity-link mentity='definition.mclass' />
+                       </span>
+                       <span ng-if='definition.mproperty'>
+                               of <entity-link mentity='definition.mproperty' />
+                       </span>
+                       <span ng-if='definition.mclassdef'>
+                               in <entity-link mentity='definition.mmodule' />
+                               :: <entity-link mentity='definition.mclassdef' />
+                       </span>
+                       <span ng-if='!definition.mclassdef'>
+                               in <entity-link mentity='definition.mmodule' />
+                       </span>
+               </h5>
+               <entity-location mentity='definition' />
+       </div>
+</div>
diff --git a/share/nitweb/directives/entity/linearization.html b/share/nitweb/directives/entity/linearization.html
new file mode 100644 (file)
index 0000000..afdde43
--- /dev/null
@@ -0,0 +1,11 @@
+<div class='entity-list' ng-if='listEntities.length'>
+       <h3>{{listTitle}}</h3>
+       <div class='card-list'>
+               <div ng-repeat='def in listEntities'>
+                       <entity-def definition='def' focus='listFocus' />
+                       <h4 ng-if='!$last' class='text-muted text-center'>
+                               <span class='glyphicon glyphicon-chevron-up'></span>
+                       </h4>
+               </div>
+       </div>
+</div>
index c54f515..d1cad5f 100644 (file)
                                }
                        };
                })
+
+               .directive('entityLinearization', function() {
+                       return {
+                               restrict: 'E',
+                               scope: {
+                                       listEntities: '=',
+                                       listTitle: '@',
+                                       listFocus: '='
+                               },
+                               templateUrl: '/directives/entity/linearization.html'
+                       };
+               })
+
+               .directive('entityDef', ['Model', function(Model, Code) {
+                       return {
+                               restrict: 'E',
+                               scope: {
+                                       definition: '=',
+                                       focus: '='
+                               },
+                               link: function ($scope, element, attrs) {
+                                       $scope.$watch("definition", function() {
+                                               /*.loadEntityDefs($scope.definition.full_name,
+                                                       function(data) {
+                                                               $scope.mentity = data;
+                                                       }, function(err) {
+                                                               $scope.error = err;
+                                                       });
+                                               Model.loadEntityCode($scope.definition.full_name,
+                                                       function(data) {
+                                                               $scope.code = data;
+                                                       }, function(err) {
+                                                               $scope.error = err;
+                                                       });*/
+                                       });
+                               },
+                               templateUrl: '/directives/entity/defcard.html'
+                       };
+               }])
 })();