view for Agenda.item

This commit is contained in:
Oskar Hahn 2012-04-15 09:55:21 +02:00
parent 785bd7c9a4
commit 361bc40821
4 changed files with 28 additions and 16 deletions

View File

@ -15,11 +15,10 @@
{% if perms.agenda.can_manage_agenda %} {% if perms.agenda.can_manage_agenda %}
<div class="dragcell"></div> <div class="dragcell"></div>
{% endif %} {% endif %}
{{ item }} <a href="{{ item.get_absolute_url }}">{{ item }}</a>
</td> </td>
<td> <td>
<span style="width: 1px; white-space: nowrap;"> <span style="width: 1px; white-space: nowrap;">
<a href="{{ item.get_absolute_url }}"><img src="{% static 'images/icons/document-preview.png' %}" title="{% trans 'Show projector preview' %}"></a>
{% if perms.agenda.can_manage_agenda %} {% if perms.agenda.can_manage_agenda %}
<a href="{% url item_edit item.id %}"><img src="{% static 'images/icons/document-edit.png' %}" title="{% trans 'Edit item' %}"></a> <a href="{% url item_edit item.id %}"><img src="{% static 'images/icons/document-edit.png' %}" title="{% trans 'Edit item' %}"></a>
<a href="{% url item_delete item.id %}"><img src="{% static 'images/icons/edit-delete.png' %}" title="{% trans 'Delete item' %}"></a> <a href="{% url item_delete item.id %}"><img src="{% static 'images/icons/edit-delete.png' %}" title="{% trans 'Delete item' %}"></a>

View File

@ -0,0 +1,11 @@
{% extends "agenda/base_agenda.html" %}
{% load i18n %}
{% block title %}{{ block.super }} {{ item.title }}{% endblock %}
{% block content %}
<h1>{{ item.title }}</h1>
{{ item.text }}
{% endblock %}

View File

@ -18,7 +18,8 @@ from django.core.context_processors import csrf
from django.views.generic.detail import SingleObjectMixin from django.views.generic.detail import SingleObjectMixin
from utils.pdf import stylesheet from utils.pdf import stylesheet
from utils.views import TemplateView, RedirectView, UpdateView, CreateView, DeleteView, PDFView, FormView from utils.views import (TemplateView, RedirectView, UpdateView, CreateView,
DeleteView, PDFView, FormView, DetailView)
from utils.template import Tab from utils.template import Tab
from config.models import config from config.models import config
@ -30,19 +31,6 @@ from agenda.api import is_summary
from agenda.forms import ItemOrderForm, ItemForm, ConfigForm from agenda.forms import ItemOrderForm, ItemForm, ConfigForm
class View(TemplateView):
permission_required = 'agenda.can_see_projector'
template_name = 'projector/AgendaText.html'
def get_context_data(self, **kwargs):
context = super(View, self).get_context_data(**kwargs)
context.update({
'item': Item.objects.get(pk=kwargs['pk']),
'ajax': 'off',
})
return context
class Overview(TemplateView): class Overview(TemplateView):
permission_required = 'agenda.can_see_agenda' permission_required = 'agenda.can_see_agenda'
template_name = 'agenda/overview.html' template_name = 'agenda/overview.html'
@ -73,6 +61,13 @@ class Overview(TemplateView):
return self.render_to_response(context) return self.render_to_response(context)
class View(DetailView):
permission_required = 'agenda.can_see_agenda'
template_name = 'agenda/view.html'
model = Item
context_object_name = 'item'
class SetActive(RedirectView, SingleObjectMixin): class SetActive(RedirectView, SingleObjectMixin):
""" """
Set an Item as the active one. Set an Item as the active one.

View File

@ -203,6 +203,13 @@ class DeleteView(RedirectView, SingleObjectMixin):
messages.warning(request, '%s<form action="%s" method="post"><input type="hidden" value="%s" name="csrfmiddlewaretoken"><input type="submit" value="%s" /> <input type="button" value="%s"></form>' % (message, url, csrf(request)['csrf_token'], _("Yes"), _("No"))) messages.warning(request, '%s<form action="%s" method="post"><input type="hidden" value="%s" name="csrfmiddlewaretoken"><input type="submit" value="%s" /> <input type="button" value="%s"></form>' % (message, url, csrf(request)['csrf_token'], _("Yes"), _("No")))
class DetailView(SingleObjectMixin, TemplateView):
def get(self, request, *args, **kwargs):
self.object = self.get_object()
context = self.get_context_data(object=self.object)
return TemplateView.get(self, request, *args, **kwargs)
class PDFView(PermissionMixin, View): class PDFView(PermissionMixin, View):
filename = _('undefined-filename') filename = _('undefined-filename')
top_space = 3 top_space = 3