From f28a73a30196e7e114d58b2e4fc5487d08565393 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dawid=20Ci=C4=99=C5=BCarkiewicz?= Date: Mon, 11 May 2020 00:24:15 -0700 Subject: [PATCH] Random improvements --- src/main.rs | 24 ++++++++++++++++-------- src/page/store/fs.rs | 2 +- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/main.rs b/src/main.rs index a872348..c6ff108 100644 --- a/src/main.rs +++ b/src/main.rs @@ -101,7 +101,9 @@ fn render_page_editing_view(page: Option<&page::Parsed>) -> impl RenderOnce { let body = page.source_body.clone(); let id = page.id().to_owned(); (box_html! { - form(action=".", method="post") { + form(action=".", method="post", class="pure-form") { + a(href=format!("?id={}", id),class="pure-button"){ : "Cancel" } + : " "; input(type="submit", value="Save", class="pure-button pure-button-primary"); input(type="hidden", name="id", value=id); textarea(name="body") { @@ -111,7 +113,9 @@ fn render_page_editing_view(page: Option<&page::Parsed>) -> impl RenderOnce { }) as Box } else { box_html! { - form(action=".", method="post") { + form(action=".", method="post", class="pure-form") { + a(href="javascript:history.back()",class="pure-button"){ : "Cancel" } + : " "; input(type="submit", value="Save", class="pure-button pure-button-primary"); input(type="hidden", name="_method", value="put"); textarea(name="body"); @@ -126,25 +130,28 @@ fn render_page_view(page: &page::Parsed) -> impl RenderOnce { let id_copy = id.clone(); owned_html! { div(class="pure-menu pure-menu-horizontal") { - form(action="..", method="get", class="pure-menu-item") { + form(action="..", method="get", class="pure-menu-item pure-form") { button(type="submit", class="pure-button"){ : "Up" } } - form(action="/", method="get", class="pure-menu-item") { + : " "; + form(action="/", method="get", class="pure-menu-item pure-form") { input(type="hidden", name="edit", value="true"); button(type="submit", class="pure-button button-green"){ : "New" } } - form(action=".", method="get", class="pure-menu-item") { + : " "; + form(action=".", method="get", class="pure-menu-item pure-form") { input(type="hidden", name="edit", value="true"); input(type="hidden", name="id", value=id); button(type="submit", class="pure-button pure-button-primary"){ : "Edit" } } - form(action=".", method="post", class="pure-menu-item") { + : " "; + form(action=".", method="post", class="pure-menu-item pure-form") { input(type="hidden", name="edit", value="true"); input(type="hidden", name="id", value=id_copy); input(type="hidden", name="_method", value="delete"); @@ -163,12 +170,13 @@ fn render_post_list( ) -> impl RenderOnce { owned_html! { div(class="pure-menu pure-menu-horizontal") { - form(action="..", method="get", class="pure-menu-item") { + form(action="..", method="get", class="pure-menu-item pure-form") { button(type="submit", class="pure-button"){ : "Up" } } - form(action="/", method="get", class="pure-menu-item") { + : " "; + form(action="/", method="get", class="pure-menu-item pure-form") { input(type="hidden", name="edit", value="true"); button(type="submit", class="pure-button button-green"){ : "New" diff --git a/src/page/store/fs.rs b/src/page/store/fs.rs index ac63e9e..deded34 100644 --- a/src/page/store/fs.rs +++ b/src/page/store/fs.rs @@ -54,7 +54,7 @@ impl FsStore { last_char_was_alphanum = is_alphanum; } - let initial_title = path_str.clone(); + let initial_title = path_str.to_lowercase(); let mut path = PathBuf::from(&initial_title); let mut i = 1; while let Some(_) = self.path_to_page.get(&path.with_extension("md")) {