rename projector to dashboard
This commit is contained in:
parent
b7a0e83c68
commit
c6bc50e2fd
@ -24,21 +24,6 @@ class UserCreateForm(forms.ModelForm, CssClassMixin):
|
||||
groups = forms.ModelMultipleChoiceField(
|
||||
queryset=Group.objects.exclude(name__iexact='anonymous'),
|
||||
label=_("User groups"), required=False)
|
||||
is_active = forms.BooleanField(label=_("Active"), required=False,
|
||||
initial=True)
|
||||
|
||||
class Meta:
|
||||
model = User
|
||||
exclude = ('username', 'password', 'is_staff', 'is_superuser',
|
||||
'last_login', 'date_joined', 'user_permissions')
|
||||
|
||||
|
||||
class UserEditForm(forms.ModelForm, CssClassMixin):
|
||||
first_name = forms.CharField(label=_("First name"))
|
||||
last_name = forms.CharField(label=_("Last name"))
|
||||
groups = forms.ModelMultipleChoiceField(queryset=Group.objects.all(),
|
||||
label=_("User groups"), required=False)
|
||||
is_active = forms.BooleanField(label=_("Active"), required=False)
|
||||
|
||||
class Meta:
|
||||
model = User
|
||||
@ -111,6 +96,7 @@ class UsersettingsForm(forms.ModelForm, CssClassMixin):
|
||||
model = User
|
||||
fields = ('username', 'first_name', 'last_name', 'email')
|
||||
|
||||
|
||||
class UserImportForm(forms.Form, CssClassMixin):
|
||||
csvfile = forms.FileField(widget=forms.FileInput(attrs={'size': '50'}),
|
||||
label=_("CSV File"))
|
||||
|
@ -50,7 +50,8 @@ class ProjectorSlide(models.Model, SlideMixin):
|
||||
class Meta:
|
||||
permissions = (
|
||||
('can_manage_projector', ugettext_noop("Can manage the projector")),
|
||||
('can_see_projector', ugettext_noop("Can see projector")),
|
||||
('can_see_projector', ugettext_noop("Can see the projector")),
|
||||
('can_see_dashboard', ugettext_noop("Can see the dashboard")),
|
||||
)
|
||||
|
||||
|
||||
|
@ -105,12 +105,14 @@ class Widget(object):
|
||||
"""
|
||||
Class for a Widget for the Projector-Tab.
|
||||
"""
|
||||
def __init__(self, name, html=None, template=None, context={}):
|
||||
def __init__(self, name, html=None, template=None, context={},
|
||||
permission_required=None):
|
||||
self.name = name
|
||||
if html is not None:
|
||||
self.html = html
|
||||
elif template is not None:
|
||||
self.html = render_to_string(template, context)
|
||||
self.permission_required = permission_required
|
||||
|
||||
def get_name(self):
|
||||
return self.name.lower()
|
||||
|
@ -7,18 +7,18 @@
|
||||
{% block title %}{{ block.super}} – {% trans 'Projector' %} {% endblock %}
|
||||
|
||||
{% block submenu %}
|
||||
{% url projector_control as url_projectoroverview %}
|
||||
{% url dashboard as url_dashboard %}
|
||||
<h4 class="sectiontitle">{% trans "Projector" %}</h4>
|
||||
<ul>
|
||||
{% if perms.projector.can_manage_projector %}
|
||||
<li class="{% if request.path == url_projectoroverview %}selected{% endif %}">
|
||||
<a href="{% url projector_control %}">{% trans 'Overview' %}</a>
|
||||
</li>
|
||||
<li{% if request.path == url_dashboard %} class="selected"{% endif %}>
|
||||
<a href="{% url dashboard %}">{% trans 'Overview' %}</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if perms.projector.can_see_projector %}
|
||||
<li>
|
||||
<a href="{% url projector_show %}"><img src="{% static 'images/icons/projector.png' %}"> {% trans 'Projector view' %}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{% url projector_show %}"><img src="{% static 'images/icons/projector.png' %}"> {% trans 'Projector view' %}</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
{% endblock %}
|
||||
|
@ -14,7 +14,7 @@
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h1>{% trans 'Projector' %}</h1>
|
||||
<h1>{% trans 'Dashboard' %}</h1>
|
||||
<div style="text-align: right; padding: 0 10px 5px 0; margin-top:-20px;">
|
||||
<!-- projector control -->
|
||||
{% trans "Adjust projector view" %}:
|
@ -15,8 +15,8 @@
|
||||
<button class="button" type="submit" name="apply">
|
||||
<span class="icon apply">{% trans 'Apply' %}</span>
|
||||
</button>
|
||||
<a href='{% url projector_control %}'>
|
||||
<button class="button" type="button" onclick="window.location='{% url projector_control %}'">
|
||||
<a href='{% url dashboard %}'>
|
||||
<button class="button" type="button" onclick="window.location='{% url dashboard %}'">
|
||||
<span class="icon cancel">{% trans 'Cancel' %}</span>
|
||||
</button>
|
||||
</a>
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
from django.conf.urls.defaults import patterns, url
|
||||
|
||||
from openslides.projector.views import (ControlView, ActivateView,
|
||||
from openslides.projector.views import (DashboardView, ActivateView,
|
||||
CustomSlideCreateView, CustomSlideUpdateView, CustomSlideDeleteView,
|
||||
CountdownEdit, ProjectorEdit, Projector, ActivateOverlay)
|
||||
|
||||
@ -35,9 +35,9 @@ urlpatterns = patterns('',
|
||||
name='projctor_preview_slide',
|
||||
),
|
||||
|
||||
url(r'^control/$',
|
||||
ControlView.as_view(),
|
||||
name='projector_control',
|
||||
url(r'^dashboard/$',
|
||||
DashboardView.as_view(),
|
||||
name='dashboard',
|
||||
),
|
||||
|
||||
url(r'^activate/$',
|
||||
|
@ -36,12 +36,12 @@ from openslides.projector.projector import SLIDE, Widget
|
||||
from openslides.projector.signals import projector_overlays
|
||||
|
||||
|
||||
class ControlView(TemplateView, AjaxMixin):
|
||||
class DashboardView(TemplateView, AjaxMixin):
|
||||
"""
|
||||
Overview over all possible slides, the overlays and a liveview.
|
||||
"""
|
||||
template_name = 'projector/control.html'
|
||||
permission_required = 'projector.can_manage_projector'
|
||||
template_name = 'projector/dashboard.html'
|
||||
permission_required = 'projector.can_see_dashboard'
|
||||
|
||||
def get_projector_overlays(self):
|
||||
overlays = []
|
||||
@ -73,7 +73,7 @@ class ControlView(TemplateView, AjaxMixin):
|
||||
}
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(ControlView, self).get_context_data(**kwargs)
|
||||
context = super(DashboardView, self).get_context_data(**kwargs)
|
||||
|
||||
widgets = SortedDict()
|
||||
for app in settings.INSTALLED_APPS:
|
||||
@ -88,7 +88,8 @@ class ControlView(TemplateView, AjaxMixin):
|
||||
continue
|
||||
|
||||
for widget in modul_widgets:
|
||||
widgets[widget.get_name()] = widget
|
||||
if self.request.user.has_perm(widget.permission_required):
|
||||
widgets[widget.get_name()] = widget
|
||||
|
||||
|
||||
context.update({
|
||||
@ -182,7 +183,7 @@ class ActivateView(RedirectView):
|
||||
Activate a Slide.
|
||||
"""
|
||||
permission_required = 'projector.can_manage_projector'
|
||||
url = 'projector_control'
|
||||
url = 'dashboard'
|
||||
allow_ajax = True
|
||||
|
||||
def pre_redirect(self, request, *args, **kwargs):
|
||||
@ -199,7 +200,7 @@ class ProjectorEdit(RedirectView):
|
||||
Scale or scroll the projector.
|
||||
"""
|
||||
permission_required = 'projector.can_manage_projector'
|
||||
url = 'projector_control'
|
||||
url = 'dashboard'
|
||||
allow_ajax = True
|
||||
|
||||
def pre_redirect(self, request, *args, **kwargs):
|
||||
@ -223,7 +224,7 @@ class CountdownEdit(RedirectView):
|
||||
Start, stop or reset the countdown.
|
||||
"""
|
||||
permission_required = 'projector.can_manage_projector'
|
||||
url = 'projector_control'
|
||||
url = 'dashboard'
|
||||
allow_ajax = True
|
||||
|
||||
def pre_redirect(self, request, *args, **kwargs):
|
||||
@ -273,7 +274,7 @@ class ActivateOverlay(RedirectView):
|
||||
"""
|
||||
Activate or deactivate an overlay.
|
||||
"""
|
||||
url = 'projector_control'
|
||||
url = 'dashboard'
|
||||
allow_ajax = True
|
||||
permission_required = 'projector.can_manage_projector'
|
||||
|
||||
@ -308,7 +309,7 @@ class CustomSlideCreateView(CreateView):
|
||||
template_name = 'projector/new.html'
|
||||
model = ProjectorSlide
|
||||
context_object_name = 'customslide'
|
||||
success_url = 'projector_control'
|
||||
success_url = 'dashboard'
|
||||
apply_url = 'customslide_edit'
|
||||
|
||||
|
||||
@ -320,7 +321,7 @@ class CustomSlideUpdateView(UpdateView):
|
||||
template_name = 'projector/new.html'
|
||||
model = ProjectorSlide
|
||||
context_object_name = 'customslide'
|
||||
success_url = 'projector_control'
|
||||
success_url = 'dashboard'
|
||||
apply_url = 'customslide_edit'
|
||||
|
||||
|
||||
@ -330,7 +331,7 @@ class CustomSlideDeleteView(DeleteView):
|
||||
"""
|
||||
permission_required = 'projector.can_manage_projector'
|
||||
model = ProjectorSlide
|
||||
url = 'projector_control'
|
||||
url = 'dashboard'
|
||||
|
||||
|
||||
def register_tab(request):
|
||||
@ -339,9 +340,10 @@ def register_tab(request):
|
||||
"""
|
||||
selected = True if request.path.startswith('/projector/') else False
|
||||
return Tab(
|
||||
title=_('Projector'),
|
||||
url=reverse('projector_control'),
|
||||
permission=request.user.has_perm('projector.can_manage_projector'),
|
||||
title=_('Dashboard'),
|
||||
url=reverse('dashboard'),
|
||||
permission=request.user.has_perm('projector.can_manage_projector') or
|
||||
request.user.has_perm('projector.can_see_dashboard'),
|
||||
selected=selected,
|
||||
)
|
||||
|
||||
@ -356,7 +358,7 @@ def get_widgets(request):
|
||||
template='projector/widget.html',
|
||||
context={
|
||||
'slides': ProjectorSlide.objects.all(),
|
||||
'welcomepage_is_active': not bool(config["presentation"]),
|
||||
}
|
||||
'welcomepage_is_active': not bool(config["presentation"])},
|
||||
permission_required = 'projector.can_manage_projector',
|
||||
),
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user