Fix #11 : jQuery delegated events for Firefox

This commit is contained in:
Gary Sharp
2013-08-19 17:36:22 +10:00
parent 760aba9cdf
commit 3596d325eb
2 changed files with 41 additions and 40 deletions
@@ -2,7 +2,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18033
// Runtime Version:4.0.30319.18051
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -182,13 +182,19 @@ WriteLiteral(@">
return false;
});
var removeComponentConfirmed = function (id, row) {
$deviceComponents.on('change', 'input', updateComponent);
$deviceComponents.on('focus', 'input', function () { $(this).select(); });
$deviceComponents.on('click', 'span.remove', removeComponent);
$deviceComponents.on('click', 'span.edit', editComponentJobTypes);
function removeComponentConfirmed(id, row) {
var data = { id: id };
$.ajax({
url: '");
#line 58 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
#line 64 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
Write(Url.Action(MVC.API.DeviceModel.ComponentRemove()));
@@ -200,26 +206,25 @@ WriteLiteral("\',\r\n dataType: \'json\',\r\n data
"lert(\'Unable to remove component: \' + d);\r\n }\r\n " +
" },\r\n error: function (jqXHR, textStatus, errorThrown) {\r\n " +
" alert(\'Unable to remove component: \' + textStatus);\r\n " +
" }\r\n });\r\n }\r\n var removeComponent = function () {\r\n " +
" var componentRow = $(this).closest(\'tr\');\r\n var id = compo" +
"nentRow.attr(\'data-devicecomponentid\');\r\n if (id) {\r\n " +
"var dialog = $(\"#dialogConfirmRemove\");\r\n var buttons = dialog.di" +
"alog(\"option\", \"buttons\");\r\n buttons[\'Remove\'] = function () { re" +
"moveComponentConfirmed(id, componentRow); $(this).dialog(\"close\"); };\r\n " +
" var buttons = dialog.dialog(\"option\", \"buttons\", buttons);\r\n " +
" dialog.dialog(\'open\');\r\n } else {\r\n // New - Remove" +
"\r\n componentRow.remove();\r\n }\r\n }\r\n var " +
"updateComponent = function () {\r\n var componentRow = $(this).closest(" +
"\'tr\');\r\n componentRow.find(\'input\').attr(\'disabled\', true).addClass(\'" +
"updating\');\r\n\r\n var id = componentRow.attr(\'data-devicecomponentid\');" +
"\r\n if (id) {\r\n // Update\r\n var data = {" +
"\r\n id: id,\r\n Description: componentRow.fin" +
"d(\'input.description\').val(),\r\n Cost: componentRow.find(\'inpu" +
"t.cost\').val()\r\n };\r\n $.ajax({\r\n " +
" url: \'");
" }\r\n });\r\n }\r\n function removeComponent() {\r\n " +
" var componentRow = $(this).closest(\'tr\');\r\n var id = componentRow" +
".attr(\'data-devicecomponentid\');\r\n if (id) {\r\n var dia" +
"log = $(\"#dialogConfirmRemove\");\r\n var buttons = dialog.dialog(\"o" +
"ption\", \"buttons\");\r\n buttons[\'Remove\'] = function () { removeCom" +
"ponentConfirmed(id, componentRow); $(this).dialog(\"close\"); };\r\n " +
"var buttons = dialog.dialog(\"option\", \"buttons\", buttons);\r\n dial" +
"og.dialog(\'open\');\r\n } else {\r\n // New - Remove\r\n " +
" componentRow.remove();\r\n }\r\n }\r\n function up" +
"dateComponent() {\r\n var componentRow = $(this).closest(\'tr\');\r\n " +
" componentRow.find(\'input\').attr(\'disabled\', true).addClass(\'updating\');\r\n\r" +
"\n var id = componentRow.attr(\'data-devicecomponentid\');\r\n " +
"if (id) {\r\n // Update\r\n var data = {\r\n " +
" id: id,\r\n Description: componentRow.find(\'input.descr" +
"iption\').val(),\r\n Cost: componentRow.find(\'input.cost\').val()" +
"\r\n };\r\n $.ajax({\r\n url: \'");
#line 100 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
#line 106 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
Write(Url.Action(MVC.API.DeviceModel.ComponentUpdate()));
@@ -254,7 +259,7 @@ WriteLiteral(@"',
url: '");
#line 126 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
#line 132 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
Write(Url.Action(MVC.API.DeviceModel.ComponentAdd(null, null, null)));
@@ -280,7 +285,7 @@ WriteLiteral(@"',
});
}
}
var editComponentJobTypes = function () {
function editComponentJobTypes() {
var edit$this = $(this);
var componentRow = edit$this.closest('tr');
@@ -294,7 +299,7 @@ WriteLiteral(@"',
url: '");
#line 157 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
#line 163 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
Write(Url.Action(MVC.API.DeviceModel.Component()));
@@ -322,7 +327,7 @@ WriteLiteral("\',\r\n dataType: \'json\',\r\n
"ajax({\r\n url: \'");
#line 181 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
#line 187 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
Write(Url.Action(MVC.API.DeviceModel.ComponentUpdateJobSubTypes()));
@@ -364,11 +369,7 @@ WriteLiteral("\',\r\n dataType: \'json\',\r\n
"\r\n },\r\n Cancel: function () {\r\n " +
" $(this).dialog(\"close\");\r\n }\r\n }\r\n });\r\n\r\n " +
" $(\'#CheckboxBulkSelect_dialogUpdateJobTypes\').checkboxBulkSelect({ parentSel" +
"ector: \'div\' });\r\n\r\n $deviceComponents.on(\'change\', \'input\', updateCompon" +
"ent);\r\n $deviceComponents.on(\'focus\', \'input\', function () { $(this).sele" +
"ct(); });\r\n\r\n $deviceComponents.on(\'click\', \'span.remove\', removeComponen" +
"t);\r\n $deviceComponents.on(\'click\', \'span.edit\', editComponentJobTypes);\r" +
"\n });\r\n</script>\r\n<div");
"ector: \'div\' });\r\n });\r\n</script>\r\n<div");
WriteLiteral(" id=\"dialogUpdateJobTypes\"");