Add organization blogs
This commit is contained in:
parent
99fc3d1015
commit
5fff6b1510
27 changed files with 1119 additions and 630 deletions
9
templates/organization/add-member.html
Normal file
9
templates/organization/add-member.html
Normal file
|
@ -0,0 +1,9 @@
|
|||
{% extends "organization/home-base.html" %}
|
||||
|
||||
{% block org_js %}
|
||||
{{ form.media.js }}
|
||||
{% endblock %}
|
||||
|
||||
{% block middle_content %}
|
||||
{% include "organization/form.html" %}
|
||||
{% endblock %}
|
19
templates/organization/blog/add.html
Normal file
19
templates/organization/blog/add.html
Normal file
|
@ -0,0 +1,19 @@
|
|||
{% extends "organization/home-base.html" %}
|
||||
|
||||
{% block three_col_js %}
|
||||
{{ form.media.js }}
|
||||
{% include "organization/home-js.html" %}
|
||||
{% endblock %}
|
||||
|
||||
{% block three_col_media %}
|
||||
{{ form.media.css }}
|
||||
<style>
|
||||
#org-field-wrapper-visible, #org-field-wrapper-sticky {
|
||||
display: contents;
|
||||
}
|
||||
</style>
|
||||
{% endblock %}
|
||||
|
||||
{% block middle_content %}
|
||||
{% include "organization/form.html" %}
|
||||
{% endblock %}
|
28
templates/organization/blog/pending.html
Normal file
28
templates/organization/blog/pending.html
Normal file
|
@ -0,0 +1,28 @@
|
|||
{% extends "organization/home-base.html" %}
|
||||
|
||||
{% block middle_content %}
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
{{_('Blog')}}
|
||||
</th>
|
||||
<th>
|
||||
{{_('Author')}}
|
||||
</th>
|
||||
<th>
|
||||
{{_('Post time')}}
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for blog in blogs %}
|
||||
<tr>
|
||||
<td><a href="{{url('edit_organization_blog', organization.id, organization.slug, blog.id)}}">{{blog.title}}</a></td>
|
||||
<td>{{link_users(blog.authors.all())}}</td>
|
||||
<td>{{- blog.publish_on|date(_("N j, Y, g:i a")) -}}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% endblock %}
|
|
@ -1,6 +1,6 @@
|
|||
{% extends "base.html" %}
|
||||
{% extends "organization/home-base.html" %}
|
||||
|
||||
{% block js_media %}
|
||||
{% block org_js %}
|
||||
{{ form.media.js }}
|
||||
<script type="text/javascript">
|
||||
window.django = {jQuery: $};
|
||||
|
@ -27,22 +27,15 @@
|
|||
</script>
|
||||
{% endblock %}
|
||||
|
||||
{% block media %}
|
||||
{% block three_col_media %}
|
||||
{{ form.media.css }}
|
||||
<link rel="stylesheet" href="{{ static('admin/css/widgets.css') }}" type="text/css">
|
||||
<link rel="stylesheet" href="{{ static('admin/css/pagedown.css') }}" type="text/css">
|
||||
<link rel="stylesheet" href="{{ static('problem_edit.css') }}" type="text/css">
|
||||
<style>
|
||||
#id_about {
|
||||
width: 500px;
|
||||
#org-field-wrapper-is_open {
|
||||
display: contents;
|
||||
}
|
||||
</style>
|
||||
{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<form action="" method="post" class="form-area" style="width:100%">
|
||||
{% csrf_token %}
|
||||
<table border="0" style="text-align:left">{{ form.as_table() }}</table>
|
||||
<button type="submit">{{ _('Update') }}</button>
|
||||
</form>
|
||||
{% endblock %}
|
||||
{% block middle_content %}
|
||||
{% include "organization/form.html" %}
|
||||
{% endblock %}
|
||||
|
|
24
templates/organization/form.html
Normal file
24
templates/organization/form.html
Normal file
|
@ -0,0 +1,24 @@
|
|||
<form action="" method="post">
|
||||
{% csrf_token %}
|
||||
{% if form.errors %}
|
||||
<div class="alert alert-danger alert-dismissable">
|
||||
<a href="#" class="close">x</a>
|
||||
{{ form.non_field_errors() }}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% for field in form %}
|
||||
{% if not field.is_hidden %}
|
||||
<div style="margin-bottom: 1em;">
|
||||
{{ field.errors }}
|
||||
<label for="{{field.id_for_label }}"><b>{{ field.label }}:</b></label>
|
||||
<div class="org-field-wrapper" id="org-field-wrapper-{{field.html_name }}">
|
||||
{{ field }}
|
||||
</div>
|
||||
{% if field.help_text %}
|
||||
<i>{{ field.help_text|safe }}</i>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
<button type="submit">{{ _('Save') }}</button>
|
||||
</form>
|
21
templates/organization/home-base.html
Normal file
21
templates/organization/home-base.html
Normal file
|
@ -0,0 +1,21 @@
|
|||
{% extends "three-column-content.html" %}
|
||||
|
||||
{% block three_col_js %}
|
||||
{% include "organization/home-js.html" %}
|
||||
{% block org_js %}{% endblock %}
|
||||
{% endblock %}
|
||||
|
||||
{% block left_sidebar %}
|
||||
{% include "organization/org-left-sidebar.html" %}
|
||||
{% endblock %}
|
||||
|
||||
{% block right_sidebar %}
|
||||
{% include "organization/org-right-sidebar.html" %}
|
||||
{% endblock %}
|
||||
|
||||
{% block middle_title %}
|
||||
{% if title %}
|
||||
<center><h2>{{ title }}</h2></center>
|
||||
<br/>
|
||||
{% endif %}
|
||||
{% endblock %}
|
25
templates/organization/home-js.html
Normal file
25
templates/organization/home-js.html
Normal file
|
@ -0,0 +1,25 @@
|
|||
<script type="text/javascript">
|
||||
$(function () {
|
||||
$('.time-remaining').each(function () {
|
||||
count_down($(this));
|
||||
});
|
||||
$('.leave-organization').click(function () {
|
||||
if (confirm('{{ _('Are you sure you want to leave this organization?') }}\n' +
|
||||
{% if organization.is_open %}
|
||||
'{{ _('You will have to rejoin to show up on the organization leaderboard.') }}'
|
||||
{% else %}
|
||||
'{{ _('You will have to request membership in order to join again.') }}'
|
||||
{% endif %}
|
||||
)) {
|
||||
$(this).parent().submit();
|
||||
}
|
||||
});
|
||||
|
||||
$(document).ready(function () {
|
||||
$('.control-button').click(function(e) {
|
||||
e.preventDefault();
|
||||
$('#control-panel').toggle("fast");
|
||||
})
|
||||
});
|
||||
});
|
||||
</script>
|
|
@ -1,79 +1,31 @@
|
|||
{% extends "three-column-content.html" %}
|
||||
{% block three_col_media %}
|
||||
<style>
|
||||
.leave-organization, .leave-organization:hover {
|
||||
color: red;
|
||||
}
|
||||
#control-list li {
|
||||
border-bottom: 1px solid black;
|
||||
}
|
||||
#pending-count-box {
|
||||
float: right;
|
||||
text-align: center;
|
||||
background: red;
|
||||
color: white;
|
||||
border-radius: 3px;
|
||||
padding-left: 0.3em;
|
||||
padding-right: 0.3em;
|
||||
}
|
||||
</style>
|
||||
{% endblock %}
|
||||
|
||||
{% block three_col_js %}
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
$('.time-remaining').each(function () {
|
||||
count_down($(this));
|
||||
});
|
||||
$('.leave-organization').click(function () {
|
||||
if (confirm('{{ _('Are you sure you want to leave this organization?') }}\n' +
|
||||
{% if organization.is_open %}
|
||||
'{{ _('You will have to rejoin to show up on the organization leaderboard.') }}'
|
||||
{% else %}
|
||||
'{{ _('You will have to request membership in order to join again.') }}'
|
||||
{% endif %}
|
||||
)) {
|
||||
$(this).parent().submit();
|
||||
}
|
||||
});
|
||||
|
||||
$(document).ready(function () {
|
||||
$('.control-button').click(function(e) {
|
||||
e.preventDefault();
|
||||
$('#control-panel').toggle("fast");
|
||||
})
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
{% block left_sidebar %}
|
||||
{% include "organization/org-left-sidebar.html" %}
|
||||
{% endblock %}
|
||||
{% extends "organization/home-base.html" %}
|
||||
|
||||
{% block title_ruler %}{% endblock %}
|
||||
{% block middle_content %}
|
||||
{% block before_posts %}{% endblock %}
|
||||
|
||||
{% block middle_title %}
|
||||
<div class="page-title">
|
||||
<div class="tabs">
|
||||
<h2>{{title}}</h2>
|
||||
<span class="spacer"></span>
|
||||
|
||||
{% if request.user.is_authenticated %}
|
||||
{% if is_member or can_edit %}
|
||||
|
||||
{% elif organization.is_open or can_edit %}
|
||||
<form method="post" action="{{ url('join_organization', organization.id, organization.slug) }}">
|
||||
{% csrf_token %}
|
||||
<input type="submit" class="unselectable button" value="{{ _('Join organization') }}" style="margin-right: 1em">
|
||||
</form>
|
||||
{% else %}
|
||||
<a href="{{ url('request_organization', organization.id, organization.slug) }}"
|
||||
class="unselectable button">{{ _('Request membership') }}</a>
|
||||
{% endif %}
|
||||
<h2>{{title}}</h2>
|
||||
<span class="spacer"></span>
|
||||
|
||||
{% if request.user.is_authenticated %}
|
||||
{% if is_member or can_edit %}
|
||||
{% elif organization.is_open or can_edit %}
|
||||
<form method="post" action="{{ url('join_organization', organization.id, organization.slug) }}">
|
||||
{% csrf_token %}
|
||||
<input type="submit" class="unselectable button" value="{{ _('Join') }}" style="margin-right: 1em">
|
||||
</form>
|
||||
{% else %}
|
||||
<a href="{{ url('request_organization', organization.id, organization.slug) }}"
|
||||
class="unselectable button">{{ _('Request membership') }}</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block middle_content %}
|
||||
{% block before_posts %}{% endblock %}
|
||||
{% if is_member or can_edit %}
|
||||
{% for post in posts %}
|
||||
{% include "blog/content.html" %}
|
||||
|
@ -95,56 +47,3 @@
|
|||
{% endif %}
|
||||
{% block after_posts %}{% endblock %}
|
||||
{% endblock %}
|
||||
|
||||
{% block right_sidebar %}
|
||||
<div class="right-sidebar">
|
||||
{% if (is_member or can_edit) %}
|
||||
{% include 'contests-countdown.html' %}
|
||||
{% endif %}
|
||||
{% if is_member or can_edit %}
|
||||
<div class="blog-sidebox sidebox">
|
||||
<h3>{{ _('About') }}<i class="fa fa-info-circle"></i></h3>
|
||||
<div class="sidebox-content">
|
||||
<div style="margin: 0.3em;">
|
||||
{% cache 3600 'organization_html' organization.id MATH_ENGINE %}
|
||||
{{ organization.about|markdown('organization-about', MATH_ENGINE)|reference|str|safe }}
|
||||
{% endcache %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if can_edit %}
|
||||
<div id="control-panel" class="blog-sidebox sidebox">
|
||||
<h3>{{ _('Controls') }} <i class="fa fa-cog"></i></h3>
|
||||
<ul id="control-list" class="sidebox-content" style="padding: 1em;">
|
||||
<li>
|
||||
<div>
|
||||
<a href="{{ url('edit_organization', organization.id, organization.slug) }}">{{ _('Edit organization') }}</a>
|
||||
</div>
|
||||
</li>
|
||||
{% if not organization.is_open %}
|
||||
<li>
|
||||
<div>
|
||||
<a href="{{ url('organization_requests_pending', organization.id, organization.slug) }}">{{ _('View requests') }}</a>
|
||||
{% if pending_count > 0 %}
|
||||
<span id="pending-count-box">
|
||||
{{pending_count}}
|
||||
</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if is_member and not can_edit %}
|
||||
<li>
|
||||
<form method="post" action="{{ url('leave_organization', organization.id, organization.slug) }}">
|
||||
{% csrf_token %}
|
||||
<a href="#" class="leave-organization">{{ _('Leave organization') }}</a>
|
||||
</form>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% include 'top-users.html' %}
|
||||
</div>
|
||||
{% endblock %}
|
|
@ -22,14 +22,13 @@
|
|||
{% endif %}
|
||||
});
|
||||
</script>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block title_ruler %}{% endblock %}
|
||||
|
||||
{% block title_row %}
|
||||
{% set tab = 'organizations' %}
|
||||
{% set title = _('Organizations') %}
|
||||
{% set title = _('Group') %}
|
||||
{% include "user/user-list-tabs.html" %}
|
||||
{% endblock %}
|
||||
|
||||
|
@ -37,7 +36,7 @@
|
|||
{% if request.user.is_authenticated %}
|
||||
<div style="margin-bottom: 0.5em">
|
||||
<input id="show-my-org-checkbox" type="checkbox" style="vertical-align: bottom;">
|
||||
<label for="show-my-org-checkbox" style="vertical-align: bottom; margin-right: 1em;">{{ _('Show my organizations only') }}</label>
|
||||
<label for="show-my-org-checkbox" style="vertical-align: bottom; margin-right: 1em;">{{ _('Show my groups only') }}</label>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
|
|
76
templates/organization/org-right-sidebar.html
Normal file
76
templates/organization/org-right-sidebar.html
Normal file
|
@ -0,0 +1,76 @@
|
|||
<div class="right-sidebar">
|
||||
{% if (is_member or can_edit) %}
|
||||
{% include 'contests-countdown.html' %}
|
||||
{% endif %}
|
||||
{% if is_member or can_edit %}
|
||||
<div class="blog-sidebox sidebox">
|
||||
<h3>{{ _('About') }}<i class="fa fa-info-circle"></i></h3>
|
||||
<div class="sidebox-content">
|
||||
<div style="margin: 0.3em;">
|
||||
{% cache 3600 'organization_html' organization.id MATH_ENGINE %}
|
||||
{{ organization.about|markdown('organization-about', MATH_ENGINE)|reference|str|safe }}
|
||||
{% endcache %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if can_edit or is_member %}
|
||||
<div id="control-panel" class="blog-sidebox sidebox">
|
||||
<h3>{{ _('Controls') }} <i class="fa fa-cog"></i></h3>
|
||||
<ul id="control-list" class="sidebox-content" style="padding: 1em;">
|
||||
{% if can_edit %}
|
||||
<li>
|
||||
<div>
|
||||
<a href="{{ url('edit_organization', organization.id, organization.slug) }}">{{ _('Edit organization') }}</a>
|
||||
</div>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if can_edit and not organization.is_open %}
|
||||
<li>
|
||||
<div>
|
||||
<a href="{{ url('organization_requests_pending', organization.id, organization.slug) }}">{{ _('View requests') }}</a>
|
||||
{% if pending_count > 0 %}
|
||||
<span id="pending-count-box">
|
||||
{{pending_count}}
|
||||
</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if can_edit %}
|
||||
<li>
|
||||
<div>
|
||||
<a href="{{ url('add_organization_member', organization.id, organization.slug) }}">{{ _('Add members') }}</a>
|
||||
</div>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if is_member %}
|
||||
<li>
|
||||
<div>
|
||||
<a href="{{ url('add_organization_blog', organization.id, organization.slug) }}">{{ _('Add blog') }}</a>
|
||||
</div>
|
||||
</li>
|
||||
{% endif %}
|
||||
<li>
|
||||
<div>
|
||||
<a href="{{ url('organization_pending_blogs', organization.id, organization.slug) }}">{{ _('Pending blogs') }}</a>
|
||||
{% if pending_blog_count > 0 %}
|
||||
<span id="pending-count-box">
|
||||
{{pending_blog_count}}
|
||||
</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
</li>
|
||||
{% if is_member and not can_edit %}
|
||||
<li>
|
||||
<form method="post" action="{{ url('leave_organization', organization.id, organization.slug) }}">
|
||||
{% csrf_token %}
|
||||
<a href="#" class="leave-organization">{{ _('Leave group') }}</a>
|
||||
</form>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% include 'top-users.html' %}
|
||||
</div>
|
|
@ -1,14 +1,7 @@
|
|||
{% extends "base.html" %}
|
||||
{% block media %}
|
||||
<style>
|
||||
th {
|
||||
text-align: left
|
||||
}
|
||||
</style>
|
||||
{% endblock %}
|
||||
{% extends "organization/home-base.html" %}
|
||||
|
||||
{% block body %}
|
||||
<table>
|
||||
{% block middle_content %}
|
||||
<table class="table">
|
||||
<tr>
|
||||
<th>{{ _('User:') }}</th>
|
||||
<td>{{ link_user(object.user) }}</td>
|
||||
|
@ -26,10 +19,8 @@
|
|||
<td>{{ object.time|date(_("N j, Y, g:i a")) }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan="2">{{ _('Reason:') }}</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" style="padding-left: 2em">{{ object.reason }}</td>
|
||||
<th>{{ _('Reason:') }}</th>
|
||||
<td>{{ object.reason }}</td>
|
||||
</tr>
|
||||
</table>
|
||||
{% endblock %}
|
|
@ -1,6 +1,6 @@
|
|||
{% extends "base.html" %}
|
||||
{% extends "organization/home-base.html" %}
|
||||
|
||||
{% block body %}
|
||||
{% block middle_content %}
|
||||
{% include "organization/requests/tabs.html" %}
|
||||
|
||||
{% if requests %}
|
||||
|
@ -16,7 +16,7 @@
|
|||
<td>{{ link_user(r.user) }}</td>
|
||||
<td>
|
||||
<a href="{{ url('request_organization_detail', object.id, object.slug, r.id) }}">
|
||||
{{- r.time|date(_("N j, Y, H:i")) -}}
|
||||
{{- r.time|date(_("N j, Y, g:i a")) -}}
|
||||
</a>
|
||||
</td>
|
||||
<td>{{ r.state }}</td>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{% extends "base.html" %}
|
||||
{% block body %}
|
||||
{% extends "organization/home-base.html" %}
|
||||
{% block middle_content %}
|
||||
{% include "messages.html" %}
|
||||
{% include "organization/requests/tabs.html" %}
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
|||
<tr id="request-{{ form.instance.id }}">
|
||||
<td>{{ form.id }}{{ link_user(form.instance.user) }}</td>
|
||||
<td><a href="{{ url('request_organization_detail', object.id, object.slug, form.instance.id) }}">
|
||||
{{ form.instance.time|date(_("N j, Y, H:i")) }}
|
||||
{{ form.instance.time|date(_("N j, Y, g:i a")) }}
|
||||
</a></td>
|
||||
<td>{{ form.state }}</td>
|
||||
<td>{{ form.instance.reason|truncatechars(50) }}</td>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{% extends "base.html" %}
|
||||
{% extends "organization/home-base.html" %}
|
||||
|
||||
{% block js_media %}
|
||||
{% block org_js %}
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
$('#id_reason').keydown(function (e) {
|
||||
|
@ -12,7 +12,7 @@
|
|||
</script>
|
||||
{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
{% block middle_content %}
|
||||
<form action="" method="post" class="form-area">
|
||||
{% csrf_token %}
|
||||
<p><label for="{{ form.reason.id_for_label }}"><b>{{ _('Your reason for joining:') }}</b></label></p>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue