Permalink
Browse files

Fix display for 'in progress'

  • Loading branch information...
1 parent ffc7264 commit c2731b4a3d5aac2119122aa7dcc9eecb98b9c8e0 @swaroopch committed Jul 28, 2013
Showing with 34 additions and 32 deletions.
  1. +28 −28 resources/book.mustache
  2. +6 −4 src/isbnnetinclj2/store.clj
View
@@ -3,47 +3,47 @@
<div class="container-fluid">
<div class="row-fluid">
<div class="span4 offset2">
- {{#info}}
<dl>
{{#isbn}}
<dt>ISBN</dt>
<dd>{{isbn}}</dd>
{{/isbn}}
- {{#title}}
- <dt>Title</dt>
- <dd>{{title}}</dd>
- {{/title}}
+ {{#info}}
+ {{#title}}
+ <dt>Title</dt>
+ <dd>{{title}}</dd>
+ {{/title}}
- {{#author}}
- <dt>Author</dt>
- <dd>{{author}}</dd>
- {{/author}}
+ {{#author}}
+ <dt>Author</dt>
+ <dd>{{author}}</dd>
+ {{/author}}
- {{#publisher}}
- <dt>Publisher</dt>
- <dd>{{publisher}}</dd>
- {{/publisher}}
+ {{#publisher}}
+ <dt>Publisher</dt>
+ <dd>{{publisher}}</dd>
+ {{/publisher}}
- {{#year}}
- <dt>Year</dt>
- <dd>{{year}}</dd>
- {{/year}}
+ {{#year}}
+ <dt>Year</dt>
+ <dd>{{year}}</dd>
+ {{/year}}
- {{#binding}}
- <dt>Binding</dt>
- <dd>{{binding}}</dd>
- {{/binding}}
- {{/info}}
- {{^info}}
+ {{#binding}}
+ <dt>Binding</dt>
+ <dd>{{binding}}</dd>
+ {{/binding}}
+ {{/info}}
+ </dl>
+ {{^price}}
<p><em>Fetching info and prices... page will refresh automatically.</em></p>
<script type="text/javascript">
window.onload = function() {
- setTimeout("window.location.reload(true)", 10 * 1000);
+ setTimeout("window.location.reload(true)", 20 * 1000);
};
</script>
- {{/info}}
- </dl>
+ {{/price}}
</div>
<div class="span4">
{{#info}}
@@ -67,12 +67,12 @@
</div>
</div>
+{{#price}}
<div class="container-fluid">
<div class="row-fluid">
<div class="span4 offset2">
<h3>Prices</h3>
<table class="table table-bordered table-hover">
- {{#price}}
<tr>
{{#url}}
<th><a href="{{url}}">{{name}}</a></th>
@@ -82,10 +82,10 @@
{{/url}}
<td>{{amount}}</td>
</tr>
- {{/price}}
</table>
</div>
</div>
</div>
+{{/price}}
{{>footer}}
@@ -281,9 +281,9 @@
(let [data (book-data isbn)
price (sort-by val (:price data))
price (map #(apply hash-map
- [:name (string/capitalize (name (key %)))
- :amount (val %)
- :url ((get-in stores [(key %) :url]) isbn)])
+ [:name (string/capitalize (name (key %)))
+ :amount (val %)
+ :url ((get-in stores [(key %) :url]) isbn)])
price)
price (map #(if (= Integer/MAX_VALUE (:amount %))
(merge % {:amount "N/A"})
@@ -293,7 +293,9 @@
"book"
(merge
data
- {:pageTitle (get-in data [:info :title])
+ {:isbn isbn
+ :pageTitle (or (get-in data [:info :title])
+ isbn)
:price price}))))

0 comments on commit c2731b4

Please sign in to comment.