1 # -*- encoding: utf-8 -*-
3 __author__= "Łukasz Rekucki"
4 __date__ = "$2009-09-25 15:55:33$"
5 __doc__ = "Module documentation."
7 from django.views.generic.simple import direct_to_template
8 from piston.handler import BaseHandler
9 from piston.utils import rc
15 class ToolbarHandler(BaseHandler):
16 allowed_methods = ('GET',)
18 def read(self, request):
19 groups = toolbar.models.ButtonGroup.objects.all()
20 return [ {'name': g.name, 'position': g.position,\
21 'buttons': g.button_set.all()} for g in groups ]
24 class ScriptletsHandler(BaseHandler):
25 allowed_methods = ('GET',)
27 def read(self, request):
28 scriptlets = toolbar.models.Scriptlet.objects.all()
30 return direct_to_template(request, 'toolbar_api/scriptlets.js',
31 extra_context = {'scriptlets': scriptlets },
32 mimetype='text/javascript' )