X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=trash%2Fdashboard.py;h=297133e687f8e70677a5ec04a2a86df1993de258;hb=132e1c9a6e44e5094ed3d896f8102de33c0f85f7;hp=0991ea5f045eed87bdcd6332709a4e417e5592f4;hpb=00e925de365deefe83fd1bf17726dce43947dfbd;p=unfold.git diff --git a/trash/dashboard.py b/trash/dashboard.py index 0991ea5f..297133e6 100644 --- a/trash/dashboard.py +++ b/trash/dashboard.py @@ -10,16 +10,15 @@ from django.contrib.auth.decorators import login_required from engine.pluginset import PluginSet from engine.manifoldquery import ManifoldQuery -from plugins.simplelist import SimpleList +from plugins.slicelist import SliceList # from myslice.viewutils import topmenu_items, the_user -# from myslice.viewutils import hard_wired_slice_names, hard_wired_list, lorem_p, lorem, quickfilter_criterias @login_required def dashboard_view (request): - pluginset = PluginSet() + pluginset = PluginSet(request) slices_query = ManifoldQuery (action='get', method='slice', @@ -28,19 +27,18 @@ def dashboard_view (request): # xxx filter : should filter on the slices the logged user can see # we don't have the user's hrn yet # in addition this currently returns all slices anyways + # filter = ... sort='slice_hrn',) pluginset.enqueue_query (slices_query) - main_plugin = SimpleList ( # setting visible attributes first + main_plugin = SliceList ( # setting visible attributes first pluginset=pluginset, - title='Asynchroneous SimpleList', + title='Asynchroneous SliceList', header='slices list', - with_datatables=True, - toggled=False, - # this is required for the javascript code + with_datatables=False, + toggled=True, + # this is the query at the core of the slice list query=slices_query, - key='slice_hrn', - value='slice_hrn', ) # variables that will get passed to the view-plugin.html template @@ -65,8 +63,29 @@ def dashboard_view (request): # so we can sho who is logged template_env [ 'username' ] = the_user (request) + ########## + # lacks a/href to /slice/%s + related_plugin = SliceList ( + pluginset=pluginset, + title='Same request, other layout', + domid='sidelist', + with_datatables=True, + header='paginated slices', + # share the query + query=slices_query, + ) + # likewise but on the side view + template_env [ 'content_related' ] = related_plugin.render (request) + + # add our own css in the mix + pluginset.add_css_files ( 'css/dashboard.css') + + # don't forget to run the requests pluginset.exec_queue_asynchroneously () + # 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 pluginset contains a summary of the requirements() for all plugins # define {js,css}_{files,chunks} prelude_env = pluginset.template_env()