Ready for review

This commit is contained in:
gnikwo 2017-11-28 14:43:05 +01:00
parent 21b24f2891
commit 5cd031f579
No known key found for this signature in database
GPG Key ID: 7498D7DF2F867695
12 changed files with 155 additions and 344 deletions

View File

@ -38,11 +38,12 @@ from django.core.exceptions import PermissionDenied
from django.shortcuts import get_object_or_404, redirect from django.shortcuts import get_object_or_404, redirect
from core.views import CanCreateMixin, CanViewMixin, CanEditMixin, CanEditPropMixin, TabedViewMixin, PageEditViewBase from core.views import CanCreateMixin, CanViewMixin, CanEditMixin, CanEditPropMixin, TabedViewMixin, PageEditViewBase
from core.views.forms import SelectDate, SelectDateTime, PosterForm from core.views.forms import SelectDate, SelectDateTime
from club.models import Club, Membership, Mailing, MailingSubscription from club.models import Club, Membership, Mailing, MailingSubscription
from sith.settings import SITH_MAXIMUM_FREE_ROLE from sith.settings import SITH_MAXIMUM_FREE_ROLE
from counter.models import Selling, Counter from counter.models import Selling, Counter
from core.models import User, PageRev from core.models import User, PageRev
from com.views import PosterListBaseView, PosterCreateBaseView, PosterEditBaseView
from com.models import Poster from com.models import Poster
from django.conf import settings from django.conf import settings
@ -600,73 +601,35 @@ class MailingAutoCleanView(View):
return redirect('club:mailing', club_id=self.mailing.club.id) return redirect('club:mailing', club_id=self.mailing.club.id)
class PosterListView(CanViewMixin, ListView): class PosterListView(CanViewMixin, PosterListBaseView):
"""List communication posters""" """List communication posters"""
current_tab = "posters"
model = Poster
template_name = 'core/poster_list.jinja'
def dispatch(self, request, *args, **kwargs):
self.club = get_object_or_404(Club, pk=kwargs['club_id'])
return super(PosterListView, self).dispatch(request, *args, **kwargs)
def get_queryset(self):
return Poster.objects.filter(club=self.club.id)
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
kwargs = super(PosterListView, self).get_context_data(**kwargs) kwargs = super(PosterListView, self).get_context_data(**kwargs)
kwargs['club'] = self.club
kwargs['app'] = "club" kwargs['app'] = "club"
kwargs['poster_create_url_name'] = "club:poster_create"
kwargs['poster_edit_url_name'] = "club:poster_edit"
kwargs['poster_list_url_name'] = "club:poster_list"
return kwargs return kwargs
class PosterCreateView(CanCreateMixin, CreateView): class PosterCreateView(CanCreateMixin, PosterCreateBaseView):
"""Create communication poster""" """Create communication poster"""
current_tab = "posters"
form_class = PosterForm
template_name = 'core/create.jinja'
success_url = reverse_lazy('club:poster_list')
def dispatch(self, request, *args, **kwargs): def get_success_url(self, **kwargs):
self.club = get_object_or_404(Club, pk=kwargs['club_id']) return reverse_lazy('club:poster_list', kwargs={'club_id': self.club.id});
self.request = request
return super(PosterCreateView, self).dispatch(request, *args, **kwargs)
def get_initial(self):
initials = super(PosterCreateView, self).get_initial()
initials['user'] = self.request.user
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
kwargs = super(PosterCreateView, self).get_context_data(**kwargs) kwargs = super(PosterCreateView, self).get_context_data(**kwargs)
kwargs['club'] = self.club
kwargs['app'] = "club" kwargs['app'] = "club"
kwargs['poster_create_url_name'] = "club:poster_create"
kwargs['poster_edit_url_name'] = "club:poster_edit"
kwargs['poster_list_url_name'] = "club:poster_list"
return kwargs return kwargs
class PosterEditView(CanEditMixin, UpdateView): class PosterEditView(CanEditMixin, PosterEditBaseView):
"""Edit communication poster""" """Edit communication poster"""
pk_url_kwarg = "poster_id"
current_tab = "posters"
form_class = PosterForm
template_name = 'core/poster_edit.jinja'
success_url = reverse_lazy('club:poster_list')
def dispatch(self, request, *args, **kwargs): def get_success_url(self):
self.club = get_object_or_404(Club, pk=kwargs['club_id']) return reverse_lazy('club:poster_list', kwargs={'club_id': self.club.id});
self.request = request
return super(PosterCreateView, self).dispatch(request, *args, **kwargs)
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
kwargs = super(PosterEditView, self).get_context_data(**kwargs) kwargs = super(PosterEditView, self).get_context_data(**kwargs)
kwargs['club'] = self.club
kwargs['app'] = "club" kwargs['app'] = "club"
kwargs['poster_create_url_name'] = "club:poster_create"
kwargs['poster_edit_url_name'] = "club:poster_edit"
kwargs['poster_list_url_name'] = "club:poster_list"
return kwargs return kwargs

