From 4e03fe90bc82e6a23126a4da5ae6977f5a6886a4 Mon Sep 17 00:00:00 2001 From: Oskar Hahn Date: Wed, 31 Aug 2011 18:25:03 +0200 Subject: [PATCH] active Item by ajax and prepared other ajax features --- openslides/agenda/models.py | 15 + .../agenda/templates/agenda/overview.html | 34 +- openslides/agenda/views.py | 4 + openslides/static/javascript/agenda.js | 39 ++ openslides/static/javascript/jquery.tmpl.js | 486 ++++++++++++++++++ openslides/static/styles/agenda.css | 15 + 6 files changed, 575 insertions(+), 18 deletions(-) create mode 100644 openslides/static/javascript/agenda.js create mode 100644 openslides/static/javascript/jquery.tmpl.js create mode 100644 openslides/static/styles/agenda.css diff --git a/openslides/agenda/models.py b/openslides/agenda/models.py index 2ce3c1959..3ccb20131 100644 --- a/openslides/agenda/models.py +++ b/openslides/agenda/models.py @@ -10,6 +10,11 @@ :license: GNU GPL, see LICENSE for more details. """ +try: + import json +except ImportError: + import simplejson as json + from django.db import models from django.utils.translation import ugettext as _ @@ -138,6 +143,16 @@ class Item(InheritanceCastModel): if link == 'delete': return ('item_delete', [str(self.id)]) + @property + def json(self): + """ + Return the model as jquery data + """ + return json.dumps({ + 'id': self.id, + 'active': self.active, + }) + def __unicode__(self): return self.title diff --git a/openslides/agenda/templates/agenda/overview.html b/openslides/agenda/templates/agenda/overview.html index 99172df55..060daad19 100644 --- a/openslides/agenda/templates/agenda/overview.html +++ b/openslides/agenda/templates/agenda/overview.html @@ -4,12 +4,15 @@ {% block header %} + {% if perms.agenda.can_manage_agenda %} + - + +