1 # Create your views here.
3 from django.core.context_processors import csrf
4 from django.template import RequestContext
5 from django.template.loader import render_to_string
6 from django.shortcuts import render_to_response
8 from django.contrib.auth.decorators import login_required
10 from unfold.page import Page
12 from plugins.stack.stack import Stack
13 from plugins.tabs.tabs import Tabs
14 from plugins.lists.staticlist import StaticList
15 from plugins.quickfilter.quickfilter import QuickFilter
16 from plugins.raw.raw import Raw
18 from myslice.viewutils import topmenu_items, the_user
19 from myslice.viewutils import hard_wired_slice_names, hard_wired_list, lorem_p, lorem, quickfilter_criterias
22 def test_plugin_view (request):
26 # variables that will get passed to this template
31 title='title for the vertical layout',
32 sons = [ StaticList (page=page,
33 title='StaticList - with datatables - starts toggled off',
35 header='Hard wired header',
36 foo='the value for foo',
42 # *** we select this one to be the active tab ***
44 sons = [ Raw (page=page,
54 header="static list but not togglable",
55 list=hard_wired_slice_names,
62 StaticList (page=page,
63 title='SimpleList with slice names',
64 list=hard_wired_slice_names,
66 QuickFilter (page=page,
67 title='QuickFilter in main content',
68 criterias=quickfilter_criterias,
70 # define 'unfold2_main' to the template engine
71 template_env [ 'unfold2_main' ] = main_plugin.render(request)
74 related_plugin = StaticList (page=page,
75 title='SliceList plugin',domid='slicelist1',
76 with_datatables='yes',
77 list=hard_wired_slice_names,
79 # likewise but on the side view
80 template_env [ 'unfold2_margin' ] = related_plugin.render (request)
82 # more general variables expected in the template
83 template_env [ 'title' ] = 'Test Plugin View'
84 template_env [ 'topmenu_items' ] = topmenu_items('plugin', request)
85 template_env [ 'username' ] = the_user (request)
87 # we don't have anythong asynchroneous, and manifold.js is not loaded
88 # page.exec_queue_asynchroneously ()
90 # the prelude object in page contains a summary of the requirements() for all plugins
91 # define {js,css}_{files,chunks}
92 prelude_env = page.prelude_env()
93 template_env.update(prelude_env)
94 return render_to_response ('view-unfold2.html',template_env,
95 context_instance=RequestContext(request))