View File

@ -209,6 +209,7 @@ class Poster(models.Model):
screens = models.ManyToManyField(Screen, related_name="posters") screens = models.ManyToManyField(Screen, related_name="posters")
date_begin = models.DateTimeField(blank=False, null=False, default=timezone.now) date_begin = models.DateTimeField(blank=False, null=False, default=timezone.now)
date_end = models.DateTimeField(blank=True, null=True) date_end = models.DateTimeField(blank=True, null=True)
display_time = models.IntegerField(_("display time"), blank=False, null=False, default=30)
is_moderated = models.BooleanField(_("is moderated"), default=False) is_moderated = models.BooleanField(_("is moderated"), default=False)
moderator = models.ForeignKey(User, related_name="moderated_posters", verbose_name=_("moderator"), null=True, blank=True) moderator = models.ForeignKey(User, related_name="moderated_posters", verbose_name=_("moderator"), null=True, blank=True)

View File

@ -42,7 +42,7 @@ from datetime import timedelta
from com.models import Sith, News, NewsDate, Weekmail, WeekmailArticle, Screen, Poster from com.models import Sith, News, NewsDate, Weekmail, WeekmailArticle, Screen, Poster
from core.views import CanViewMixin, CanEditMixin, CanEditPropMixin, TabedViewMixin, CanCreateMixin, QuickNotifMixin from core.views import CanViewMixin, CanEditMixin, CanEditPropMixin, TabedViewMixin, CanCreateMixin, QuickNotifMixin
from core.views.forms import SelectDateTime, PosterForm from core.views.forms import SelectDateTime
from core.models import Notification, RealGroup, User from core.models import Notification, RealGroup, User
from club.models import Club, Mailing from club.models import Club, Mailing
@ -52,6 +52,25 @@ from club.models import Club, Mailing
sith = Sith.objects.first sith = Sith.objects.first
class PosterForm(forms.ModelForm):
class Meta:
model = Poster
fields = ['name', 'file', 'club', 'screens', 'date_begin', 'date_end', 'display_time']
widgets = {
'screens': forms.CheckboxSelectMultiple,
'is_moderated': forms.HiddenInput()
}
def __init__(self, *args, **kwargs):
user = kwargs.pop('user', None)
super(PosterForm, self).__init__(*args, **kwargs)
if user:
if user.is_in_group(settings.SITH_GROUP_COM_ADMIN_ID):
self.fields['club'].queryset = Club.objects.all()
else:
self.fields['club'].queryset = Club.objects.filter(id__in=user.get_clubs_with_rights()).all()
class ComTabsMixin(TabedViewMixin): class ComTabsMixin(TabedViewMixin):
def get_tabs_title(self): def get_tabs_title(self):
return _("Communication administration") return _("Communication administration")
@ -485,56 +504,123 @@ class MailingModerateView(View):
raise PermissionDenied raise PermissionDenied
class PosterListView(IsComAdminMixin, ComTabsMixin, ListView): class PosterListBaseView(ListView):
"""List communication posters""" """List communication posters"""
current_tab = "posters" current_tab = "posters"
model = Poster model = Poster
template_name = 'core/poster_list.jinja' template_name = 'com/poster_list.jinja'
queryset = Poster.objects.all().order_by('-date_begin')
def dispatch(self, request, *args, **kwargs):
self.club = None
if 'club_id' in kwargs and kwargs['club_id']:
try:
self.club = Club.objects.get(pk=kwargs['club_id'])
except Club.DoesNotExist:
pass
return super(PosterListBaseView, self).dispatch(request, *args, **kwargs)
def get_queryset(self):
if 'club' in self.__dict__ and self.club:
return Poster.objects.filter(club=self.club.id)
else:
return Poster.objects.all().order_by('-date_begin')
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
kwargs = super(PosterListView, self).get_context_data(**kwargs) kwargs = super(PosterListBaseView, self).get_context_data(**kwargs)
kwargs['app'] = "com" kwargs['club'] = self.club
kwargs['poster_create_url_name'] = "com:poster_create"
kwargs['poster_edit_url_name'] = "com:poster_edit"
kwargs['poster_list_url_name'] = "com:poster_list"
return kwargs return kwargs
class PosterCreateView(IsComAdminMixin, ComTabsMixin, CreateView): class PosterCreateBaseView(CreateView):
"""Create communication poster""" """Create communication poster"""
current_tab = "posters" current_tab = "posters"
form_class = PosterForm form_class = PosterForm
template_name = 'core/create.jinja' template_name = 'core/create.jinja'
success_url = reverse_lazy('com:poster_list')
def get_queryset(self):
return Poster.objects.all()
def dispatch(self, request, *args, **kwargs):
self.club = None
if 'club_id' in kwargs and kwargs['club_id']:
try:
self.club = Club.objects.get(pk=kwargs['club_id'])
except Club.DoesNotExist:
pass
return super(PosterCreateBaseView, self).dispatch(request, *args, **kwargs)
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
kwargs = super(PosterEditView, self).get_context_data(**kwargs) kwargs = super(PosterCreateBaseView, self).get_context_data(**kwargs)
kwargs['app'] = "com" kwargs['club'] = self.club
kwargs['poster_create_url_name'] = "com:poster_create"
kwargs['poster_edit_url_name'] = "com:poster_edit"
kwargs['poster_list_url_name'] = "com:poster_list"
return kwargs return kwargs
def form_valid(self, form):
if not('club' in self.__dict__ and self.club):
form.instance.is_moderated = True
return super(PosterCreateBaseView, self).form_valid(form)
class PosterEditView(IsComAdminMixin, ComTabsMixin, UpdateView):
class PosterEditBaseView(UpdateView):
"""Edit communication poster""" """Edit communication poster"""
pk_url_kwarg = "poster_id" pk_url_kwarg = "poster_id"
current_tab = "posters" current_tab = "posters"
form_class = PosterForm form_class = PosterForm
template_name = 'core/poster_edit.jinja' template_name = 'com/poster_edit.jinja'
def dispatch(self, request, *args, **kwargs):
self.club = None
if 'club_id' in kwargs and kwargs['club_id']:
try:
self.club = Club.objects.get(pk=kwargs['club_id'])
except Club.DoesNotExist:
pass
return super(PosterEditBaseView, self).dispatch(request, *args, **kwargs)
def get_queryset(self):
return Poster.objects.all()
def get_context_data(self, **kwargs):
kwargs = super(PosterEditBaseView, self).get_context_data(**kwargs)
kwargs['club'] = self.club
return kwargs
def form_valid(self, form):
if 'club' in self.__dict__ and self.club:
form.instance.is_moderated = False
return super(PosterEditBaseView, self).form_valid(form)
class PosterListView(IsComAdminMixin, ComTabsMixin, PosterListBaseView):
"""List communication posters"""
current_tab = "posters"
model = Poster
template_name = 'com/poster_list.jinja'
def get_context_data(self, **kwargs):
kwargs = super(PosterListView, self).get_context_data(**kwargs)
kwargs['app'] = "com"
return kwargs
class PosterCreateView(IsComAdminMixin, ComTabsMixin, PosterCreateBaseView):
"""Create communication poster"""
success_url = reverse_lazy('com:poster_list')
def get_context_data(self, **kwargs):
kwargs = super(PosterCreateView, self).get_context_data(**kwargs)
kwargs['app'] = "com"
return kwargs
class PosterEditView(IsComAdminMixin, ComTabsMixin, PosterEditBaseView):
"""Edit communication poster"""
success_url = reverse_lazy('com:poster_list') success_url = reverse_lazy('com:poster_list')
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
kwargs = super(PosterEditView, self).get_context_data(**kwargs) kwargs = super(PosterEditView, self).get_context_data(**kwargs)
kwargs['app'] = "com" kwargs['app'] = "com"
kwargs['poster_create_url_name'] = "com:poster_create"
kwargs['poster_edit_url_name'] = "com:poster_edit"
kwargs['poster_list_url_name'] = "com:poster_list"
return kwargs return kwargs
def get_queryset(self):
return Poster.objects.all()
class PosterDeleteView(IsComAdminMixin, ComTabsMixin, DeleteView): class PosterDeleteView(IsComAdminMixin, ComTabsMixin, DeleteView):
"""Delete communication poster""" """Delete communication poster"""
@ -549,16 +635,12 @@ class PosterModerateListView(IsComAdminMixin, ComTabsMixin, ListView):
"""Moderate list communication poster""" """Moderate list communication poster"""
current_tab = "posters" current_tab = "posters"
model = Poster model = Poster
template_name = 'core/poster_moderate.jinja' template_name = 'com/poster_moderate.jinja'
queryset = Poster.objects.filter(is_moderated=False).all()
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
kwargs = super(PosterModerateListView, self).get_context_data(**kwargs) kwargs = super(PosterModerateListView, self).get_context_data(**kwargs)
kwargs['moderation_url'] = 'com:poster_moderate'
kwargs['object_list'] = Poster.objects.filter(is_moderated=False).all()
kwargs['app'] = "com" kwargs['app'] = "com"
kwargs['poster_create_url_name'] = "com:poster_create"
kwargs['poster_edit_url_name'] = "com:poster_edit"
kwargs['poster_list_url_name'] = "com:poster_list"
return kwargs return kwargs
@ -576,9 +658,6 @@ class PosterModerateView(IsComAdminMixin, ComTabsMixin, View):
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
kwargs = super(PosterModerateListView, self).get_context_data(**kwargs) kwargs = super(PosterModerateListView, self).get_context_data(**kwargs)
kwargs['app'] = "com" kwargs['app'] = "com"
kwargs['poster_create_url_name'] = "com:poster_create"
kwargs['poster_edit_url_name'] = "com:poster_edit"
kwargs['poster_list_url_name'] = "com:poster_list"
return kwargs return kwargs
@ -586,23 +665,14 @@ class ScreenListView(IsComAdminMixin, ComTabsMixin, ListView):
"""List communication screens""" """List communication screens"""
current_tab = "screens" current_tab = "screens"
model = Screen model = Screen
template_name = 'core/screen_list.jinja' template_name = 'com/screen_list.jinja'
def get_context_data(self, **kwargs):
kwargs = super(ScreenListView, self).get_context_data(**kwargs)
kwargs['app'] = "com"
kwargs['screen_create_url_name'] = "com:screen_create"
kwargs['screen_edit_url_name'] = "com:screen_edit"
kwargs['screen_list_url_name'] = "com:screen_list"
return kwargs
class ScreenSlideshowView(DetailView): class ScreenSlideshowView(DetailView):
"""Slideshow of actives posters""" """Slideshow of actives posters"""
pk_url_kwarg = "screen_id" pk_url_kwarg = "screen_id"
model = Screen model = Screen
template_name = 'core/screen_slideshow.jinja' template_name = 'com/screen_slideshow.jinja'
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
kwargs = super(ScreenSlideshowView, self).get_context_data(**kwargs) kwargs = super(ScreenSlideshowView, self).get_context_data(**kwargs)
@ -619,34 +689,16 @@ class ScreenCreateView(IsComAdminMixin, ComTabsMixin, CreateView):
success_url = reverse_lazy('com:screen_list') success_url = reverse_lazy('com:screen_list')
def get_context_data(self, **kwargs):
kwargs = super(ScreenCreateView, self).get_context_data(**kwargs)
kwargs['app'] = "com"
kwargs['screen_create_url_name'] = "com:screen_create"
kwargs['screen_edit_url_name'] = "com:screen_edit"
kwargs['screen_list_url_name'] = "com:screen_list"
return kwargs
class ScreenEditView(IsComAdminMixin, ComTabsMixin, UpdateView): class ScreenEditView(IsComAdminMixin, ComTabsMixin, UpdateView):
"""Edit communication screen""" """Edit communication screen"""
pk_url_kwarg = "screen_id" pk_url_kwarg = "screen_id"
current_tab = "screens" current_tab = "screens"
model = Screen model = Screen
fields = ['name', ] fields = ['name', ]
template_name = 'core/screen_edit.jinja' template_name = 'com/screen_edit.jinja'
success_url = reverse_lazy('com:screen_list') success_url = reverse_lazy('com:screen_list')
def get_context_data(self, **kwargs):
kwargs = super(ScreenEditView, self).get_context_data(**kwargs)
kwargs['app'] = "com"
kwargs['screen_create_url_name'] = "com:screen_create"
kwargs['screen_edit_url_name'] = "com:screen_edit"
kwargs['screen_list_url_name'] = "com:screen_list"
return kwargs
class ScreenDeleteView(IsComAdminMixin, ComTabsMixin, DeleteView): class ScreenDeleteView(IsComAdminMixin, ComTabsMixin, DeleteView):
"""Delete communication screen""" """Delete communication screen"""
pk_url_kwarg = "screen_id" pk_url_kwarg = "screen_id"

