]> gitweb.factorcode.org Git - factor.git/commitdiff
webapps.help: remove frames. Fixes #242.
authorJohn Benediktsson <mrjbq7@gmail.com>
Fri, 14 Oct 2011 05:09:30 +0000 (22:09 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Fri, 14 Oct 2011 05:09:30 +0000 (22:09 -0700)
basis/help/html/html.factor
basis/help/html/stylesheet.css
extra/webapps/help/help.factor
extra/webapps/help/help.xml [deleted file]
extra/webapps/help/search.xml
extra/websites/concatenative/concatenative.factor

index 7e8be77d4da108cd6599d35a32c1b56142fb6f7e..29174b61273018d1e797f692284784d27d6c9dbf 100644 (file)
@@ -60,14 +60,28 @@ M: f topic>filename* drop \ f topic>filename* ;
 
 M: topic url-of topic>filename ;
 
-: help-stylesheet ( -- string )
+: help-stylesheet ( -- xml )
     "vocab:help/html/stylesheet.css" ascii file-contents
     [XML <style><-></style> XML] ;
 
+: help-navbar ( -- xml )
+    [XML
+        <div class="navbar">
+        <b> Factor Documentation </b> |
+        <a href="/">Home</a> |
+        <a href="article-conventions.html">Glossary</a> |
+        <form method="post" action="/search" style="display:inline;">
+            <input name="search" type="text"/>
+            <button type="submit">Search</button>
+        </form>
+        <a href="http://factorcode.org" style="float:right; padding: 4px;">factorcode.org</a>
+        </div>
+     XML] ;
+
 : help>html ( topic -- xml )
-    [ article-title ]
+    [ article-title " - Factor Documentation" append ]
     [ drop help-stylesheet ]
-    [ [ print-topic ] with-html-writer ]
+    [ [ print-topic ] with-html-writer help-navbar prepend ]
     tri simple-page ;
 
 : generate-help-file ( topic -- )
index c56a19bc9a94d9edd76eaf69f2cc7c838d17b1e9..b0ae275b7faaea78af084d835f14319996ed88f2 100644 (file)
@@ -2,3 +2,11 @@ a:link { text-decoration: none; color: #104e8b; }
 a:visited { text-decoration: none; color: #104e8b; }
 a:active { text-decoration: none; color: #104e8b; }
 a:hover { text-decoration: underline; color: #104e8b; }
+
+.navbar {
+    background-color: #eeeee0;
+    padding: 5px;
+    border: 1px solid #ccc;
+    font:9pt "Lucida Grande", "Lucida Sans Unicode", verdana, geneva, sans-serif;
+    margin-bottom: 10px;
+}
index 17d3d361c652a8f1180ae8efe83ee33cd9ed1e13..af53af5c104adfa60e53dcde186b754b700d0a14 100644 (file)
@@ -1,9 +1,11 @@
 ! Copyright (C) 2008 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors db.sqlite furnace.actions furnace.alloy kernel
-http.server.dispatchers http.server.static furnace.redirection
-urls validators locals io.files io.directories help.html
-html.forms html.components http.server namespaces ;
+USING: accessors db.sqlite furnace.actions furnace.alloy
+furnace.redirection help.html help.topics html.components
+html.forms html.templates.chloe http.server
+http.server.dispatchers http.server.static io.directories
+io.files kernel locals namespaces sequences unicode.categories
+urls ;
 IN: webapps.help
 
 TUPLE: help-webapp < dispatcher ;
@@ -15,36 +17,34 @@ M: result link-href href>> ;
 :: <search-action> ( help-dir -- action )
     <page-action>
         { help-webapp "search" } >>template
-
         [
-            {
-                { "search" [ 1 v-min-length 50 v-max-length v-one-line ] }
-            } validate-params
-
-            help-dir [
-                "search" value article-apropos "articles" set-value
-                "search" value word-apropos "words" set-value
-                "search" value vocab-apropos "vocabs" set-value
-            ] with-directory
+            "search" param [ blank? ] trim [
+                help-dir [
+                    [ article-apropos "articles" set-value ]
+                    [ word-apropos "words" set-value ]
+                    [ vocab-apropos "vocabs" set-value ] tri
+                ] with-directory
+            ] unless-empty
 
             { help-webapp "search" } <chloe-content>
         ] >>submit ;
 
+: help-url ( topic -- url )
+    topic>filename "$help-webapp/content/" prepend >url ;
+
 : <main-action> ( -- action )
-    <page-action>
-        { help-webapp "help" } >>template ;
+    <action>
+        [ "handbook" >link help-url <redirect> ] >>display ;
 
-:: <help-webapp> ( help-dir help-db -- webapp )
+:: <help-webapp> ( help-dir -- webapp )
     help-webapp new-dispatcher
         <main-action> "" add-responder
-        help-dir <search-action> help-db [ <alloy> ] when* "search" add-responder
+        help-dir <search-action> "search" add-responder
         help-dir <static> "content" add-responder
         "resource:basis/definitions/icons/" <static> "icons" add-responder ;
 
 : run-help-webapp ( -- )
-    "resource:temp/docs"
-    "resource:help.db" <sqlite-db>
-    <help-webapp>
+    "resource:temp/docs" <help-webapp>
         main-responder set-global
     8080 httpd drop ;
 
diff --git a/extra/webapps/help/help.xml b/extra/webapps/help/help.xml
deleted file mode 100644 (file)
index 7718b10..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE html 
-     PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
-     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
-
-<t:chloe xmlns:t="http://factorcode.org/chloe/1.0">
-
-       <html xmlns="http://www.w3.org/1999/xhtml">
-               <head>
-                       <title>Factor Documentation</title>
-                       <t:base t:href="$help-webapp" />
-               </head>
-
-               <frameset cols="30%, 70%">
-                       <frame src="search" name="search" />
-                       <frame src="content/article-handbook.html" name="content" />
-               </frameset>
-       </html>
-
-</t:chloe>
index 97b096c3bedb08208b09bd61e5f387ef06609b05..fa261476179686a195b47be2658e7348331b4ee6 100644 (file)
@@ -5,72 +5,80 @@
 <t:chloe xmlns:t="http://factorcode.org/chloe/1.0">
 
 <html xmlns="http://www.w3.org/1999/xhtml">
-       <head>
-               <t:base t:href="$help-webapp/content/" />
+    <head>
 
-               <style>
-                       body { font-family: sans-serif; font-size: 85%; }
-                       a:link { text-decoration: none; color: #00004c; }
-                       a:visited { text-decoration: none; color: #00004c; }
-                       a:active { text-decoration: none; color: #00004c; }
-                       a:hover { text-decoration: underline; color: #00004c; }
-                       span.error { display: block; color: red; }
-               </style>
-       </head>
+        <t:base t:href="$help-webapp/content/" />
+        <title>Search - Factor Documentation</title>
+        <style>
+            a:link { text-decoration: none; color: #104e8b; }
+            a:visited { text-decoration: none; color: #104e8b; }
+            a:active { text-decoration: none; color: #104e8b; }
+            a:hover { text-decoration: underline; color: #104e8b; }
 
-       <body>
-               <h1><t:a t:href="$help-webapp/content/article-handbook.html"
-                       target="content">Factor documentation</t:a></h1>
+            body {
+                font-family: sans-serif; font-style: normal
+                font-size: 12pt;
+            }
 
-               <p>This is the <a href="http://factorcode.org" target="_top">Factor</a>
-               documentation, generated offline from a
-               <code>load-all</code> image. If you want, you can also browse the
-               documentation from within the <a href="http://factorcode.org" target="_top">Factor</a> UI.</p>
-               
-               <p>You may search article titles below; for example, try searching for "HTTP".</p>
-               
-               <t:form t:action="$help-webapp/search">
-                       <t:field t:name="search" />
-                       <button type="submit">Search</button>
-               </t:form>
-               
-               <t:if t:value="articles">
-                       <hr/>
-                       
-                       <h2>Articles</h2>
-                       
-                       <ul>
-                               <t:each t:name="articles">
-                                       <li> <t:link t:name="value" t:target="content" /> </li>
-                               </t:each>
-                       </ul>
-               </t:if>
-               
-               <t:if t:value="vocabs">
-                       <hr/>
-                       
-                       <h2>Vocabularies</h2>
-                       
-                       <ul>
-                               <t:each t:name="vocabs">
-                                       <li> <t:link t:name="value" t:target="content" /> </li>
-                               </t:each>
-                       </ul>
-               </t:if>
-               
-               <t:if t:value="words">
-                       <hr/>
-                       
-                       <h2>Words</h2>
-                       
-                       <ul>
-                               <t:each t:name="words">
-                                       <li> <t:link t:name="value" t:target="content" /> </li>
-                               </t:each>
-                       </ul>
-               </t:if>
+            .navbar {
+                background-color: #eeeee0;
+                padding: 5px;
+                border: 1px solid #ccc;
+                font:9pt "Lucida Grande", "Lucida Sans Unicode", verdana, geneva, sans-serif;
+                margin-bottom: 10px;
+            }
 
-       </body>
+            h2 { background-color: #f5f5f5; color: #222; }
+            hr { border: 0; background-color: #ccc; color: #ccc; height: 1px; }
+        </style>
+    </head>
+
+    <body>
+        <div class="navbar">
+        <b> Factor Documentation </b> |
+        <a href="/">Home</a> |
+        <a href="article-conventions.html">Glossary</a> |
+        <t:form t:action="$help-webapp/search" style="display:inline;">
+            <t:field t:name="search" />
+            <button type="submit">Search</button>
+        </t:form>
+        <a href="http://factorcode.org" style="float:right; padding: 4px;" >factorcode.org</a>
+        </div>
+
+        <t:if t:value="articles">
+            <h2>Articles</h2>
+            <ul>
+                <t:each t:name="articles">
+                    <li> <t:link t:name="value" /> </li>
+                </t:each>
+            </ul>
+        </t:if>
+
+        <t:if t:value="vocabs">
+            <h2>Vocabularies</h2>
+            <ul>
+                <t:each t:name="vocabs">
+                    <li> <t:link t:name="value" /> </li>
+                </t:each>
+            </ul>
+        </t:if>
+
+        <t:if t:value="words">
+            <h2>Words</h2>
+            <ul>
+                <t:each t:name="words">
+                    <li> <t:link t:name="value" /> </li>
+                </t:each>
+            </ul>
+        </t:if>
+
+        <hr />
+        <p>This is the <a href="http://factorcode.org" target="_top">Factor</a>
+        documentation, generated offline from a
+        <code>load-all</code> image. If you want, you can also browse the
+        documentation from within the <a href="http://factorcode.org" target="_top">Factor</a> UI.</p>
+
+    </body>
 </html>
 
 </t:chloe>
index 792dee293f0a31a6641f10df135766d287555460..8e7c40ae72ddbb9c5114d8049ef22fd97c534c8b 100644 (file)
@@ -89,7 +89,7 @@ SYMBOLS: key-password key-file dh-file ;
         <pastebin> <factor-recaptcha> <login-config> <factor-boilerplate> "pastebin" add-responder
         <planet> <login-config> <factor-boilerplate> "planet" add-responder
         <mason-app> <login-config> <factor-boilerplate> "mason" add-responder
-        "/tmp/docs/" <help-webapp> "docs" add-responder
+        "/tmp/docs/" <help-webapp> "docs" add-responder
     website-db <alloy>
     main-responder set-global ;
 
@@ -108,7 +108,7 @@ SYMBOLS: key-password key-file dh-file ;
         <pastebin> <factor-recaptcha> <login-config> <factor-boilerplate> website-db <alloy> "paste.factorcode.org" add-responder
         <planet> <login-config> <factor-boilerplate> website-db <alloy> "planet.factorcode.org" add-responder
         <mason-app> <login-config> <factor-boilerplate> website-db <alloy> "builds.factorcode.org" add-responder
-        home "docs" append-path website-db <help-webapp> "docs.factorcode.org" add-responder
+        home "docs" append-path <help-webapp> "docs.factorcode.org" add-responder
         home "cgi" append-path <gitweb> "gitweb.factorcode.org" add-responder
     main-responder set-global ;