Skip to content

Commit

Permalink
fix(templates): make multiline string start at the first char, not be…
Browse files Browse the repository at this point in the history
…fore
  • Loading branch information
Jerska committed Dec 9, 2015
1 parent 1c99ea2 commit 971b0f7
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 18 deletions.
27 changes: 15 additions & 12 deletions src/autocomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,11 @@ export default (options) => {
}

function header(text) {
return `
<div class="aa-header" style="background-color: ${options.colors.primary}">
return (
`<div class="aa-header" style="background-color: ${options.colors.primary}">
${text}
</div>`;
</div>`
);
}

// initialize API client
Expand Down Expand Up @@ -81,15 +82,17 @@ export default (options) => {
hint: false,
debug: true,
templates: {
footer: `<div class="ais-search-box--powered-by">
Search by
<a
href="https://www.algolia.com/?utm_source=zendesk_hc&utm_medium=link&utm_campaign=autocomplete"
class="ais-search-box--powered-by-link"
>
Algolia
</a>
</div>`
footer: (
`<div class="ais-search-box--powered-by">
Search by
<a
href="https://www.algolia.com/?utm_source=zendesk_hc&utm_medium=link&utm_campaign=autocomplete"
class="ais-search-box--powered-by-link"
>
Algolia
</a>
</div>`
)
}
}, sources).on('autocomplete:selected', (event, suggestion, dataset) => {
if (dataset === 'sections' || dataset === 'articles') {
Expand Down
12 changes: 6 additions & 6 deletions src/templates.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import Hogan from 'hogan.js';
export default {
autocomplete: {
// Autocompletion template for a section
section: Hogan.compile(`
<div class="hit-section" style="border-bottom-color: {{colors.secondary}}">
section: Hogan.compile(
`<div class="hit-section" style="border-bottom-color: {{colors.secondary}}">
<div class="title overflow-block-container">
<span class="overflow-block">
{{{ _highlightResult.category.title.value }}} > {{{ _highlightResult.title.value }}}
Expand All @@ -15,8 +15,8 @@ export default {
</div>`),

// Autocompletion template for an article
article: Hogan.compile(`
<div class="hit-article" style="border-bottom-color: {{colors.secondary}}">
article: Hogan.compile(
`<div class="hit-article" style="border-bottom-color: {{colors.secondary}}">
<div class="title overflow-block-container">
<span class="overflow-block">
{{{ _highlightResult.title.value }}}
Expand All @@ -28,8 +28,8 @@ export default {

instantsearch: {
// Instant search result template
hit: Hogan.compile(`
<div class="search-result" style="border-color: {{colors.tertiary}}">
hit: Hogan.compile(
`<div class="search-result" style="border-color: {{colors.tertiary}}">
<a class="search-result-link" href="{{baseUrl}}{{ locale.locale }}/articles/{{ id }}">
{{{ _highlightResult.title.value }}}
</a>
Expand Down

0 comments on commit 971b0f7

Please sign in to comment.