From a12af0679b48cf5481c88802d8bf2001b3b47f8d Mon Sep 17 00:00:00 2001 From: Ivan Tyagov <ivan@nexedi.com> Date: Thu, 17 Mar 2011 14:58:21 +0000 Subject: [PATCH] Fix listbox type in. Make first, last, next and previous buttons work within popup ui style. git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@44396 20353a03-c40f-0410-a6d1-a30d3c3de9de --- .../erp5_popup_ui/erp5_popup.js.xml | 19 +++++++++++++++---- bt5/erp5_popup_ui/bt/revision | 2 +- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/bt5/erp5_popup_ui/SkinTemplateItem/portal_skins/erp5_popup_ui/erp5_popup.js.xml b/bt5/erp5_popup_ui/SkinTemplateItem/portal_skins/erp5_popup_ui/erp5_popup.js.xml index a9ed43c0aa..d86eae9c2c 100644 --- a/bt5/erp5_popup_ui/SkinTemplateItem/portal_skins/erp5_popup_ui/erp5_popup.js.xml +++ b/bt5/erp5_popup_ui/SkinTemplateItem/portal_skins/erp5_popup_ui/erp5_popup.js.xml @@ -153,9 +153,9 @@ $(function() {\n load(form.attr(\'action\'), $.param(params) + \'&\' + form.serialize());\n });\n \n - // XXX Remove the hardcoded handler.\n - $(\'input[type="text"][name="listbox_page_start"][onkeypress]\', dialog).removeAttr(\'onkeypress\');\n - $(\'input[type="text"][name="listbox_page_start"]\', dialog).keypress(function(event) {\n + // listbox type in page number\n + $(\'input[name="listbox_page_start"][onkeypress]\', dialog).removeAttr(\'onkeypress\');\n + $(\'input[name="listbox_page_start"]\', dialog).keypress(function(event) {\n if (event.keyCode == \'13\') {\n event.preventDefault();\n var self = $(this);\n @@ -165,7 +165,18 @@ $(function() {\n load(\'listbox_setPage\', form.serialize());\n }\n });\n -\n + \n + // Listbox next & previous, last & first buttons\n + $.each(["listbox_nextPage", "listbox_previousPage", "listbox_firstPage", "listbox_lastPage"], \n + function(index, value) {\n + var button = $(\'button[type="submit"][name="\' + value + \':method"]\', dialog).first();\n + button.click(function(event) {\n + var form = $(\'form.main_form\', dialog);\n + event.preventDefault();\n + load(value, form.serialize()); \n + });\n + });\n + \n $(\'th.listbox-table-filter-cell input[type="text"]\', dialog).removeAttr(\'onkeypress\').keypress(function(event) {\n if (event.keyCode == \'13\') {\n event.preventDefault();\n diff --git a/bt5/erp5_popup_ui/bt/revision b/bt5/erp5_popup_ui/bt/revision index dec2bf5d61..2edeafb09d 100644 --- a/bt5/erp5_popup_ui/bt/revision +++ b/bt5/erp5_popup_ui/bt/revision @@ -1 +1 @@ -19 \ No newline at end of file +20 \ No newline at end of file -- 2.30.9