Ustawianie galerii inline.
[redakcja.git] / apps / api / handlers / toolbar_handlers.py
1 # -*- encoding: utf-8 -*-
2
3 import logging
4 log = logging.getLogger('platforma.api.toolbar')
5
6 __author__= "Ɓukasz Rekucki"
7 __date__ = "$2009-09-25 15:55:33$"
8 __doc__ = "Module documentation."
9
10 from django.views.generic.simple import direct_to_template
11 from piston.handler import BaseHandler
12 from piston.utils import rc
13
14 import settings
15
16 import toolbar.models
17
18 class ToolbarHandler(BaseHandler):
19     allowed_methods = ('GET',)
20
21     def read(self, request):
22         groups = toolbar.models.ButtonGroup.objects.all()
23         return [g.to_dict(with_buttons=True) for g in groups]
24             
25 class ScriptletsHandler(BaseHandler):
26     allowed_methods = ('GET',)
27
28     def read(self, request):
29         scriptlets = toolbar.models.Scriptlet.objects.all()
30
31         return direct_to_template(request, 'toolbar_api/scriptlets.js',
32             extra_context = {'scriptlets': scriptlets },
33             mimetype='text/javascript' )