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