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 myslice.viewutils import topmenu_items, the_user
11 from myslice.viewutils import lorem, hard_wired_slice_names
14 def tab_view (request):
15 prelude=Prelude( js_files='js/bootstrap.js', css_files='css/bootstrap.css')
16 prelude_env = prelude.prelude_env()
18 tab_env = {'title':'Page for playing with Tabs',
19 'topmenu_items': topmenu_items('tab',request),
20 'username':the_user (request),
23 tab_env.update (prelude_env)
24 return render_to_response ('view-tab.html', tab_env,
25 context_instance=RequestContext(request))
27 def scroll_view (request):
28 return render_to_response ('view-scroll.html',
29 {'title':'Toy page for scrolling',
30 'topmenu_items': topmenu_items('scroll',request),
31 'username':the_user (request),
34 context_instance=RequestContext(request))
37 def test_plugin_view (request):
41 # variables that will get passed to this template
46 title='title for the vertical layout',
47 sons = [ StaticList (page=page,
48 title='StaticList - with datatables - starts toggled off',
50 header='Hard wired header',
51 foo='the value for foo',
57 # *** we select this one to be the active tab ***
59 sons = [ Raw (page=page,
69 header="static list but not togglable",
70 list=hard_wired_slice_names,
77 StaticList (page=page,
78 title='SimpleList with slice names',
79 list=hard_wired_slice_names,
81 QuickFilter (page=page,
82 title='QuickFilter in main content',
83 criterias=quickfilter_criterias,
85 # define 'unfold2_main' to the template engine
86 template_env [ 'unfold2_main' ] = main_plugin.render(request)
89 related_plugin = StaticList (page=page,
90 title='SliceList plugin',domid='slicelist1',
91 with_datatables='yes',
92 list=hard_wired_slice_names,
94 # likewise but on the side view
95 template_env [ 'unfold2_margin' ] = related_plugin.render (request)
97 # more general variables expected in the template
98 template_env [ 'title' ] = 'Test Plugin View'
99 template_env [ 'topmenu_items' ] = topmenu_items('plugin', request)
100 template_env [ 'username' ] = the_user (request)
102 # we don't have anythong asynchroneous, and manifold.js is not loaded
103 # page.expose_queries ()
105 # the prelude object in page contains a summary of the requirements() for all plugins
106 # define {js,css}_{files,chunks}
107 prelude_env = page.prelude_env()
108 template_env.update(prelude_env)
109 return render_to_response ('view-unfold2.html',template_env,
110 context_instance=RequestContext(request))