nitweb: remove useless modules since Angular app introduction
authorAlexandre Terrasa <alexandre@moz-code.org>
Sat, 28 May 2016 20:08:43 +0000 (16:08 -0400)
committerAlexandre Terrasa <alexandre@moz-code.org>
Wed, 22 Jun 2016 01:26:49 +0000 (21:26 -0400)
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

src/nitweb.nit
src/web/web.nit
src/web/web_actions.nit [deleted file]
src/web/web_base.nit
src/web/web_views.nit [deleted file]

index 355fd6a..2e4e1d2 100644 (file)
@@ -68,7 +68,6 @@ private class NitwebPhase
 
                app.use_before("/*", new RequestClock)
                app.use("/api", new APIRouter(model, modelbuilder, mainmodule, catalog))
-               app.use("/doc/:namespace", new DocAction(model, mainmodule, modelbuilder))
                app.use("/*", new StaticHandler(toolcontext.share_dir / "nitweb", "index.html"))
                app.use_after("/*", new ConsoleLog)
 
index 8bb1e19..be5d2d1 100644 (file)
@@ -15,7 +15,6 @@
 # Components required to build a web server about the nit model.
 module web
 
-import web_actions
 import model_api
 import api_catalog
 import api_graph
diff --git a/src/web/web_actions.nit b/src/web/web_actions.nit
deleted file mode 100644 (file)
index cb193fd..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-# This file is part of NIT ( http://www.nitlanguage.org ).
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# Nitcorn actions used by the nitweb server.
-module web_actions
-
-import web_views
-import uml
-
-# Display the tree of all loaded mentities.
-class TreeAction
-       super ModelHandler
-
-       redef fun get(req, res) do
-               var model = init_model_view(req)
-               var view = new HtmlHomePage(model.to_tree)
-               res.send_view(view)
-       end
-end
-
-# Display the doc of a MEntity.
-class DocAction
-       super ModelHandler
-
-       # Modelbuilder used to access sources.
-       var modelbuilder: ModelBuilder
-
-       redef fun get(req, res) do
-               var namespace = req.param("namespace")
-               var model = init_model_view(req)
-               var mentity = find_mentity(model, namespace)
-               if mentity == null then
-                       res.error(404)
-                       return
-               end
-               var view = new HtmlDocPage(modelbuilder, mentity)
-               res.send_view(view)
-       end
-end
index 476e68f..145f80c 100644 (file)
@@ -87,17 +87,6 @@ abstract class APIHandler
        end
 end
 
-# A NitView is rendered by an action.
-interface NitView
-       # Renders this view and returns something that can be written to a HTTP response.
-       fun render: Writable is abstract
-end
-
-redef class HttpResponse
-       # Render a NitView as response.
-       fun send_view(view: NitView, status: nullable Int) do send(view.render, status)
-end
-
 redef class MEntity
 
        # URL to `self` within the web interface.
diff --git a/src/web/web_views.nit b/src/web/web_views.nit
deleted file mode 100644 (file)
index d8f8c9f..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-# This file is part of NIT ( http://www.nitlanguage.org ).
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# Nitcorn actions used by the nitweb server.
-module web_views
-
-import web_base
-import model_html
-import highlight
-import markdown
-
-# Html homepage for the `nitweb` server.
-class HtmlHomePage
-       super NitView
-
-       # Loaded model to display.
-       var tree: MEntityTree
-
-       redef fun render do
-               var tpl = new Template
-               tpl.add new Header(1, "Loaded model")
-               tpl.add tree.html_list
-               return tpl
-       end
-end
-
-# Display the source for each mentities
-class HtmlSourcePage
-       super NitView
-
-       # Modelbuilder used to access sources.
-       var modelbuilder: ModelBuilder
-
-       # MEntity to display
-       var mentity: MEntity
-
-       # HiglightVisitor used to hilight the source code
-       var hl = new HighlightVisitor
-
-       redef fun render do
-               var tpl = new Template
-               tpl.add new Header(1, "Source Code")
-               tpl.add render_source
-               return tpl
-       end
-
-       private fun render_source: Template do
-               var node = modelbuilder.mentity2node(mentity)
-               var tpl = new Template
-               tpl.add new Header(3, "Source code")
-               if node == null then
-                       tpl.add "<p>Source for {mentity.html_name} not found.<p>"
-               else
-                       hl.enter_visit node
-                       tpl.add "<pre><code>"
-                       tpl.add hl.html
-                       tpl.add "</code></pre>"
-               end
-               return tpl
-       end
-end
-
-# Display the mdoc of the mentities.
-class HtmlDocPage
-       super HtmlSourcePage
-
-       redef fun render do
-               var tpl = new Template
-               tpl.add new Header(1, mentity.html_name)
-               tpl.add "<p>"
-               tpl.add mentity.html_declaration
-               tpl.add "</p>"
-               tpl.add "<br>"
-               var mdoc = mentity.mdoc
-               if mdoc != null then
-                       tpl.add mdoc.content.join("\n").md_to_html
-               end
-               tpl.add "<br>"
-               tpl.add render_source
-               return tpl
-       end
-end