From c780256979cfd64f66b6f250c142ea3e50a2af64 Mon Sep 17 00:00:00 2001 From: Tino Vazquez Date: Tue, 11 Mar 2014 12:28:10 +0100 Subject: [PATCH] In extended templates in Sunstone, alt+enter creates a new line, enter submits changes --- src/sunstone/public/js/plugins/users-tab.js | 2 +- src/sunstone/public/js/sunstone.js | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/sunstone/public/js/plugins/users-tab.js b/src/sunstone/public/js/plugins/users-tab.js index 395b061fd3..39b6a071ee 100644 --- a/src/sunstone/public/js/plugins/users-tab.js +++ b/src/sunstone/public/js/plugins/users-tab.js @@ -392,7 +392,7 @@ var user_actions = { call: OpenNebula.User.update, callback: function(request) { notifyMessage(tr("Template updated correctly")); - Sunstone.runAction('User.showinfo',request.request.data[0]); + Sunstone.runAction('User.showinfo',request.request.data[0][0]); }, error: onError }, diff --git a/src/sunstone/public/js/sunstone.js b/src/sunstone/public/js/sunstone.js index ceff34a373..ed1c2f3cf1 100644 --- a/src/sunstone/public/js/sunstone.js +++ b/src/sunstone/public/js/sunstone.js @@ -2705,6 +2705,19 @@ function insert_extended_template_table(template_json,resource_type,resource_id, } }); + // Capture the enter key + $('#new_value').live("keypress", function(e) { + var ev = e || window.event; + var key = ev.keyCode; + + if (key == 13 && !ev.altKey) + { + //Get the button the user wants to have clicked + $('#button_add_value', $(this).parent().parent()).click(); + ev.preventDefault(); + } + }) + // Listener for single values // Listener for key,value pair remove action