Display brand, model, stock and price on details page
authorMarius Gavrilescu <marius@ieval.ro>
Sat, 18 Jun 2016 23:32:19 +0000 (00:32 +0100)
committerMarius Gavrilescu <marius@ieval.ro>
Sat, 18 Jun 2016 23:32:19 +0000 (00:32 +0100)
lib/App/Web/Oof.pm
static/style.css
tmpl/details.html

index 23fd09ae37ac92a72ca77e0efa9ce220f2f879ff..9c62d54214b154020c066f3554f17c82267683bc 100644 (file)
@@ -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 '/';
        }
index 0c289f1962cce6b2258ee5e4b7835b3d29e3a5db..ada92471d843518135984c3a43c254d791d77eba 100644 (file)
@@ -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;
+}
index 85deb0a21d4323b9a2885333d061e520761457aa..5f6e17ad22d972729b5fed3076301d3c0baf7b15 100644 (file)
 
 <h2>Item</h2>
 <p>Go to <a href="/">order form</a>.
+<dl>
+<dt id="dt_brand">Brand</dt><dd id="dd_brand"></dd>
+<dt id="dt_model">Model</dt><dd id="dd_model"></dd>
+<dt>Stock</dt><dd id="dd_stock"></dd>
+<dt>Price</dt><dd id="dd_price"></dd>
+</dl>
 <div id="summary"></div>
 <ul id="pictures"><li><a href="https://example.org"><img src="https:/example.org"></a></ul>
 
This page took 0.012595 seconds and 4 git commands to generate.