1 # Create your views here.
2 from django.core.context_processors import csrf
3 from django.template import RequestContext
4 from django.shortcuts import render_to_response
5 from django.contrib.auth.decorators import login_required
7 from unfold.prelude import Prelude
9 from ui.topmenu import topmenu_items, the_user
11 from trash.trashutils import lorem, hard_wired_slice_names
14 def tab_view (request):
15 print "request", request.__class__
17 prelude=Prelude( js_files='js/bootstrap.js', css_files='css/bootstrap.css')
18 prelude_env = prelude.prelude_env()
20 tab_env = {'title':'Page for playing with Tabs',
21 'topmenu_items': topmenu_items('tab',request),
22 'username':the_user (request),
25 tab_env.update (prelude_env)
26 return render_to_response ('view-tab.html', tab_env,
27 context_instance=RequestContext(request))
29 def scroll_view (request):
30 return render_to_response ('view-scroll.html',
31 {'title':'Toy page for scrolling',
32 'topmenu_items': topmenu_items('scroll',request),
33 'username':the_user (request),
36 context_instance=RequestContext(request))
39 def test_plugin_view (request):
43 # variables that will get passed to this template
48 title='title for the vertical layout',
49 sons = [ StaticList (page=page,
50 title='StaticList - with datatables - starts toggled off',
52 header='Hard wired header',
53 foo='the value for foo',
59 # *** we select this one to be the active tab ***
61 sons = [ Raw (page=page,
71 header="static list but not togglable",
72 list=hard_wired_slice_names,
79 StaticList (page=page,
80 title='SimpleList with slice names',
81 list=hard_wired_slice_names,
83 QuickFilter (page=page,
84 title='QuickFilter in main content',
85 criterias=quickfilter_criterias,
87 # define 'unfold_main' to the template engine
88 template_env [ 'unfold_main' ] = main_plugin.render(request)
91 related_plugin = StaticList (page=page,
92 title='SliceList plugin',domid='slicelist1',
93 with_datatables='yes',
94 list=hard_wired_slice_names,
96 # likewise but on the side view
97 template_env [ 'unfold_margin' ] = related_plugin.render (request)
99 # more general variables expected in the template
100 template_env [ 'title' ] = 'Test Plugin View'
101 template_env [ 'topmenu_items' ] = topmenu_items('plugin', request)
102 template_env [ 'username' ] = the_user (request)
104 # we don't have anythong asynchroneous, and manifold.js is not loaded
105 # page.expose_queries ()
107 # the prelude object in page contains a summary of the requirements() for all plugins
108 # define {js,css}_{files,chunks}
109 prelude_env = page.prelude_env()
110 template_env.update(prelude_env)
111 return render_to_response ('view-unfold2.html',template_env,
112 context_instance=RequestContext(request))