From 84d91f9517e1c6ace76501c0f4e33df75f1c0022 Mon Sep 17 00:00:00 2001 From: Thierry Parmentelat Date: Fri, 15 Mar 2013 10:56:33 +0100 Subject: [PATCH] fix lists when receiving emtpy or error result - add myslice_warning and myslice_error in the mix --- plugins/lists/simplelist.js | 10 +++++----- plugins/lists/simplelist.py | 1 + views/css/myslice.css | 2 ++ views/js/myslice.js | 2 ++ 4 files changed, 10 insertions(+), 5 deletions(-) create mode 100644 views/js/myslice.js diff --git a/plugins/lists/simplelist.js b/plugins/lists/simplelist.js index 6ea2a77d..20f2a84e 100644 --- a/plugins/lists/simplelist.js +++ b/plugins/lists/simplelist.js @@ -10,7 +10,7 @@ (function($){ var debug=false; - //debug=true + debug=true $.fn.SimpleList = function( method ) { /* Method calling logic */ @@ -72,14 +72,14 @@ $plugindiv.closest('.need-spin').spin(false); if (rows.length == 0) { - if (use_datatables) datatables_set_message ("No result"); - else regular_set_message ("No result"); + if (use_datatables) datatables_set_message ($table, $tbody, myslice_warning("No result")); + else regular_set_message ($table, $tbody, myslice_warning("No result")); return; } if (typeof rows[0].error != 'undefined') { var error="ERROR: " + rows[0].error; - if (use_datatables) datatables_set_message (error); - else regular_set_message (error); + if (use_datatables) datatables_set_message ($table, $tbody, myslice_error(error)); + else regular_set_message ($table, $tbody, myslice_error(error)); return; } var options = $plugindiv.data().SimpleList; diff --git a/plugins/lists/simplelist.py b/plugins/lists/simplelist.py index 50cd573d..405b2e78 100644 --- a/plugins/lists/simplelist.py +++ b/plugins/lists/simplelist.py @@ -23,6 +23,7 @@ class SimpleList (Plugin) : reqs = { 'js_files' : [ "js/simplelist.js", "js/plugin.js", "js/query.js", "js/onavail.js", "js/manifold-pubsub.js", "js/manifold-async.js", "js/spin.presets.js", "js/spin.min.js", "js/jquery.spin.js", + "js/myslice.js", ] , 'css_files': [ "css/simplelist.css" ], } diff --git a/views/css/myslice.css b/views/css/myslice.css index a6167d28..9ae36c6e 100644 --- a/views/css/myslice.css +++ b/views/css/myslice.css @@ -4,3 +4,5 @@ padding: 10; background-color: #fff2ff; } +span.myslice-warning { background-color: orange; } +span.myslice-error { background-color: red; } diff --git a/views/js/myslice.js b/views/js/myslice.js new file mode 100644 index 00000000..644a3d0d --- /dev/null +++ b/views/js/myslice.js @@ -0,0 +1,2 @@ +function myslice_warning(text){ return ""+text+""; } +function myslice_error(text){ return ""+text+""; } -- 2.43.0