From 2f1de030471417c7be33909e5787d2b42343c6a7 Mon Sep 17 00:00:00 2001 From: Marius Gavrilescu Date: Sun, 19 Jun 2016 00:32:19 +0100 Subject: [PATCH] Display brand, model, stock and price on details page --- lib/App/Web/Oof.pm | 11 +++++++++++ static/style.css | 6 +++++- tmpl/details.html | 6 ++++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/lib/App/Web/Oof.pm b/lib/App/Web/Oof.pm index 23fd09a..9c62d54 100644 --- a/lib/App/Web/Oof.pm +++ b/lib/App/Web/Oof.pm @@ -282,6 +282,17 @@ sub details_app { $tree->fid('pictures')->find('li')->iter3(\@pics, \&details_list_element); $tree->fid('jsonld')->replace_content(encode_json product_to_schemaorg '', %data); + $tree->fid('dd_stock')->replace_content($data{stock}); + $tree->fid('dd_price')->replace_content(stringify_money $data{price}); + for (qw/brand model/) { + if ($data{$_}) { + $tree->fid("dd_$_")->replace_content($data{$_}); + } else { + $tree->fid("dt_$_")->detach; + $tree->fid("dd_$_")->detach; + } + } + for my $ahref ($tree->find('a')) { $ahref->attr(href => "/form?highlight=$id") if $ahref->attr('href') eq '/'; } diff --git a/static/style.css b/static/style.css index 0c289f1..ada9247 100644 --- a/static/style.css +++ b/static/style.css @@ -124,4 +124,8 @@ footer { padding-top: 1em; font-size: 0.8em; text-align: center; -} \ No newline at end of file +} + +dt { + font-weight: bold; +} diff --git a/tmpl/details.html b/tmpl/details.html index 85deb0a..5f6e17a 100644 --- a/tmpl/details.html +++ b/tmpl/details.html @@ -12,6 +12,12 @@

Item

Go to order form. +

+
Brand
+
Model
+
Stock
+
Price
+
-- 2.39.2