Add organization private pages

This commit is contained in:
cuom1999 2020-12-27 23:45:58 -06:00
parent 4c3441b197
commit 4502dbf6b9
14 changed files with 369 additions and 156 deletions

52
templates/blog/blog.html Normal file
View file

@ -0,0 +1,52 @@
{% extends "base.html" %}
{% block js_media %}
{% include "comments/media-js.html" %}
{% endblock %}
{% block media %}
{% include "comments/media-css.html" %}
{% endblock %}
{% block header %}
{% if post.is_editable_by(request.user) %}
<div class="title-line-action">[<a href="{{ url('admin:judge_blogpost_change', post.id) }}">{{ _('Edit') }}</a>]</div>
{% endif %}
{% endblock %}
{% block body %}
<div class="post-full">
<div class="time">
{% with authors=post.authors.all() %}
{% if authors %}
<span class="post-authors">{{ link_users(authors) }}</span>
{% endif %}
{% endwith %}
<span class="post-time">
{% trans time=post.publish_on|date(_("N j, Y, g:i a")) %}
posted on {{ time }}
{% endtrans %}
</span>
</div>
<div class="body content-description">
{% cache 86400 'post_content' post.id MATH_ENGINE %}
{{ post.content|markdown('blog', MATH_ENGINE)|reference|str|safe}}
{% endcache %}
</div>
</div>
<hr>
<span class="social">
{{ post_to_gplus(request, post, '<i class="fa fa-google-plus-square"></i>') }}
{{ 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" %}
{% endblock %}
{% block bodyend %}
{{ super() }}
{% if REQUIRE_JAX %}
{% include "mathjax-load.html" %}
{% endif %}
{% include "comments/math.html" %}
{% endblock %}

View file

@ -1,53 +1,40 @@
{% extends "base.html" %}
{% block js_media %}
{% include "comments/media-js.html" %}
{% endblock %}
{% block media %}
{% include "comments/media-css.html" %}
{% endblock %}
{% block header %}
{% if perms.judge.change_blogpost %}
<div class="title-line-action">[<a href="{{ url('admin:judge_blogpost_change', post.id) }}">{{ _('Edit') }}</a>]
</div>
{% endif %}
{% endblock %}
{% block body %}
<div class="post-full">
<div class="time">
<section class="{% if post.sticky %}sticky {% endif %}post">
<span style="float:right">
<span class="time">
{%- if post.sticky %}<i title="Sticky" class="fa fa-star fa-fw"></i>{% endif -%}
{% with authors=post.authors.all() %}
{% if authors %}
{%- if authors -%}
<span class="post-authors">{{ link_users(authors) }}</span>
{% endif %}
{%- endif -%}
{% endwith %}
<span class="post-time">
{% trans time=post.publish_on|date(_("N j, Y, g:i a")) %}
posted on {{ time }}
{% endtrans %}
</span>
</div>
<div class="body content-description">
{% cache 86400 'post_content' post.id MATH_ENGINE %}
{{ post.content|markdown('blog', MATH_ENGINE)|reference|str|safe}}
{% endcache %}
</div>
</div>
<hr>
<span class="social">
{{ post_to_gplus(request, post, '<i class="fa fa-google-plus-square"></i>') }}
{{ 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>') }}
{{ relative_time(post.publish_on, abs=_('posted on {time}'), rel=_('posted {time}')) -}}
</span>
<span>
<a href="{{ url('blog_post', post.id, post.slug) }}#comments" class="blog-comment-count-link">
<i class="fa fa-comments blog-comment-icon"></i>
<span class="blog-comment-count">
{{- post_comment_counts[post.id] or 0 -}}
</span>
</a>
</span>
</span>
{% include "comments/list.html" %}
{% endblock %}
{% block bodyend %}
{{ super() }}
{% if REQUIRE_JAX %}
{% include "mathjax-load.html" %}
<h2 class="title">
<a href="{{ url('blog_post', post.id, post.slug) }}">{{ post.title }}</a>
</h2>
{% if post.is_organization_private and show_organization_private_icon %}
<div class="organization-tags">
{% for org in post.organizations.all() %}
<span class="organization-tag">
<a href="{{ org.get_absolute_url() }}">
<i class="fa fa-lock"></i> {{ org.name }}
</a>
</span>
{% endfor %}
</div>
{% endif %}
{% include "comments/math.html" %}
{% endblock %}
<div class="summary content-description">
{% cache 86400 'post_summary' post.id %}
{{ post.summary|default(post.content, true)|markdown('blog', 'svg', lazy_load=True)|reference|str|safe }}
{% endcache %}
</div>
</section>

View file

@ -27,18 +27,6 @@
margin-top: 0.6em;
}
.comment-count {
font-size: 12px;
}
.comment-icon {
padding: 0.1em 0.2em 0 0.5em;
}
.comment-count-link {
color: #555;
}
.own-open-tickets .title a, .open-tickets .title a {
display: block;
}
@ -103,35 +91,9 @@
<div class="blog-content sidebox">
<h3>{{ _('News') }} <i class="fa fa-terminal"></i></h3>
<div class="sidebox-content">
{% set show_organization_private_icon=True %}
{% for post in posts %}
<section class="{% if post.sticky %}sticky {% endif %}post">
<span style="float:right;">
<span class="time">
{%- if post.sticky %}<i title="Sticky" class="fa fa-star fa-fw"></i>{% endif -%}
{% with authors=post.authors.all() %}
{%- if authors -%}
<span class="post-authors">{{ link_users(authors) }}</span>
{%- endif -%}
{% endwith %}
{{ relative_time(post.publish_on, abs=_('posted on {time}'), rel=_('posted {time}')) -}}
</span><span class="comment-data">
<a href="{{ url('blog_post', post.id, post.slug) }}#comments" class="comment-count-link">
<i class="fa fa-comments comment-icon"></i><span class="comment-count">
{{- post_comment_counts[post.id] or 0 -}}
</span>
</a>
</span>
</span>
<h2 class="title">
<a href="{{ url('blog_post', post.id, post.slug) }}">{{ post.title }}</a>
</h2>
<div class="summary content-description">
{% cache 86400 'post_summary' post.id %}
{{ post.summary|default(post.content, true)|markdown('blog', 'svg', lazy_load=True)|reference|str|safe }}
{% endcache %}
</div>
</section>
{% include "blog/content.html" %}
{% endfor %}
</div>
{% if page_obj.num_pages > 1 %}