mirror of
https://github.com/DMOJ/online-judge.git
synced 2024-11-25 16:32:37 +08:00
New settings for disabling comments and social
This commit is contained in:
parent
86c234f2a1
commit
df99fe3e23
@ -129,6 +129,9 @@ DMOJ_THEME_DEFAULT_ACE_THEME = {
|
||||
}
|
||||
DMOJ_SELECT2_THEME = 'dmoj'
|
||||
|
||||
DMOJ_ENABLE_COMMENTS = True
|
||||
DMOJ_ENABLE_SOCIAL = True
|
||||
|
||||
MARKDOWN_STYLES = {}
|
||||
MARKDOWN_DEFAULT_STYLE = {}
|
||||
|
||||
|
@ -107,6 +107,8 @@ class PostView(TitleMixin, CommentedDetailView):
|
||||
self.object.summary or self.object.content, 'blog')
|
||||
context['meta_description'] = metadata[0]
|
||||
context['og_image'] = self.object.og_image or metadata[1]
|
||||
context['enable_comments'] = settings.DMOJ_ENABLE_COMMENTS
|
||||
context['enable_social'] = settings.DMOJ_ENABLE_SOCIAL
|
||||
|
||||
return context
|
||||
|
||||
|
@ -293,6 +293,8 @@ class ContestDetail(ContestMixin, TitleMixin, CommentedDetailView):
|
||||
problem_count=Count('id'),
|
||||
),
|
||||
)
|
||||
context['enable_comments'] = settings.DMOJ_ENABLE_COMMENTS
|
||||
context['enable_social'] = settings.DMOJ_ENABLE_SOCIAL
|
||||
return context
|
||||
|
||||
|
||||
|
@ -127,6 +127,7 @@ class ProblemSolution(SolvedProblemMixin, ProblemMixin, TitleMixin, CommentedDet
|
||||
raise Http404()
|
||||
context['solution'] = solution
|
||||
context['has_solved_problem'] = self.object.id in self.get_completed_problems()
|
||||
context['enable_comments'] = settings.DMOJ_ENABLE_COMMENTS
|
||||
return context
|
||||
|
||||
def get_comment_page(self):
|
||||
@ -201,6 +202,7 @@ class ProblemDetail(ProblemMixin, SolvedProblemMixin, CommentedDetailView):
|
||||
context['description'], 'problem')
|
||||
context['meta_description'] = self.object.summary or metadata[0]
|
||||
context['og_image'] = self.object.og_image or metadata[1]
|
||||
context['enable_comments'] = settings.DMOJ_ENABLE_COMMENTS
|
||||
|
||||
context['vote_perm'] = self.object.vote_permission_for_user(user)
|
||||
if context['vote_perm'].can_vote():
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 399f213b192a267dd6783c0ba257392081dd37e9
|
||||
Subproject commit 2681309a5ddd3482e699761488c75d9a62a626ec
|
@ -35,12 +35,18 @@
|
||||
{% endcache %}
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<span class="social">
|
||||
{{ post_to_facebook(request, post, '<i class="fa fa-facebook-official"></i>') }}
|
||||
{{ post_to_twitter(request, SITE_NAME + ':', post, '<i class="fa fa-twitter"></i>') }}
|
||||
</span>
|
||||
{% include "comments/list.html" %}
|
||||
|
||||
{% if enable_social %}
|
||||
<hr>
|
||||
<span class="social">
|
||||
{{ post_to_facebook(request, contest, '<i class="fa fa-facebook-official"></i>') }}
|
||||
{{ post_to_twitter(request, SITE_NAME + ':', contest, '<i class="fa fa-twitter"></i>') }}
|
||||
</span>
|
||||
{% endif %}
|
||||
|
||||
{% if enable_comments %}
|
||||
{% include "comments/list.html" %}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block bodyend %}
|
||||
|
@ -234,13 +234,17 @@
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<hr>
|
||||
<span class="social">
|
||||
{{ post_to_facebook(request, contest, '<i class="fa fa-facebook-official"></i>') }}
|
||||
{{ post_to_twitter(request, SITE_NAME + ':', contest, '<i class="fa fa-twitter"></i>') }}
|
||||
</span>
|
||||
{% if enable_social %}
|
||||
<hr>
|
||||
<span class="social">
|
||||
{{ post_to_facebook(request, contest, '<i class="fa fa-facebook-official"></i>') }}
|
||||
{{ post_to_twitter(request, SITE_NAME + ':', contest, '<i class="fa fa-twitter"></i>') }}
|
||||
</span>
|
||||
{% endif %}
|
||||
|
||||
{% include "comments/list.html" %}
|
||||
{% if enable_comments %}
|
||||
{% include "comments/list.html" %}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block description_end %}{% endblock %}
|
||||
|
@ -37,9 +37,12 @@
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
{{ solution.content|markdown('solution', MATH_ENGINE)|reference|str|safe }}
|
||||
</div>
|
||||
<hr>
|
||||
{% include "comments/list.html" %}
|
||||
</div>
|
||||
|
||||
{% if enable_comments %}
|
||||
<hr>
|
||||
{% include "comments/list.html" %}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block bodyend %}
|
||||
|
@ -342,7 +342,7 @@
|
||||
<p class="no-comments-message">{{ _('No clarifications have been made at this time.') }}</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% else %}
|
||||
{% elif enable_comments %}
|
||||
{% include "comments/list.html" %}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
Loading…
Reference in New Issue
Block a user