nitdoc: set icons for each kind of cards
[nit.git] / src / web / web_base.nit
index 587be65..c863061 100644 (file)
@@ -21,12 +21,13 @@ import doc_down
 import popcorn
 import popcorn::pop_config
 import popcorn::pop_repos
+import popcorn::pop_json
 
 # Nitweb config file.
 class NitwebConfig
        super AppConfig
 
-       redef var default_db_name = "nitweb"
+       redef fun default_db_name do return "nitweb"
 
        # Model to use.
        var model: Model
@@ -118,7 +119,6 @@ end
 #
 # Can be serialized to json.
 class APIError
-       super Jsonable
        serialize
 
        # Reponse status
@@ -147,7 +147,7 @@ end
 # * a `NSToken` for tokens like `::`, `>` and `$`
 # * a `MSRef` for references to mentities
 interface NSEntity
-       super Jsonable
+       super Serializable
 end
 
 # A reference to a MEntity that can be rendered as a link.
@@ -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)
@@ -226,7 +227,6 @@ redef class MDoc
        # Add doc down processing
        redef fun core_serialize_to(v) do
                v.serialize_attribute("html_synopsis", html_synopsis.write_to_string)
-               v.serialize_attribute("html_documentation", html_documentation.write_to_string)
        end
 end
 
@@ -278,6 +278,8 @@ redef class MClassDef
                end
                return new Namespace.from([mmodule.full_name, "$::", mclass.intro_mmodule.to_ns_ref: nullable NSEntity])
        end
+
+       redef fun web_url do return "{mclass.web_url}/lin#{full_name}"
 end
 
 redef class MProperty
@@ -317,6 +319,8 @@ redef class MPropDef
                end
                return res
        end
+
+       redef fun web_url do return "{mproperty.web_url}/lin#{full_name}"
 end
 
 redef class MClassType
@@ -336,13 +340,11 @@ redef class MVirtualType
 end
 
 redef class POSetElement[E]
-       super Jsonable
+       super Serializable
 
-       redef fun serialize_to(v) do
+       redef fun core_serialize_to(v) do
                assert self isa POSetElement[MEntity]
-               v.serialize_attribute("greaters", to_mentity_refs(greaters))
                v.serialize_attribute("direct_greaters", to_mentity_refs(direct_greaters))
                v.serialize_attribute("direct_smallers", to_mentity_refs(direct_smallers))
-               v.serialize_attribute("smallers", to_mentity_refs(smallers))
        end
 end