changeset 561:363d07e26549

remove SimplyHTML from lucene/Web_search
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 23 Jun 2015 16:45:16 -0600
parents 2f39468680be
children 7cc9d4a53d3b
files lucene/src/luan/modules/lucene/Web_search.luan
diffstat 1 files changed, 111 insertions(+), 78 deletions(-) [+]
line wrap: on
line diff
diff -r 2f39468680be -r 363d07e26549 lucene/src/luan/modules/lucene/Web_search.luan
--- a/lucene/src/luan/modules/lucene/Web_search.luan	Tue Jun 23 07:57:10 2015 -0600
+++ b/lucene/src/luan/modules/lucene/Web_search.luan	Tue Jun 23 16:45:16 2015 -0600
@@ -1,4 +1,4 @@
-local Luan = require "luan:Luan"
+ local Luan = require "luan:Luan"
 local error = Luan.error
 local pairs = Luan.pairs or error()
 local ipairs = Luan.ipairs or error()
@@ -11,53 +11,91 @@
 local string_to_number = String.to_number or error()
 local Html = require "luan:Html"
 
+
 local M = {}
 
+local function style() %>
+			body {
+				font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
+				margin: 2em 5%;
+			}
+			h2 {
+				margin-bottom: .5em;
+			}
+			label {
+				text-align: right;
+				min-width: 6em;
+				display: inline-block;
+				margin-right: .5em;
+			}
+<%
+end
+
 local function form() %>
 <html>
 	<head>
-		<% Html.simply_html_head() %>
 		<title>Lucene Query</title>
+		<style>
+			<% style() %>
+			input {
+				margin-top: 1em;
+			}
+			input[type="text"] {
+				font: inherit;
+				padding: .5em .8em;
+				border-radius: 8px;
+				border-style: groove;
+			}
+			input[type="text"]:focus {
+				border-color: #66afe9;
+				outline: none;
+			}
+			span[tip] {
+				color: #888;
+				font-size: smaller;
+				margin-left: .5em;
+			}
+			input[type="submit"] {
+				color: white;
+				background: #337ab7;
+				border-color: #337ab7;
+				font: inherit;
+				padding: .5em;
+				border-radius: 4px;
+			}
+			input[type="submit"]:hover {
+				background: #236aa7 !important;
+			}
+		</style>
 	</head>
 	<body>
-		<div container>
-			<h3 margin-top="1.5em">Lucene Query</h3>
-			<form horizontal name="form0" method="post" margin-top="2em">
-				<div row>
-					<div colspan=2 align="right">
-						<label>Query:</label>
-					</div>
-					<div colspan=10>
-						<input name="query" size="80" autofocus />
-						<div textcolor="#888">Query examples: <i>type:user</i> or <i>+type:user +name:Joe"</i></div>
-					</div>
-				</div>
-				<div row margin-top="1em">
-					<div colspan=2 align="right">
-						<label>Max Rows:</label>
-					</div>
-					<div colspan=10>
-						<input name="rows" value="100" size="3" maxlength="5" /></p>
-					</div>
-				</div>
-				<div row margin-top="1em">
-					<div colspan=2 align="right">
-						<label>Sort:</label>
-					</div>
-					<div colspan=10>
-						<input name="sort" size="60" />
-						<div textcolor="#888">Sort examples: <i>name, id</i></div>
-					</div>
-				</div>
-				<div row margin-top="1em">
-					<div colspan=2></div>
-					<div colspan=10>
-						<input type="submit" textcolor="white" bgcolor="#337ab7" large/>
-					</div>
-				</div>
-			</form>
-		</div>
-		<% Html.simply_html_body_bottom() %>
+		<h2>Lucene Query</h2>
+		<form horizontal name="form0" method="post">
+			<div>
+				<label>Query:</label>
+				<input type=text name="query" size="80" autofocus />
+			</div>
+			<div>
+				<label></label>
+				<span tip>Query examples: <i>type:user</i> or <i>+type:user +name:Joe"</i></span>
+			</div>
+			<div>
+				<label>Max Rows:</label>
+				<input type=text name="rows" value="100" size="3" maxlength="5" />
+			</div>
+			<div>
+				<label>Sort:</label>
+				<input type=text name="sort" size="60" />
+			</div>
+			<div>
+				<label></label>
+				<span tip>Sort examples: <i>name, id</i></span>
+			</div>
+			<div>
+				<label></label>
+				<input type="submit" />
+			</div>
+		</form>
 	</body>
 </html>
 <% end
@@ -66,49 +104,44 @@
 local function result(query,sort,headers,table) %>
 <html>
 	<head>
-		<% Html.simply_html_head() %>
 		<title>Lucene Query</title>
+		<style>
+			<% style() %>
+			table {
+				border-collapse: collapse;
+				width: 100%;
+				font-size: smaller;
+			}
+			th, td {
+				text-align: left;
+				padding: .5em;
+				border: solid 1px #ddd;
+			}
+		</style>
 	</head>
 	<body>
-		<div container>
-			<h3 margin-top="1.5em">Lucene Query Results</h3>
-			<div row>
-				<div colspan=2 align="right">
-					<label>Query:</label>
-				</div>
-				<div colspan=10>
-					<b><%=Html.encode(to_string(query))%></b></p>
-				</div>
-			</div>
-			<div row>
-				<div colspan=2 align="right">
-					<label>Sort:</label>
-				</div>
-				<div colspan=10>
-					<b><%=Html.encode(to_string(sort))%></b></p>
-				</div>
-			</div>
-			<table border condensed margin-top="1.5em">
+		<h2>Lucene Query Results</h2>
+		<p><label>Query:</label> <b><%=Html.encode(to_string(query))%></b></p>
+		<p><label>Sort:</label> <b><%=Html.encode(to_string(sort))%></b></p>
+		<table>
+			<tr>
+				<th></th>
+				<% for _, header in ipairs(headers) do %>
+					<th><%=header%></th>
+				<% end %>
+			</tr>
+			<% for i, row in ipairs(table) do %>
 				<tr>
-					<th></th>
-					<% for _, header in ipairs(headers) do %>
-						<th><%=header%></th>
-					<% end %>
+					<td><%=i%></td>
+					<%
+					for col in range(1, #headers) do
+						local val = row[col]
+						%><td><%= val and repr(val) or "" %></td><%
+					end
+					%>
 				</tr>
-				<% for i, row in ipairs(table) do %>
-					<tr>
-						<td><%=i%></td>
-						<%
-						for col in range(1, #headers) do
-							local val = row[col]
-							%><td><%= val and repr(val) or "" %></td><%
-						end
-						%>
-					</tr>
-				<% end %>
-			</table>
-		</div>
-		<% Html.simply_html_body_bottom() %>
+			<% end %>
+		</table>
 	</body>
 </html>
 <% end