Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add store URL to display

  • Loading branch information...
commit ffc7264a9550c61ce50fc366b9a05927d9296f88 1 parent 286be80
@swaroopch authored
Showing with 31 additions and 17 deletions.
  1. +29 −16 resources/book.mustache
  2. +2 −1  src/isbnnetinclj2/store.clj
View
45 resources/book.mustache
@@ -35,25 +35,33 @@
<dd>{{binding}}</dd>
{{/binding}}
{{/info}}
+ {{^info}}
+ <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);
+ };
+ </script>
+ {{/info}}
</dl>
</div>
<div class="span4">
{{#info}}
- <p>
- {{#image}}
- {{#imageLink}}
- <a href="{{imageLink}}"
- ><img src="{{image}}"
- alt="{{title}}"
- title="Image {{#imageSource}}from {{imageSource}}{{/imageSource}} {{#title}}for {{title}}{{/title}}"/></a>
- {{/imageLink}}
- {{^imageLink}}
- <img src="{{image}}"
- alt="{{title}}"
- title="Image {{#imageSource}}from {{imageSource}}{{/imageSource}} for {{#title}}{{title}}{{/title}}"/>
- {{/imageLink}}
- {{/image}}
- </p>
+ <p>
+ {{#image}}
+ {{#imageLink}}
+ <a href="{{imageLink}}"
+ ><img src="{{image}}"
+ alt="{{title}}"
+ title="Image {{#imageSource}}from {{imageSource}}{{/imageSource}} {{#title}}for {{title}}{{/title}}"/></a>
+ {{/imageLink}}
+ {{^imageLink}}
+ <img src="{{image}}"
+ alt="{{title}}"
+ title="Image {{#imageSource}}from {{imageSource}}{{/imageSource}} for {{#title}}{{title}}{{/title}}"/>
+ {{/imageLink}}
+ {{/image}}
+ </p>
{{/info}}
</div>
</div>
@@ -66,7 +74,12 @@
<table class="table table-bordered table-hover">
{{#price}}
<tr>
- <th>{{name}}</th>
+ {{#url}}
+ <th><a href="{{url}}">{{name}}</a></th>
+ {{/url}}
+ {{^url}}
+ <th>{{name}}</th>
+ {{/url}}
<td>{{amount}}</td>
</tr>
{{/price}}
View
3  src/isbnnetinclj2/store.clj
@@ -282,7 +282,8 @@
price (sort-by val (:price data))
price (map #(apply hash-map
[:name (string/capitalize (name (key %)))
- :amount (val %)])
+ :amount (val %)
+ :url ((get-in stores [(key %) :url]) isbn)])
price)
price (map #(if (= Integer/MAX_VALUE (:amount %))
(merge % {:amount "N/A"})

0 comments on commit ffc7264

Please sign in to comment.
Something went wrong with that request. Please try again.