context['username'] = the_user(self.request)
page.expose_js_metadata()
- page.expose_queries()
# the page header and other stuff
context.update(page.prelude_env())
page.enqueue_query(platform_query)
page.expose_js_metadata()
- page.expose_queries()
platformlist = QueryTable(
page = page,
title = 'List',
page.enqueue_query(network_query)
page.expose_js_metadata()
- page.expose_queries()
networklist = QueryTable(
page = page,
title = 'List',
# Jordan: it seems we need this to init plugins js
# Issue a "manifold is not defined" error
#self.expose_queries ()
+ # Thierry: this is deprecated anyway, and will happen as part of prelude_env
+ # "manifold not defined" would be due to a missing dependency to manifold.js or something...
template_env.update(self.prelude_env())
result=render_to_response ('view-unfold1.html',template_env,
page.enqueue_query(resource_query)
page.expose_js_metadata()
- page.expose_queries()
resourcelist = QueryTable(
page = page,
# don't forget to run the requests
page.expose_js_metadata()
- page.expose_queries ()
# the prelude object in page contains a summary of the requirements() for all plugins
# define {js,css}_{files,chunks}
template_env.update(page.prelude_env())
# add our own css in the mix
#page.add_css_files ( 'css/dashboard.css')
- # don't forget to run the requests
- page.expose_queries ()
-
- # xxx create another plugin with the same query and a different layout (with_datatables)
- # show that it worls as expected, one single api call to backend and 2 refreshed views
-
# the prelude object in page contains a summary of the requirements() for all plugins
# define {js,css}_{files,chunks}
prelude_env = page.prelude_env()
template_env [ 'topmenu_items' ] = topmenu_items('plugin', request)
template_env [ 'username' ] = the_user (request)
- # run queries when we have any
- page.expose_queries ()
-
# the prelude object in page contains a summary of the requirements() for all plugins
# define {js,css}_{files,chunks}
prelude_env = page.prelude_env()
# so we can sho who is logged
template_env [ 'username' ] = the_user (request)
- # don't forget to run the requests
- page.expose_queries ()
-
# the prelude object in page contains a summary of the requirements() for all plugins
# define {js,css}_{files,chunks}
prelude_env = page.prelude_env()
# so we can sho who is logged
template_env [ 'username' ] = the_user (request)
- # don't forget to run the requests
- page.expose_queries ()
-
# the prelude object in page contains a summary of the requirements() for all plugins
# define {js,css}_{files,chunks}
prelude_env = page.prelude_env()
print "request", request.__class__
print request
prelude=Prelude( js_files='js/bootstrap.js', css_files='css/bootstrap.css')
- prelude_env = prelude.prelude_env()
tab_env = {'title':'Page for playing with Tabs',
'topmenu_items': topmenu_items('tab',request),
'username':the_user (request),
'lorem': lorem,
}
- tab_env.update (prelude_env)
+
+ tab_env.update (prelude.prelude_env())
return render_to_response ('view-tab.html', tab_env,
context_instance=RequestContext(request))
# so we can see who is logged
template_env [ 'username' ] = the_user (request)
- # don't forget to run the requests
- page.expose_queries ()
-
# the prelude object in page contains a summary of the requirements() for all plugins
# define {js,css}_{files,chunks}
prelude_env = page.prelude_env()
# self._queue = []
# this method adds a query to the page
- # the query will be exposed to js when calling expose_queries
+ # the query will be exposed to js when calling __expose_queries, which is done by prelude_env()
# additionally if run_it is set to True, this query will be asynchroneously triggered on page load
# in this case (exec=True) the js async callback (see manifold.asynchroneous_success)
# offers the option to deliver the result to a specific DOM elt (in this case, set domid)
self.add_js_files('js/record_generator.js');
js_chunk = '$(document).ready(function() { new RecordGenerator(%s,%s,%s).run(); });'%(query.to_json(),json.dumps(generators),number);
self.add_js_chunks(js_chunk)
-
+
# return the javascript code for exposing queries
# all queries are inserted in the global manifold object
# in addition, the ones enqueued with 'run_it=True' are triggered
- def expose_queries (self):
+ def __expose_queries (self):
# compute variables to expose to the template
env = {}
# expose the json definition of all queries
def add_js_chunks (self):pass
@to_prelude
def add_css_chunks (self):pass
- @to_prelude
- def prelude_env (self):pass
+
+ # prelude_env also does expose_queries
+ def prelude_env (self):
+ self.__expose_queries()
+ from_prelude=self.prelude.prelude_env()
+ return from_prelude