nitdoc: set icons for each kind of cards
authorAlexandre Terrasa <alexandre@moz-code.org>
Sat, 17 Jun 2017 22:27:01 +0000 (18:27 -0400)
committerAlexandre Terrasa <alexandre@moz-code.org>
Tue, 15 Aug 2017 18:25:42 +0000 (14:25 -0400)
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

share/nitweb/directives/entity/tag.html
src/web/web_base.nit

index 7c69f1e..06955d0 100644 (file)
@@ -1,5 +1,64 @@
-<span class="glyphicon glyphicon-tag" ng-class='{
+<span>
+       <!-- package -->
+       <span ng-if='mentity.class_name == "MPackage"'>
+               <span class='glyphicon glyphicon-book text-muted' style='top: 3px' />
+       </span>
+
+       <!-- groups -->
+       <span ng-if='mentity.class_name == "MGroup"'>
+               <span class='glyphicon glyphicon-folder-close text-muted' />
+       </span>
+
+       <!-- modules -->
+       <span ng-if='mentity.class_name == "MModule"'>
+               <span class='glyphicon glyphicon-file text-muted' style='top: 2px' />
+       </span>
+
+       <!-- classes -->
+       <span ng-if='mentity.class_name == "MClass"'>
+               <span class='glyphicon glyphicon-stop' ng-class='{
+                       "text-success": mentity.visibility == "public",
+                       "text-warning": mentity.visibility == "protected",
+                       "text-danger": mentity.visibility == "private",
+               }' />
+       </span>
+
+       <!-- classdefs -->
+       <span ng-if='mentity.class_name == "MClassDef"' ng-class='{
                "text-success": mentity.visibility == "public",
                "text-warning": mentity.visibility == "protected",
                "text-danger": mentity.visibility == "private",
-}' />
+       }'>
+               <span class='glyphicon' style='top: 2px; left:2px' ng-class='{
+                       "glyphicon-plus": mentity.is_intro,
+                       "glyphicon-asterisk": !mentity.is_intro
+               }' />
+       </span>
+
+       <!-- props -->
+       <span ng-if='mentity.class_name == "MAttribute" ||
+                mentity.class_name == "MMethod" ||
+                mentity.class_name == "MVirtualTypeProp"
+       '>
+               <span class='glyphicon glyphicon-tag' ng-class='{
+                       "text-success": mentity.visibility == "public",
+                       "text-warning": mentity.visibility == "protected",
+                       "text-danger": mentity.visibility == "private",
+               }' />
+       </span>
+
+       <!-- propdefs -->
+       <span ng-if='mentity.class_name == "MAttributeDef" ||
+               mentity.class_name == "MMethodDef" ||
+               mentity.class_name == "MVirtualTypePropDef"'
+               ng-class='{
+                       "text-success": mentity.visibility == "public",
+                       "text-warning": mentity.visibility == "protected",
+                       "text-danger": mentity.visibility == "private"
+       }'>
+               <span class='glyphicon' style='top: 2px; left:2px' ng-class='{
+                       "glyphicon-plus": mentity.is_intro,
+                       "glyphicon-asterisk": !mentity.is_intro
+               }' />
+       </span>
+</span>
index d85b3f8..c863061 100644 (file)
@@ -207,6 +207,7 @@ redef class MEntityRef
                v.serialize_attribute("mdoc", mentity.mdoc_or_fallback)
                v.serialize_attribute("visibility", mentity.visibility.to_s)
                v.serialize_attribute("modifiers", mentity.collect_modifiers)
+               v.serialize_attribute("class_name", mentity.class_name)
                var mentity = self.mentity
                if mentity isa MMethod then
                        v.serialize_attribute("msignature", mentity.intro.msignature)