From 9baa8c1a0fbe68502ba24cb68cdde32ee5146c11 Mon Sep 17 00:00:00 2001 From: tuxmain Date: Thu, 10 Dec 2020 12:19:03 +0100 Subject: [PATCH] More style, ad detail, remove price column --- Cargo.lock | 12 ++++++------ Cargo.toml | 4 ++-- src/static_files.rs | 1 + static/script1.js | 8 ++++++++ static/style1.css | 20 +++++++++++++++++++- templates/admin.html | 24 +++++++++++++++++------- templates/index.html | 25 ++++++++++++++++++------- 7 files changed, 71 insertions(+), 23 deletions(-) create mode 100644 static/script1.js diff --git a/Cargo.lock b/Cargo.lock index 8b994ff..79d25e2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -160,9 +160,9 @@ dependencies = [ [[package]] name = "const_fn" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c478836e029dcef17fb47c89023448c64f781a046e0300e257ad8225ae59afab" +checksum = "cd51eab21ab4fd6a3bf889e2d0958c0a6e3a61ad04260325e919e652a2a62826" [[package]] name = "constant_time_eq" @@ -730,9 +730,9 @@ dependencies = [ [[package]] name = "net2" -version = "0.2.36" +version = "0.2.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7cf75f38f16cb05ea017784dc6dbfd354f76c223dba37701734c4f5a9337d02" +checksum = "391630d12b68002ae1e25e8f974306474966550ad82dac6886fb8910c19568ae" dependencies = [ "cfg-if 0.1.10", "libc", @@ -1221,9 +1221,9 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" [[package]] name = "tokio" -version = "0.2.23" +version = "0.2.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6d7ad61edd59bfcc7e80dababf0f4aed2e6d5e0ba1659356ae889752dfc12ff" +checksum = "099837d3464c16a808060bb3f02263b412f6fafcb5d01c533d309985fbeebe48" dependencies = [ "bytes", "fnv", diff --git a/Cargo.toml b/Cargo.toml index 99fc94d..341705c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,13 +10,13 @@ bs58 = "0.4.0" dirs = "3.0.1" handlebars = "3.5.1" hex = "0.4.2" -http = "0.2" +http = "0.2.1" rand = "0.7.3" serde = { version = "1.0.118", features = ["derive"] } serde_json = "1.0.60" sha2 = "0.9.2" sled = "0.34.6" structopt = "0.3.21" -tokio = { version = "0.2.22", features = ["macros", "rt-threaded"] } +tokio = { version = "0.2.24", features = ["macros", "rt-threaded"] } urlencoding = "1.1.1" warp = { version = "0.2.5", default-features = false } diff --git a/src/static_files.rs b/src/static_files.rs index 226e523..c12ded0 100644 --- a/src/static_files.rs +++ b/src/static_files.rs @@ -12,6 +12,7 @@ static STATIC_FILES: &[(&str, &[u8])] = &[ include_bytes!("../static/LinBiolinum_R.otf"), ), ("background.jpg", include_bytes!("../static/background.jpg")), + ("script1.js", include_bytes!("../static/script1.js")), ]; pub fn init_static_files(dir: &Path) { diff --git a/static/script1.js b/static/script1.js new file mode 100644 index 0000000..ad8e8ac --- /dev/null +++ b/static/script1.js @@ -0,0 +1,8 @@ +function ad_detail(e, id) { + var el = document.getElementById("ad-detail-"+id); + if(el.className == "ad-detail") + el.className = "ad-detail ad-detail-no" + else + el.className = "ad-detail" + e.preventDefault(); +} diff --git a/static/style1.css b/static/style1.css index a0d6dbd..4799069 100644 --- a/static/style1.css +++ b/static/style1.css @@ -48,8 +48,26 @@ h1, h2, h3, h4 { width: 100%; } +#ads tr:hover, #ads tr:focus { + background-color: rgba(255,128,0,0.2); +} + +#ads input[type=radio] { + width: 100%; + margin: 0; +} + +.ad-detail-no { + display: none; +} + +#ads a, #ads a:visited { + text-decoration: none; + color: black; +} + fieldset { - border: 1px dashed grey; + border: 1px dashed #ff8000; } .center { diff --git a/templates/admin.html b/templates/admin.html index 9b1a5b8..46d0ee1 100644 --- a/templates/admin.html +++ b/templates/admin.html @@ -5,6 +5,7 @@ Administration | ĞMarché +
@@ -26,32 +27,41 @@
{{/if}} + {{#if ads}} + Cliquez sur une annonce pour afficher le détail.
- + {{#each ads}} - + - - + + + + {{/each}}
AnnonceQuantitéPrixVendeur
AnnonceQuantitéVendeur
{{this.ad.title}}{{this.ad.title}} {{this.ad.quantity}}{{this.ad.price}}{{#if this.ad.pubkey}}
{{this.ad.author}}
{{this.ad.pubkey}}
{{else}}{{this.ad.author}}{{/if}}
{{this.ad.author}}

+ {{#if this.ad.pubkey}}Clé publique : {{this.ad.pubkey}}
{{/if}} + Prix : {{this.ad.price}} +


- - +
Supprimer l'annonce sélectionnée - +

+ {{else}} +

Il n'y a pas encore d'annonce ici.

+ {{/if}}