View File

@ -519,7 +519,7 @@ class User(AbstractBaseUser):
return infos return infos
def get_clubs_with_rights(self): def get_clubs_with_rights(self):
return [m.club.id for m in self.memberships.filter(end_date__gte=timezone.now()).all() if m.club.has_rights_in_club(self)] return [m.club.id for m in self.memberships.filter(models.Q(end_date__isnull=True) | models.Q(end_date__gte=timezone.now())).all() if m.club.has_rights_in_club(self)]
class AnonymousUser(AuthAnonymousUser): class AnonymousUser(AuthAnonymousUser):

View File

@ -1,6 +1,5 @@
$(document).ready(function(){ $(document).ready(function(){
wait_time = 40 * 1000;
transition_time = 1000; transition_time = 1000;
i = 0; i = 0;
@ -39,16 +38,18 @@ $(document).ready(function(){
function init_progress_bar() function init_progress_bar()
{ {
$("#slideshow #progress_bar").css("transition", "none");
$("#slideshow #progress_bar").removeClass("progress"); $("#slideshow #progress_bar").removeClass("progress");
$("#slideshow #progress_bar").addClass("init"); $("#slideshow #progress_bar").addClass("init");
} }
function start_progress_bar() function start_progress_bar(display_time)
{ {
$("#slideshow #progress_bar").removeClass("init"); $("#slideshow #progress_bar").removeClass("init");
$("#slideshow #progress_bar").addClass("progress"); $("#slideshow #progress_bar").addClass("progress");
$("#slideshow #progress_bar").css("transition", "width " + display_time + "s linear")
} }
@ -63,6 +64,7 @@ $(document).ready(function(){
next_slide = $($("#slideshow .slide").get((i + 1) % max)); next_slide = $($("#slideshow .slide").get((i + 1) % max));
next_slide.removeClass("right"); next_slide.removeClass("right");
next_slide.addClass("center"); next_slide.addClass("center");
display_time = next_slide.attr("display_time") || 2;
$("#slideshow .bullet").removeClass("active"); $("#slideshow .bullet").removeClass("active");
bullet = $("#slideshow .bullet")[(i + 1) % max]; bullet = $("#slideshow .bullet")[(i + 1) % max];
@ -76,19 +78,20 @@ $(document).ready(function(){
others_left.removeClass("left"); others_left.removeClass("left");
others_left.addClass("right"); others_left.addClass("right");
start_progress_bar(); start_progress_bar(display_time);
next_trigger = setTimeout(next, wait_time); next_trigger = setTimeout(next, display_time * 1000);
}, transition_time); }, transition_time);
} }
display_time = $("#slideshow .center").attr("display_time");
init_progress_bar(); init_progress_bar();
setTimeout(function(){ setTimeout(function(){
if(max > 1){ if(max > 1){
start_progress_bar(); start_progress_bar(display_time);
setTimeout(next, wait_time); setTimeout(next, display_time * 1000);
} }
}, 10); }, 10);

View File

@ -1,36 +1,28 @@
body{ body{
position: absolute; position: absolute;
width: 100vw; width: 100vw;
height: 100vh; height: 100vh;
padding: 0; padding: 0;
margin: 0; margin: 0;
} }
#slideshow #slideshow{
{
position: relative; position: relative;
background-color: lightgrey; background-color: lightgrey;
height: 100%; height: 100%;
* *{
{
-webkit-user-select: none; -webkit-user-select: none;
-moz-user-select: none; -moz-user-select: none;
-ms-user-select: none; -ms-user-select: none;
user-select: none; user-select: none;
} }
&:hover{ &:hover{
&::before &::before{
{
position: absolute; position: absolute;
width: 100%; width: 100%;
@ -51,9 +43,7 @@ body{
} }
&.fullscreen{
&.fullscreen
{
position: fixed; position: fixed;
width: 100%; width: 100%;
height: 100%; height: 100%;
@ -61,36 +51,23 @@ body{
left: 0; left: 0;
background: none; background: none;
&:before &:before{
{
display:none; display:none;
} }
#slides #slides{
{
height: 100vh; height: 100vh;
} }
} }
#slides #slides{
{
position: relative; position: relative;
height: 100%; height: 100%;
overflow: hidden; overflow: hidden;
.slide .slide{
{
position: absolute; position: absolute;
width: 100%; width: 100%;
height: 100%; height: 100%;
@ -100,52 +77,32 @@ body{
top: 0px; top: 0px;
background-color: grey; background-color: grey;
transition: left 1s ease-out; transition: left 1s ease-out;
img img{
{
max-width: 100%; max-width: 100%;
max-height: 100%; max-height: 100%;
}
} }
} .slide.left{
.slide.left
{
left: -100%; left: -100%;
} }
.slide.center .slide.center{
{
left: 0px; left: 0px;
} }
.slide.right .slide.right{
{
left: 100%; left: 100%;
transition: none; transition: none;
} }
} }
#progress_bullets #progress_bullets{
{
position: absolute; position: absolute;
bottom: 10px; bottom: 10px;
width: 100%; width: 100%;
height: 10px; height: 10px;
@ -154,9 +111,7 @@ body{
margin-bottom: 10px; margin-bottom: 10px;
.bullet .bullet{
{
height: 10px; height: 10px;
width: 10px; width: 10px;
@ -167,43 +122,27 @@ body{
background-color: grey; background-color: grey;
&.active &.active{
{
background-color: #c99836; background-color: #c99836;
}
}
} }
} #progress_bar{
}
#progress_bar
{
position: absolute; position: absolute;
bottom: 0px; bottom: 0px;
height: 10px; height: 10px;
background-color: #304c83; background-color: #304c83;
&.init &.init{
{
width: 0px; width: 0px;
transition: none; transition: none;
} }
&.progress &.progress{
{
width: 100%; width: 100%;
transition: width 40s linear; transition: width 10s linear;
} }
} }
} }

View File

@ -1,35 +0,0 @@
{% extends "core/base.jinja" %}
{% block title %}
{% trans %}Poster{% endtrans %}
{% endblock %}
{% block content %}
<div id="poster_edit">
<div id="title">
<div id="links" class="left">
<a id="list" class="link" href="{{ url(poster_list_url_name) }}">{% trans %}List{% endtrans %}</a>
</div>
<h3>{% trans %}Posters - edit{% endtrans %}</h3>
<div id="links" class="right">
<a class="link delete" href="{{ url("com:poster_delete", poster.id) }}">{% trans %}Delete{% endtrans %}</a>
</div>
</div>
<div id="poster">
<form action="" method="post" enctype="multipart/form-data">
{% csrf_token %}
{{ form.as_p() }}
<p><input type="submit" value="{% trans %}Save{% endtrans %}" /></p>
</form>
</div>
</div>
{% endblock %}

View File

@ -16,7 +16,7 @@
<div id="title"> <div id="title">
<h3>{% trans %}Posters{% endtrans %}</h3> <h3>{% trans %}Posters{% endtrans %}</h3>
<div id="links" class="right"> <div id="links" class="right">
<a id="create" class="link" href="{{ url(poster_create_url_name) }}">{% trans %}Create{% endtrans %}</a> <a id="create" class="link" href="{{ url(app + ":poster_list") }}">{% trans %}Create{% endtrans %}</a>
{% if app == "com" %} {% if app == "com" %}
<a id="moderation" class="link" href="{{ url("com:poster_moderate_list") }}">{% trans %}Moderation{% endtrans %}</a> <a id="moderation" class="link" href="{{ url("com:poster_moderate_list") }}">{% trans %}Moderation{% endtrans %}</a>
{% endif %} {% endif %}

View File

@ -1,39 +0,0 @@
{% extends "core/base.jinja" %}
{% block script %}
{{ super() }}
<script src="{{ static('com/js/poster_list.js') }}"></script>
{% endblock %}
{% block content %}
<div id="poster_list">
<div id="title">
<div id="links" class="left">
<a id="list" class="link" href="{{ url("com:poster_list") }}">{% trans %}List{% endtrans %}</a>
</div>
<h3>{% trans %}Posters - moderation{% endtrans %}</h3>
</div>
<div id="posters">
{% if object_list.count == 0 %}
<div id="no-posters">{% trans %}No objects{% endtrans %}</div>
{% else %}
{% for poster in object_list %}
<div class="poster">
<div class="name"> {{ poster.name }} </div>
<div class="image"> <img src="{{ poster.file.url }}"></img> </div>
<a class="moderate" href="{{ url(moderation_url, object_id=poster.id) }}">Moderate</a>
</div>
{% endfor %}
{% endif %}
</div>
<div id="view"><div id="placeholder"></div></div>
</div>
{% endblock %}

View File

@ -1,34 +0,0 @@
{% extends "core/base.jinja" %}
{% block title %}
{% trans %}Screen{% endtrans %}
{% endblock %}
{% block content %}
<div id="screen_edit">
<div id="title">
<div id="links" class="left">
<a id="list" class="link" href="{{ url(screen_list_url_name) }}">{% trans %}List{% endtrans %}</a>
</div>
<h3>{% trans %}Screen - edit{% endtrans %}</h3>
<div id="links" class="right">
<a class="link delete" href="{{ url("com:screen_delete", screen.id) }}">{% trans %}Delete{% endtrans %}</a>
</div>
</div>
<div id="screen">
<form action="" method="post" enctype="multipart/form-data">
{% csrf_token %}
{{ form.as_p() }}
<p><input type="submit" value="{% trans %}Save{% endtrans %}" /></p>
</form>
</div>
</div>
{% endblock %}

View File

@ -1,39 +0,0 @@
{% extends "core/base.jinja" %}
{% block title %}
{% trans %}Screens{% endtrans %}
{% endblock %}
{% block content %}
<div id="screen_list">
<div id="title">
<h3>{% trans %}Screens{% endtrans %}</h3>
<div id="links" class="right">
<a id="create" class="link" href="{{ url(screen_create_url_name) }}">{% trans %}Create{% endtrans %}</a>
</div>
</div>
<div id="screens">
{% if screen_list.count() == 0 %}
<div id="no-screens">{% trans %}No screens{% endtrans %}</div>
{% else %}
{% for screen in screen_list %}
<div class="screen">
<div class="name">{{ screen.name }}</div>
<a class="edit" href="{{ url(screen_edit_url_name, screen.id) }}">{% trans %}Edit{% endtrans %}</a>
<a class="slideshow" href="{{ url("com:screen_slideshow", screen.id) }}" target="_blank">{% trans %}Slideshow{% endtrans %}</a>
</div>
{% endfor %}
{% endif %}
</div>
</div>
{% endblock %}

View File

@ -9,7 +9,7 @@
<div id="slides"> <div id="slides">
{% for poster in posters %} {% for poster in posters %}
<div class="slide {% if loop.first %}center{% else %}right{% endif %}"> <div class="slide {% if loop.first %}center{% else %}right{% endif %}" display_time="{{ poster.display_time }}">
<img src="{{ poster.file.url }}"></img> <img src="{{ poster.file.url }}"></img>
</div> </div>
{% endfor %} {% endfor %}