From: Thierry Parmentelat Date: Fri, 6 Dec 2013 15:26:35 +0000 (+0100) Subject: rename querytable as querygrid X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=refs%2Fheads%2Fslickgrid;hp=8c82aaebbe810904dd985aacf92ebc9eab3fd5f5;p=unfold.git rename querytable as querygrid should have done that first off not sure if this branch can be merged automatically, so with the new names it should be easier to do manually --- diff --git a/plugins/querytable/__init__.py b/plugins/querygrid/__init__.py similarity index 95% rename from plugins/querytable/__init__.py rename to plugins/querygrid/__init__.py index de7fcbcc..5b0c4662 100644 --- a/plugins/querytable/__init__.py +++ b/plugins/querygrid/__init__.py @@ -1,6 +1,6 @@ from unfold.plugin import Plugin -class QueryTable (Plugin): +class QueryGrid (Plugin): """A plugin for displaying a query as a list @@ -67,16 +67,16 @@ Current implementation makes the following assumptions if self.checkboxes: # we use aoColumnDefs rather than aoColumns -- ignore user-provided aoColumns if 'aoColumns' in self.datatables_options: - print 'WARNING: querytable uses aoColumnDefs, your aoColumns spec. is discarded' + print 'WARNING: querygrid uses aoColumnDefs, your aoColumns spec. is discarded' del self.datatables_options['aoColumns'] # set aoColumnDefs in datatables_options - might already have stuff in there aoColumnDefs = self.datatables_options.setdefault ('aoColumnDefs',[]) # here 'checkbox' is the class that we give to the dom elem - # dom-checkbox is a sorting type that we define in querytable.js + # dom-checkbox is a sorting type that we define in querygrid.js aoColumnDefs.append ( {'aTargets': ['checkbox'], 'sSortDataType': 'dom-checkbox' } ) def template_file (self): - return "querytable.html" + return "querygrid.html" def template_env (self, request): env={} @@ -111,16 +111,16 @@ Current implementation makes the following assumptions # "js/dataTables.js", "js/dataTables.bootstrap.js", "js/with-datatables.js", "js/manifold.js", "js/manifold-query.js", "js/unfold-helper.js", - # querytable.js needs to be loaded after dataTables.js as it extends + # querygrid.js needs to be loaded after dataTables.js as it extends # dataTableExt.afnSortData - "js/querytable.js", + "js/querygrid.js", ] , 'css_files': [ # "css/dataTables.bootstrap.css", # hopefully temporary, when/if datatables supports sPaginationType=bootstrap3 # for now we use full_numbers, with our own ad hoc css # "css/dataTables.full_numbers.css", - "css/querytable.css" , + "css/querygrid.css" , "http://mleibman.github.io/SlickGrid/slick.grid.css", # "http://mleibman.github.io/SlickGrid/css/smoothness/jquery-ui-1.8.16.custom.css", # "http://mleibman.github.io/SlickGrid/examples/examples.css", diff --git a/plugins/querytable/static/css/querytable.css b/plugins/querygrid/static/css/querygrid.css similarity index 77% rename from plugins/querytable/static/css/querytable.css rename to plugins/querygrid/static/css/querygrid.css index 5af1b812..888c9053 100644 --- a/plugins/querytable/static/css/querytable.css +++ b/plugins/querygrid/static/css/querygrid.css @@ -1,8 +1,8 @@ /* the bottom of the datatable needs more space */ -div.querytable-spacer { padding: 8px 4px 15px 4px; } +div.querygrid-spacer { padding: 8px 4px 15px 4px; } /* use same height as the googlemap plugin for nicer effect */ -div.querytable { +div.querygrid { width: 100%; height: 600px; } @@ -10,24 +10,24 @@ div.querytable { /* this is crucial for slickgrid and bootstrap3 to play together nicely https://github.com/mleibman/SlickGrid/issues/742 */ -div.querytable div { +div.querygrid div { -webkit-box-sizing: content-box; -moz-box-sizing: content-box; box-sizing: content-box; } -div.querytable .slick-column-name { +div.querygrid .slick-column-name { font-weight: bold; font-size: medium; padding: 5px; } -div.querytable { +div.querygrid { font-size: small; } /* an example of the css classes used */ -.querytable-column-network_hrn { +.querygrid-column-network_hrn { background-color:red; } diff --git a/plugins/querytable/static/js/querytable.js b/plugins/querygrid/static/js/querygrid.js similarity index 93% rename from plugins/querytable/static/js/querytable.js rename to plugins/querygrid/static/js/querygrid.js index bca90c35..6f9694f3 100644 --- a/plugins/querytable/static/js/querytable.js +++ b/plugins/querygrid/static/js/querygrid.js @@ -26,7 +26,7 @@ var debug_deep=false; // debug_deep=true; - var QueryTable = Plugin.extend({ + var QueryGrid = Plugin.extend({ init: function(options, element) { this._super(options, element); @@ -60,9 +60,9 @@ var keys = manifold.metadata.get_key(this.method); this.key = (keys && keys.length == 1) ? keys[0] : null; } - if (! this.key) messages.warning("querytable.init could not kind valid key"); + if (! this.key) messages.warning("querygrid.init could not kind valid key"); - if (debug) messages.debug("querytable: key="+this.key); + if (debug) messages.debug("querygrid: key="+this.key); /* Setup query and record handlers */ this.listen_query(options.query_uuid); @@ -92,7 +92,7 @@ for (c in all_columns) { var column=all_columns[c]; this.slick_columns.push ( {id:column, name:column, field:column, - cssClass: "querytable-column-"+column, + cssClass: "querygrid-column-"+column, width:100, minWidth:40, }); } var checkbox_selector = new Slick.CheckboxSelectColumn({ @@ -156,11 +156,11 @@ }, show_column: function(field) { - console.log ("querytable.show_column not yet implemented with slickgrid - field="+field); + console.log ("querygrid.show_column not yet implemented with slickgrid - field="+field); }, hide_column: function(field) { - console.log("querytable.hide_column not implemented with slickgrid - field="+field); + console.log("querygrid.hide_column not implemented with slickgrid - field="+field); }, /*************************** QUERY HANDLER ****************************/ @@ -191,7 +191,7 @@ }, on_field_clear: function() { - alert('QueryTable::clear_fields() not implemented'); + alert('QueryGrid::clear_fields() not implemented'); }, /* XXX TODO: make this generic a plugin has to subscribe to a set of Queries to avoid duplicated code ! */ @@ -221,7 +221,7 @@ }, on_all_field_clear: function() { - alert('QueryTable::clear_fields() not implemented'); + alert('QueryGrid::clear_fields() not implemented'); }, @@ -354,7 +354,7 @@ if (id === undefined) { - messages.warning("querytable._set_checkbox record has no id to figure which line to tick"); + messages.warning("querygrid._set_checkbox record has no id to figure which line to tick"); return; } var index = this.slick_dataview.getIdxById(id); @@ -402,17 +402,17 @@ }, // the callback for when user clicks - _checkbox_clicked: function(querytable,input,key) { + _checkbox_clicked: function(querygrid,input,key) { // XXX this.value = key of object to be added... what about multiple keys ? - if (debug) messages.debug("querytable click handler checked=" + input.checked + " key=" + key); - manifold.raise_event(querytable.options.query_uuid, input.checked?SET_ADD:SET_REMOVED, key); + if (debug) messages.debug("querygrid click handler checked=" + input.checked + " key=" + key); + manifold.raise_event(querygrid.options.query_uuid, input.checked?SET_ADD:SET_REMOVED, key); //return false; // prevent checkbox to be checked, waiting response from manifold plugin api }, // xxx from this and down, probably needs further tweaks for slickgrid - _querytable_filter: function(oSettings, aData, iDataIndex) { + _querygrid_filter: function(oSettings, aData, iDataIndex) { var ret = true; $.each (this.filters, function(index, filter) { /* XXX How to manage checkbox ? */ @@ -460,8 +460,8 @@ _selectAll: function() { // requires jQuery id var uuid=this.id.split("-"); - var oTable=$("#querytable-"+uuid[1]).dataTable(); - // Function available in QueryTable 1.9.x + var oTable=$("#querygrid-"+uuid[1]).dataTable(); + // Function available in QueryGrid 1.9.x // Filter : displayed data only var filterData = oTable._('tr', {"filter":"applied"}); /* TODO: WARNING if too many nodes selected, use filters to reduce nuber of nodes */ @@ -478,7 +478,7 @@ }); - $.plugin('QueryTable', QueryTable); + $.plugin('QueryGrid', QueryGrid); // /* define the 'dom-checkbox' type for sorting in datatables // http://datatables.net/examples/plug-ins/dom_sort.html diff --git a/plugins/querygrid/templates/querygrid.html b/plugins/querygrid/templates/querygrid.html new file mode 100644 index 00000000..63e47627 --- /dev/null +++ b/plugins/querygrid/templates/querygrid.html @@ -0,0 +1,3 @@ +
+
+
diff --git a/plugins/querytable/static/img/README b/plugins/querytable/static/img/README deleted file mode 100644 index 5df2d69b..00000000 --- a/plugins/querytable/static/img/README +++ /dev/null @@ -1,2 +0,0 @@ -these styling elements come from plekit with a simple transition to png -they're currently not all used in myslice diff --git a/plugins/querytable/static/img/tablesort-bullet1.png b/plugins/querytable/static/img/tablesort-bullet1.png deleted file mode 100644 index 4304f360..00000000 Binary files a/plugins/querytable/static/img/tablesort-bullet1.png and /dev/null differ diff --git a/plugins/querytable/static/img/tablesort-bullet2.png b/plugins/querytable/static/img/tablesort-bullet2.png deleted file mode 100644 index 4f181e19..00000000 Binary files a/plugins/querytable/static/img/tablesort-bullet2.png and /dev/null differ diff --git a/plugins/querytable/static/img/tablesort-col-alt.png b/plugins/querytable/static/img/tablesort-col-alt.png deleted file mode 100644 index 8179f830..00000000 Binary files a/plugins/querytable/static/img/tablesort-col-alt.png and /dev/null differ diff --git a/plugins/querytable/static/img/tablesort-gradient.png b/plugins/querytable/static/img/tablesort-gradient.png deleted file mode 100644 index 26558a49..00000000 Binary files a/plugins/querytable/static/img/tablesort-gradient.png and /dev/null differ diff --git a/plugins/querytable/static/img/tablesort-header-down.png b/plugins/querytable/static/img/tablesort-header-down.png deleted file mode 100644 index c8ed6576..00000000 Binary files a/plugins/querytable/static/img/tablesort-header-down.png and /dev/null differ diff --git a/plugins/querytable/static/img/tablesort-header-sortable.png b/plugins/querytable/static/img/tablesort-header-sortable.png deleted file mode 100644 index 0c169040..00000000 Binary files a/plugins/querytable/static/img/tablesort-header-sortable.png and /dev/null differ diff --git a/plugins/querytable/static/img/tablesort-header-up.png b/plugins/querytable/static/img/tablesort-header-up.png deleted file mode 100644 index d12fe2a5..00000000 Binary files a/plugins/querytable/static/img/tablesort-header-up.png and /dev/null differ diff --git a/plugins/querytable/static/img/tablesort-header.png b/plugins/querytable/static/img/tablesort-header.png deleted file mode 100644 index cff526f9..00000000 Binary files a/plugins/querytable/static/img/tablesort-header.png and /dev/null differ diff --git a/plugins/querytable/static/img/tablesort-td-alt.png b/plugins/querytable/static/img/tablesort-td-alt.png deleted file mode 100644 index ef5ab358..00000000 Binary files a/plugins/querytable/static/img/tablesort-td-alt.png and /dev/null differ diff --git a/plugins/querytable/static/img/toggle-hidden.png b/plugins/querytable/static/img/toggle-hidden.png deleted file mode 100755 index 023f22a8..00000000 Binary files a/plugins/querytable/static/img/toggle-hidden.png and /dev/null differ diff --git a/plugins/querytable/static/img/toggle-visible.png b/plugins/querytable/static/img/toggle-visible.png deleted file mode 100755 index baf6c286..00000000 Binary files a/plugins/querytable/static/img/toggle-visible.png and /dev/null differ diff --git a/plugins/querytable/templates/querytable.html b/plugins/querytable/templates/querytable.html deleted file mode 100644 index 7b885c80..00000000 --- a/plugins/querytable/templates/querytable.html +++ /dev/null @@ -1,3 +0,0 @@ -
-
-
diff --git a/trash/simpleview.py b/trash/simplegridview.py similarity index 92% rename from trash/simpleview.py rename to trash/simplegridview.py index 62150ebf..f0f23913 100644 --- a/trash/simpleview.py +++ b/trash/simplegridview.py @@ -1,4 +1,4 @@ -# just one instance of QueryTable, nothing more, nothing less +# just one instance of QueryGrid, nothing more, nothing less from django.views.generic.base import TemplateView from django.template import RequestContext from django.shortcuts import render_to_response @@ -9,9 +9,9 @@ from unfold.page import Page from ui.topmenu import topmenu_items, the_user -from plugins.querytable import QueryTable +from plugins.querygrid import QueryGrid -class SimpleView (TemplateView): +class SimpleGridView (TemplateView): def get (self, request, slicename='ple.inria.f14'): @@ -30,7 +30,7 @@ class SimpleView (TemplateView): 'user.user_hrn', #'application.measurement_point.counter' ) - # for internal use in the querytable plugin; + # for internal use in the querygrid plugin; # needs to be a unique column present for each returned record main_query_key = 'hrn' @@ -42,7 +42,7 @@ class SimpleView (TemplateView): sq_resource = aq.subquery('resource') - resources_as_list = QueryTable( + resources_as_list = QueryGrid( page = page, domid = 'resources-list', title = 'List view', diff --git a/trash/urls.py b/trash/urls.py index e2131d8d..4c96addb 100644 --- a/trash/urls.py +++ b/trash/urls.py @@ -1,10 +1,10 @@ from django.conf.urls import patterns, include, url -import trash.simpleview +import trash.simplegridview urlpatterns = patterns('', url(r'^tab/?$', 'trash.sampleviews.tab_view'), (r'^scroll/?$', 'trash.sampleviews.scroll_view'), (r'^plugin/?$', 'trash.pluginview.test_plugin_view'), (r'^dashboard/?$', 'trash.dashboard.dashboard_view'), - url(r'^simple/(?P[\w\.]+)/?$', trash.simpleview.SimpleView.as_view()), + url(r'^simple/(?P[\w\.]+)/?$', trash.simplegridview.SimpleGridView.as_view()), )