Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Discuss" button should be hidden on the post_item.html #245

Open
PvUtrix-zz opened this issue Jun 13, 2015 · 1 comment
Open

"Discuss" button should be hidden on the post_item.html #245

PvUtrix-zz opened this issue Jun 13, 2015 · 1 comment

Comments

@PvUtrix-zz
Copy link

What's the best way to hide the button when viewing the post details/comments page?
I've solved this the following way

{{#if showDiscussion}}
            <a href="{{pathFor 'issuePage'}}">{{pluralize commentsCount "comment"}}</a>
        {{else}}
            {{pluralize commentsCount "comment"}}
        {{/if}}        

        {{#if ownIssue}}<a href="{{pathFor 'issueEdit'}}">Edit</a>{{/if}}
      </p>
    </div>
    {{#if showDiscussion}}
    <a href="{{pathFor 'issuePage'}}" class="discuss btn btn-default">Discuss</a>
    {{/if}}
</template>

And I have the following helper checking the session variable

showDiscussion:function(){
        if(Session.get('showDiscussion'))
            return true
        else
            return false
    }

Is there a better way?

@stevenjmarsh
Copy link

Cool, I spotted the same issue. I'm not all the way through the book yet, so as of chapter 10, this code worked for me... I based the conditional on what the current page was. (show the discuss button only on the posts list page, else do not show it)

helper code...

showDiscussButton: function () {
    return Router.current().route.getName() === 'postsList';
} 

template code...

{{#if showDiscussButton}}
    <a href="{{pathFor 'postPage'}}" class="discuss btn btn-default">Discuss</a>
{{/if}}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants