From e568be04e83fdcd72b5740fdb1ec701d02cb8473 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Sun, 13 Aug 2017 16:06:26 -0400 Subject: [PATCH] Refactor footer message to use a component --- .../templates/components/footer-message.hbs | 5 ++++ .../discourse/templates/discovery/topics.hbs | 26 +++++-------------- 2 files changed, 12 insertions(+), 19 deletions(-) create mode 100644 app/assets/javascripts/discourse/templates/components/footer-message.hbs diff --git a/app/assets/javascripts/discourse/templates/components/footer-message.hbs b/app/assets/javascripts/discourse/templates/components/footer-message.hbs new file mode 100644 index 00000000000..65e3a460df9 --- /dev/null +++ b/app/assets/javascripts/discourse/templates/components/footer-message.hbs @@ -0,0 +1,5 @@ +{{#if education}}
{{{education}}}
{{/if}} +

+ {{message}} + {{yield}} +

diff --git a/app/assets/javascripts/discourse/templates/discovery/topics.hbs b/app/assets/javascripts/discourse/templates/discovery/topics.hbs index fb1a079d265..9d65972904c 100644 --- a/app/assets/javascripts/discourse/templates/discovery/topics.hbs +++ b/app/assets/javascripts/discourse/templates/discovery/topics.hbs @@ -64,28 +64,16 @@ {{d-icon "check"}} {{i18n 'topics.bulk.dismiss_new'}} {{/if}} - {{#if latest}} -
- {{{footerEducation}}} -
-

- {{footerMessage}} + {{#footer-message education=footerEducation message=footerMessage tagName=""}} + {{#if latest}} {{#if canCreateTopicOnCategory}}{{i18n 'topic.suggest_create_topic'}}{{/if}} -

- {{else}} - {{#if top}} -

- {{#link-to "discovery.categories"}}{{i18n 'topic.browse_all_categories'}}{{/link-to}}, {{#link-to 'discovery.latest'}}{{i18n 'topic.view_latest_topics'}}{{/link-to}} {{i18n 'or'}} {{i18n 'filters.top.other_periods'}} + {{else if top}} + {{#link-to "discovery.categories"}}{{i18n 'topic.browse_all_categories'}}{{/link-to}}, {{#link-to 'discovery.latest'}}{{i18n 'topic.view_latest_topics'}}{{/link-to}} {{i18n 'or'}} {{i18n 'filters.top.other_periods'}} {{top-period-buttons period=period action="changePeriod"}} -

{{else}} -
- {{{footerEducation}}} -
-

- {{footerMessage}}{{#link-to "discovery.categories"}} {{i18n 'topic.browse_all_categories'}}{{/link-to}} {{i18n 'or'}} {{#link-to 'discovery.latest'}}{{i18n 'topic.view_latest_topics'}}{{/link-to}} -

+ {{#link-to "discovery.categories"}} {{i18n 'topic.browse_all_categories'}}{{/link-to}} {{i18n 'or'}} {{#link-to 'discovery.latest'}}{{i18n 'topic.view_latest_topics'}}{{/link-to}} {{/if}} - {{/if}} + {{/footer-message}} + {{/if}}