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

disqus: show comments-count when disqus_shortname present #283

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions app/helpers/monologue/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,14 @@ def social_icon(foundicon, url, setting)
end
end
end

def disqus_comments_count_for url
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use def with parentheses when there are parameters.

return if Monologue::Config.disqus_shortname.blank?

content_tag :span, data: {monologue: 'disqus'} do
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Space inside { missing.
Space inside } missing.
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

content_tag :a, href: "#{url}#disqus_thread" do
end
end
end
end
end
4 changes: 1 addition & 3 deletions app/views/monologue/posts/_post_header.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
<span data-monologue="user">
<%= post.user.name %>
</span>
<span data-monologue="disqus">
<a href="<%= post.full_url + "#disqus_thread" %>"></a>
</span>
<%= disqus_comments_count_for(post.full_url) %>
</div>
</header>