From 290552dd2f9d49663a552d63acfc844560db7303 Mon Sep 17 00:00:00 2001 From: Daniel Schmitzer Date: Wed, 18 May 2016 17:17:39 +0000 Subject: - InlineEdit neu mit Select auswahl - Type Auswahl für neue Varianten MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://[internal]/wordpress/plugins/wpsg4@5489 0d5edaf7-2b12-4e95-93f4-047927463d4b --- views/css/admin.css | 1 + views/js/editable.js | 43 +++++++++++++++++++++---- views/mods/mod_productvariants/admin_show.phtml | 13 ++++++++ 3 files changed, 50 insertions(+), 7 deletions(-) diff --git a/views/css/admin.css b/views/css/admin.css index ab93e34..3779d03 100644 --- a/views/css/admin.css +++ b/views/css/admin.css @@ -132,6 +132,7 @@ .wpsg_mod_productvariants_table_variants .col_action { text-align:right; width:60px; } .wpsg_mod_productvariants_table_variants .col_products { text-align:center; width:75px; } .wpsg_mod_productvariants_table_variants .col_vari { width:75px; text-align:center; } +.wpsg_mod_productvariants_table_variants .col_type { width:100px; } .wpsg_mod_productvariants_table_variants .col_id { width:50px; } .wpsg_mod_productvariants_table_variation .col_action { text-align:right; width:75px; } .wpsg_mod_productvariants_table_variation tbody:nth-child(even) td { background-color:#F9F9F9; } diff --git a/views/js/editable.js b/views/js/editable.js index 7da81f2..d05345a 100644 --- a/views/js/editable.js +++ b/views/js/editable.js @@ -6,7 +6,7 @@ return this.each(function() { - jQuery(this).editable( { + var opt = { 'type': 'text', 'url': url, 'pk': 1, @@ -20,13 +20,42 @@ if(jQuery.trim(value) == '') { return wpsg_ajax.ie_validate_empty; } - }, - 'display': function(value, sourceData) { - - jQuery(this).html(sourceData); + } + }; + + if (options.type == 'select' && typeof options.data == "string") { + + var ar = []; + var arData = jQuery.parseJSON(options.data); + + for (var i in arData) + { + + ar.push( { + 'value': i, + 'text': arData[i] + } ); + + if (arData[i] == jQuery(this).text()) opt.value = i; - } - } ); + } + + opt.type = 'select'; + opt.source = ar; + + } + else + { + + opt.display = function(value, sourceData) { + + jQuery(this).html(sourceData); + + }; + + } + + jQuery(this).editable(opt); } ); diff --git a/views/mods/mod_productvariants/admin_show.phtml b/views/mods/mod_productvariants/admin_show.phtml index 099d8a2..780dc53 100644 --- a/views/mods/mod_productvariants/admin_show.phtml +++ b/views/mods/mod_productvariants/admin_show.phtml @@ -15,6 +15,7 @@ + view['product_id'])) { ?> @@ -34,6 +35,7 @@   + view['product_id'])) echo $var['count_active'].'/'.$var['count_variation']; @@ -48,12 +50,23 @@ -- cgit v1.2.3