From 444faa5936d9729a5ef270ce676bfdaf5210bb47 Mon Sep 17 00:00:00 2001 From: Kjetil Orbekk Date: Sun, 9 Jul 2017 11:22:58 -0400 Subject: add: Form to add new quote --- src/data/templates/add.hbs | 74 ++++++++++++++++++++++++++++++++++++++++++++++ src/server.rs | 14 +++++++++ 2 files changed, 88 insertions(+) create mode 100644 src/data/templates/add.hbs diff --git a/src/data/templates/add.hbs b/src/data/templates/add.hbs new file mode 100644 index 0000000..1f5d782 --- /dev/null +++ b/src/data/templates/add.hbs @@ -0,0 +1,74 @@ + + + + + + Quotes fra #linux.no på freenode + + + + +
+                     _ _  
+                    | (_)_ __  _   ___  __  _ __   ___  
+              _|_|_ | | | '_ \| | | \ \/ / | '_ \ / _ \ 
+              _|_|_ | | | | | | |_| |)  ( _| | | | (_) | 
+               | |  |_|_|_| |_|\__,_/_/\_(_)_| |_|\___/ 
+             -=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=- GAMMA -=-
+
+              Legg til new quote
+
+             -=-=-=-=-=-=-=-=-=-=-
+
+
+ +
+ditt nick:
+
+dato, YYYY-MM-DD (blank for dagens dato):
+
+quote:
+
+Prøv å bruke sånn ca. samme timestamp-format (HH:MM) o.l. som eksisterende quotes :-)

+ +
+<- Tilbake til quotes + +
+
+

linoquotes v.3 © 2004-2017 Kjetil Ørbekk, Erlend Hamberg, Vidar Holen, John H. Anthony. +

Source code at https://git.orbekk.com/linoquotes-gamma.git. +

The quotes on this page are copyright their respective owners and submitters.

+
+ + + + + + diff --git a/src/server.rs b/src/server.rs index 5d30cf7..2b0cff8 100644 --- a/src/server.rs +++ b/src/server.rs @@ -27,6 +27,10 @@ fn make_renderer() -> HandlebarsEngine { "quotes".to_string(), include_str!("data/templates/quotes.hbs").to_string(), ); + templates.insert( + "add".to_string(), + include_str!("data/templates/add.hbs").to_string(), + ); e.add(Box::new(MemorySource(templates))); if let Err(r) = e.reload() { @@ -62,10 +66,20 @@ fn quotes(r: &mut Request) -> IronResult { ))) } +fn add_get(r: &mut Request) -> IronResult { + Ok(Response::with(( + status::Ok, + Header(ContentType::html()), + Template::new("add", Map::new()), + ))) +} + pub fn serve(state: State, port: u16) { let router = router!( index: get "/" => quotes, + add_get: get "/add.jsp" => add_get, + quotes_jsp: get "/quotes.jsp" => quotes, view_quote: get "/view_quote" => quotes, ); let mut chain = Chain::new(router); -- cgit v1.2.3