only show subscribe buttons when logged in

This commit is contained in:
Rimian Perkins 2019-11-14 09:47:15 +11:00
parent 75e077399b
commit 370566b570
3 changed files with 28 additions and 16 deletions

View File

@ -0,0 +1,9 @@
import computed from "ember-addons/ember-computed-decorators";
import User from "discourse/models/user";
export default Ember.Component.extend({
@computed()
currentUser() {
return User.current();
}
});

View File

@ -0,0 +1,18 @@
{{#each products as |product|}}
<div>
<h2>{{product.name}}</h2>
<p>
{{product.description}}
</p>
{{#if currentUser}}
<div class="pull-right">
{{#link-to "patrons.subscribe.show" product.id class="btn btn-primary"}}
{{i18n 'discourse_patrons.subscribe.title'}}
{{/link-to}}
</div>
{{/if}}
</div>
{{/each}}

View File

@ -1,17 +1,2 @@
{{#each model as |product|}}
<div>
<h2>{{product.name}}</h2>
<p>
{{product.description}}
</p>
<div class="pull-right">
{{#link-to "patrons.subscribe.show" product.id class="btn btn-primary"}}
{{i18n 'discourse_patrons.subscribe.title'}}
{{/link-to}}
</div>
</div>
{{/each}}
{{product-list products=model}}