From cb0cd3112ee73f4e9594ec86063828281911a03a Mon Sep 17 00:00:00 2001 From: jaroslav Date: Fri, 14 Mar 2014 11:52:52 +0100 Subject: [PATCH 1/5] sed builder / installer --- dev/INSTALL | 3 +++ dev/build/build.sed | 23 +++++++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 dev/INSTALL create mode 100644 dev/build/build.sed diff --git a/dev/INSTALL b/dev/INSTALL new file mode 100644 index 00000000..35817840 --- /dev/null +++ b/dev/INSTALL @@ -0,0 +1,3 @@ +cat jquery.jtable.build.txt | tr -d $'\r' | sed -n -f build/build.sed | sh + +cp -i ../jquery.jtable.js ~/www/wp-includes/js/jquery/ui/jquery.ui.jtable.js diff --git a/dev/build/build.sed b/dev/build/build.sed new file mode 100644 index 00000000..64fba03e --- /dev/null +++ b/dev/build/build.sed @@ -0,0 +1,23 @@ +# builds a shell command which invokes cat on all files and redirects the +# output to ../jquery.jtable.js +# usage: +# cd jtable/dev; sed -n -f build/build.sed jquery.jtable.build.txt | sh +1{ +i\ +cat \\ +} +/^add /{ + s/// + s/$/ \\/ + p +} +/^.*create.*\\/{ + s///; + h; + d +} +${ + g; + s/^/> ..\//; + p +} From 3e69b2b400bb8807a15e89d231598999d4fbda64 Mon Sep 17 00:00:00 2001 From: jaroslav Date: Fri, 14 Mar 2014 12:11:55 +0100 Subject: [PATCH 2/5] bootstrap class --- dev/INSTALL | 4 +++- dev/jquery.jtable.core.js | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/dev/INSTALL b/dev/INSTALL index 35817840..9a585f4c 100644 --- a/dev/INSTALL +++ b/dev/INSTALL @@ -1,3 +1,5 @@ +#!/bin/sh cat jquery.jtable.build.txt | tr -d $'\r' | sed -n -f build/build.sed | sh -cp -i ../jquery.jtable.js ~/www/wp-includes/js/jquery/ui/jquery.ui.jtable.js +DEST=/home/jaroslav/www/theme/js/jquery/ui/jquery.ui.jtable.js +cp -v ../jquery.jtable.js $DEST diff --git a/dev/jquery.jtable.core.js b/dev/jquery.jtable.core.js index a859986b..7fb695f0 100644 --- a/dev/jquery.jtable.core.js +++ b/dev/jquery.jtable.core.js @@ -236,6 +236,7 @@ _createTable: function () { this._$table = $('
') .addClass('jtable') + .addClass('table table-bordered') .appendTo(this._$mainContainer); if (this.options.tableId) { From e0368a4050bd9222268032d7ab737159f6294442 Mon Sep 17 00:00:00 2001 From: jaroslav Date: Fri, 14 Mar 2014 12:36:14 +0100 Subject: [PATCH 3/5] Send order_by and paging parameters via POST The default behavior of appending ?order_by=... to the url is inconsistent with this.options.ajaxSettings.type when it is set to POST. With this patch, a back-end service can be configured to ignore GET parameters all together, which could be good in some cases. fixes: #272 --- dev/jquery.jtable.paging.js | 5 +++++ dev/jquery.jtable.sorting.js | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/dev/jquery.jtable.paging.js b/dev/jquery.jtable.paging.js index 0f250000..7c5682fd 100644 --- a/dev/jquery.jtable.paging.js +++ b/dev/jquery.jtable.paging.js @@ -398,7 +398,12 @@ var jtStartIndex = (pageNumber - 1) * this.options.pageSize; var jtPageSize = this.options.pageSize; + if (this.options.ajaxSettings.type == 'POST') { + $.extend(this._lastPostData, {'jtStartIndex': jtStartIndex, 'jtPageSize': jtPageSize }); + return url; + } return (url + (url.indexOf('?') < 0 ? '?' : '&') + 'jtStartIndex=' + jtStartIndex + '&jtPageSize=' + jtPageSize); + }, /* Creates and shows the page list. diff --git a/dev/jquery.jtable.sorting.js b/dev/jquery.jtable.sorting.js index b7e9fa57..22b9ac54 100644 --- a/dev/jquery.jtable.sorting.js +++ b/dev/jquery.jtable.sorting.js @@ -177,7 +177,12 @@ sorting.push(value.fieldName + ' ' + value.sortOrder); }); + if (this.options.ajaxSettings.type == 'POST') { + $.extend(this._lastPostData, {'jtSorting': sorting.join(',') }); + return url; + } return (url + (url.indexOf('?') < 0 ? '?' : '&') + 'jtSorting=' + sorting.join(",")); + }, /* Overrides _createJtParamsForLoading method to add sorging parameters to jtParams object. @@ -199,4 +204,4 @@ }); -})(jQuery); \ No newline at end of file +})(jQuery); From 7dd45cc80eafce1a3ce3fbfa180264d6bd236a0a Mon Sep 17 00:00:00 2001 From: jaroslav Date: Fri, 14 Mar 2014 12:39:16 +0100 Subject: [PATCH 4/5] irrelevant files --- dev/INSTALL | 5 ----- dev/build/build.sed | 23 ----------------------- 2 files changed, 28 deletions(-) delete mode 100644 dev/INSTALL delete mode 100644 dev/build/build.sed diff --git a/dev/INSTALL b/dev/INSTALL deleted file mode 100644 index 9a585f4c..00000000 --- a/dev/INSTALL +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh -cat jquery.jtable.build.txt | tr -d $'\r' | sed -n -f build/build.sed | sh - -DEST=/home/jaroslav/www/theme/js/jquery/ui/jquery.ui.jtable.js -cp -v ../jquery.jtable.js $DEST diff --git a/dev/build/build.sed b/dev/build/build.sed deleted file mode 100644 index 64fba03e..00000000 --- a/dev/build/build.sed +++ /dev/null @@ -1,23 +0,0 @@ -# builds a shell command which invokes cat on all files and redirects the -# output to ../jquery.jtable.js -# usage: -# cd jtable/dev; sed -n -f build/build.sed jquery.jtable.build.txt | sh -1{ -i\ -cat \\ -} -/^add /{ - s/// - s/$/ \\/ - p -} -/^.*create.*\\/{ - s///; - h; - d -} -${ - g; - s/^/> ..\//; - p -} From f281b341ae80ea05b0f04e1d97c3c46ab7d42dcc Mon Sep 17 00:00:00 2001 From: jaroslav Date: Fri, 14 Mar 2014 12:41:15 +0100 Subject: [PATCH 5/5] irrelevant changes --- dev/jquery.jtable.core.js | 1 - 1 file changed, 1 deletion(-) diff --git a/dev/jquery.jtable.core.js b/dev/jquery.jtable.core.js index 7fb695f0..a859986b 100644 --- a/dev/jquery.jtable.core.js +++ b/dev/jquery.jtable.core.js @@ -236,7 +236,6 @@ _createTable: function () { this._$table = $('
') .addClass('jtable') - .addClass('table table-bordered') .appendTo(this._$mainContainer); if (this.options.tableId) {