src/web: replace adhoc MEntity::to_json by the model_json one
authorAlexandre Terrasa <alexandre@moz-code.org>
Thu, 19 May 2016 23:36:21 +0000 (19:36 -0400)
committerAlexandre Terrasa <alexandre@moz-code.org>
Fri, 20 May 2016 00:18:55 +0000 (20:18 -0400)
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

src/web/web_actions.nit
src/web/web_base.nit

index d1f57c0..60d39c2 100644 (file)
@@ -149,19 +149,3 @@ class RandomAction
                return render_view(view)
        end
 end
-
-redef class MEntity
-
-       # Return `self` as a JsonObject.
-       fun to_json: JsonObject do
-               var obj = new JsonObject
-               obj["name"] = html_name
-               obj["namespace"] = html_full_name
-               var mdoc = self.mdoc
-               if mdoc != null then
-                       obj["synopsis"] = mdoc.content.first.html_escape
-                       obj["mdoc"] = mdoc.content.join("\n").html_escape
-               end
-               return obj
-       end
-end
index 0671cb6..f37bdb4 100644 (file)
@@ -16,8 +16,8 @@
 module web_base
 
 import model::model_views
+import model::model_json
 import nitcorn
-import json
 
 # Nitcorn server runned by `nitweb`.
 #