nitweb: remove dependencies from `model_html` to `model_collect`
authorAlexandre Terrasa <alexandre@moz-code.org>
Wed, 16 Dec 2015 00:02:46 +0000 (19:02 -0500)
committerAlexandre Terrasa <alexandre@moz-code.org>
Sat, 19 Dec 2015 05:55:17 +0000 (00:55 -0500)
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

src/web/model_html.nit

index 157b1de..6d67e2d 100644 (file)
@@ -16,7 +16,6 @@
 module model_html
 
 import model
-import model::model_collect
 import doc::doc_down
 import html::bootstrap
 
@@ -374,10 +373,23 @@ redef class MClassDef
        redef fun css_classes do
                var set = new HashSet[String]
                if is_intro then set.add "intro"
-               for m in mclass.intro.collect_modifiers do set.add m.to_cmangle
-               for m in collect_modifiers do set.add m.to_cmangle
+               for m in mclass.intro.modifiers do set.add m.to_cmangle
+               for m in modifiers do set.add m.to_cmangle
                return set.to_a
        end
+
+
+       # List of all modifiers like redef, private etc.
+       var modifiers: Array[String] is lazy do
+               var res = new Array[String]
+               if not is_intro then
+                       res.add "redef"
+               else
+                       res.add mclass.visibility.to_s
+               end
+               res.add mclass.kind.to_s
+               return res
+       end
 end
 
 redef class MProperty
@@ -464,10 +476,36 @@ redef class MPropDef
        redef fun css_classes do
                var set = new HashSet[String]
                if is_intro then set.add "intro"
-               for m in mproperty.intro.collect_modifiers do set.add m.to_cmangle
-               for m in collect_modifiers do set.add m.to_cmangle
+               for m in mproperty.intro.modifiers do set.add m.to_cmangle
+               for m in modifiers do set.add m.to_cmangle
                return set.to_a
        end
+
+       # List of all modifiers like redef, private, abstract, intern, fun etc.
+       var modifiers: Array[String] is lazy do
+               var res = new Array[String]
+               if not is_intro then
+                       res.add "redef"
+               else
+                       res.add mproperty.visibility.to_s
+               end
+               var mprop = self
+               if mprop isa MVirtualTypeDef then
+                       res.add "type"
+               else if mprop isa MMethodDef then
+                       if mprop.is_abstract then
+                               res.add "abstract"
+                       else if mprop.is_intern then
+                               res.add "intern"
+                       end
+                       if mprop.mproperty.is_init then
+                               res.add "init"
+                       else
+                               res.add "fun"
+                       end
+               end
+               return res
+       end
 end
 
 redef class MAttributeDef