Skip to content
This repository has been archived by the owner on Aug 11, 2021. It is now read-only.

Commit

Permalink
feat: allow multiple images and image links
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjamin Coe committed May 18, 2016
1 parent 843ffc8 commit ae14eaf
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 115 deletions.
86 changes: 0 additions & 86 deletions annotation.js

This file was deleted.

36 changes: 9 additions & 27 deletions annotation.mustache
Expand Up @@ -3,42 +3,24 @@
<li><h3>{{name}}</h3></li>
{{#each rows}}
<li>
<<<<<<< HEAD
{{#each this}}
{{#isArray this}}
{{#each this}}
<a href="{{{url}}}">{{text}}</a>{{#unless @last}},{{/unless}}
{{/each}}
=======
{{#hasKey this "image"}}
{{#each image}}
{{#hasKey this "href"}}
<a href="{{{href}}}" style="border: none;text-decoration: none;"><img src="{{{url}}}" alt="{{text}}" /></a>
{{else}}
<img src="{{{url}}}" alt="{{text}}" />
{{/hasKey}}
{{/each}}
{{/hasKey}}
{{#hasKey this "link"}}
{{#isArray this "link"}}
{{#each link}}
<a href="{{{url}}}">{{text}}</a>{{#unless @last}},{{/unless}}
{{/each}}
{{else}}
<a href="{{{link.url}}}">{{link.text}}</a>
>>>>>>> Add conditional image link rendering and tests
{{/isArray}}
{{#hasKey this "_image"}}
{{#each image}}
{{#each this}}
{{#hasKey this "href"}}
<a href="{{{href}}}" style="border: none;text-decoration: none;"><img src="{{{url}}}" alt="{{text}}" /></a>
<a href="{{{href}}}" style="border: none;text-decoration: none;"><img src="{{{url}}}" alt="{{text}}" /></a>
{{else}}
<img src="{{{url}}}" alt="{{text}}" />
{{/hasKey}}
{{/each}}
{{/hasKey}}
{{#hasKey this "_link"}}
<a href="{{{url}}}">{{text}}</a>
{{#isArray this}}
{{#each this}}
<a href="{{{url}}}">{{text}}</a>{{#unless @last}},{{/unless}}
{{/each}}
{{else}}
<a href="{{{url}}}">{{text}}</a>
{{/isArray}}
{{/hasKey}}
{{#hasKey this "_text"}}
<span>{{{text}}}</span>
Expand Down
4 changes: 2 additions & 2 deletions test.js
Expand Up @@ -275,7 +275,7 @@ describe('annotation-poller', function () {

it('renders image links', function (done) {
$.mockjax({
url: endpoint,
url: endpoint,
responseText: [{
id: 'test-image-link',
name: 'image link test integration',
Expand All @@ -301,7 +301,7 @@ describe('annotation-poller', function () {

it('renders multiple images and image links', function (done) {
$.mockjax({
url: endpoint,
url: endpoint,
responseText: [{
id: 'test-multi-mixed-image-links',
name: 'mixed multi image links',
Expand Down

0 comments on commit ae14eaf

Please sign in to comment.