society-self-service/sspromotions/jinja2/sspromotions/bulletin_preview.html
Yingtong Li e19e191a77
Add bulletin preview functionality
Also - do not send emails to those who are not subscribed
2019-02-13 14:47:31 +11:00

87 lines
2.9 KiB
HTML

{% extends 'sspromotions/base.html' %}
{#
Society Self-Service
Copyright © 2018-2019 Yingtong Li (RunasSudo)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
#}
{% block title %}Bulletin preview{% endblock %}
{% block maincontent %}
<h1>Bulletin preview</h1>
<form class="ui form" method="POST">
<div class="ui required inline grid field">
<label class="three wide column">Date</label>
<div class="eleven wide column">
<div class="ui calendar" id="cal_date">
<div class="ui input left icon grid">
<i class="calendar icon" style="z-index: 999;"></i>
<input class="sixteen wide column" type="text" name="date" value="{{ date }}">
</div>
</div>
</div>
</div>
<div class="ui inline grid field">
<label class="three wide column">Groups</label>
<div class="eleven wide column">
{% for group in groups %}
<div class="field" style="display: inline; margin-right: 1em;">
<div class="ui checkbox">
<input type="checkbox" name="group_{{ group.id }}" id="group_{{ group.id }}" checked>
<label for="group_{{ group.id }}">{{ group.name }}</label>
</div>
</div>
{% endfor %}
</div>
</div>
<div class="ui divider"></div>
<div class="ui error message"></div>
<input type="hidden" name="csrfmiddlewaretoken" value="{{ csrf_token }}">
<input class="ui primary button" type="submit" name='submit' value="Preview">
</form>
{% endblock %}
{% block head %}
{{ super() }}
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/semantic-ui-calendar@0.0.8/dist/calendar.min.css" integrity="sha256-KCHiPtYk/vfF5/6lDXpz5r5FuIYchVdai0fepwGft80=" crossorigin="anonymous">
{% endblock %}
{% block script %}
{{ super() }}
<script src="https://cdn.jsdelivr.net/npm/semantic-ui-calendar@0.0.8/dist/calendar.min.js" integrity="sha256-Pnz4CK94A8tUiYWCfg/Ko25YZrHqOKeMS4JDXVTcVA0=" crossorigin="anonymous"></script>
<script>
function leftpad(n) {
if (n < 10)
return '0' + n;
return '' + n;
}
$('#cal_date').calendar({
type: 'date',
formatter: {
date: function(date, settings) {
return date.getFullYear() + '-' + leftpad(date.getMonth() + 1) + '-' + leftpad(date.getDate());
}
},
isDisabled: function(date, mode) {
return date.getDay() !== 0; // Sunday only
}
});
</script>
{% endblock script %}