Skip to content

Commit

Permalink
Merge pull request #792 from davidbgk/790-restore-placeholders
Browse files Browse the repository at this point in the history
 Restore placeholders in search suggestions, fix #790
  • Loading branch information
davidbgk committed Feb 28, 2017
2 parents 6564aa8 + c83ef27 commit 5178cf8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

- Fix JavaScript locales handling [#786](https://github.com/opendatateam/udata/pull/786)
- Optimize images sizes for territory placeholders [#788](https://github.com/opendatateam/udata/issues/788)
- Restore placeholders in search suggestions, fix [#790](https://github.com/opendatateam/udata/issues/790)
- Fix share popover in production build [#793](https://github.com/opendatateam/udata/pull/793)

## 1.0.2 (2017-02-20)
Expand Down
8 changes: 5 additions & 3 deletions js/components/site-search.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@

<script>
import { Cache } from 'cache';
import placeholders from 'helpers/placeholders';
function group(id, name, template) {
return {id, name,
Expand Down Expand Up @@ -79,6 +80,7 @@ export default {
group('territory', this._('Territories'), 'territory'),
],
minLength: 2,
placeholders: placeholders,
}
},
computed: {
Expand All @@ -94,14 +96,14 @@ export default {
},
partials: {
default: `<div class="logo">
<img :src="item.image_url" class="avatar" width="30" height="30" alt="">
<img :src="item.image_url || placeholders.generic" class="avatar" width="30" height="30" alt="">
</div>
<p v-html="item.title | highlight query"></p>`,
organization: `<div class="logo"><img :src="item.image_url" class="avatar" width="30" height="30" alt=""></div>
organization: `<div class="logo"><img :src="item.image_url || placeholders.organization" class="avatar" width="30" height="30" alt=""></div>
<p v-html="item.name | highlight query"></p>
<small v-if="item.acronym" v-html="item.acronym | highlight query"></small>`,
territory: `<div class="logo">
<img :src="item.image_url" class="avatar" width="30" height="30" alt="">
<img :src="item.image_url || placeholders.territory" class="avatar" width="30" height="30" alt="">
</div>
<p v-html="item.title | highlight query"></p>
<small v-if="item.parent">{{ item.parent }}</small>`,
Expand Down
6 changes: 6 additions & 0 deletions js/helpers/placeholders.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ export const user = getFor('user');
*/
export const reuse = getFor('reuse');

/**
* Territory placeholder
*/
export const territory = `${config.theme_static}img/placeholder_territory_medium.png`;

/**
* Generic placeholder
*/
Expand All @@ -33,5 +38,6 @@ export default {
user,
organization,
reuse,
territory,
generic,
};

0 comments on commit 5178cf8

Please sign in to comment.