From 6f3866936dcca5a410b5f2373b58c43322e6e2d6 Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Wed, 13 Oct 2010 01:10:05 +0000 Subject: [PATCH] BUGFIX: fixed undefined error in CTFs. BUGFIX: added action class to actions to allow the popup hook to open links (from r101807) git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@112039 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- javascript/ComplexTableField.js | 4 ++- templates/Includes/TableListField_Item.ss | 38 +++++++++++------------ 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/javascript/ComplexTableField.js b/javascript/ComplexTableField.js index b50d9de0e..6904b3aea 100755 --- a/javascript/ComplexTableField.js +++ b/javascript/ComplexTableField.js @@ -16,7 +16,8 @@ ComplexTableField.prototype = { rules['#'+this.id+' table.data a.deletelink'] = {onclick: this.deleteRecord.bind(this)}; // invoke row action-link based on default-action set in classname - defaultAction = this.getDefaultAction(); + var defaultAction = this.getDefaultAction(); + if(defaultAction) { rules['#'+this.id+' table.data tbody td'] = { onclick: function(e) { @@ -27,6 +28,7 @@ ComplexTableField.prototype = { if (elt.tagName != 'TD' && elt.tagName != 'TR') { return; } + var link = $$('.'+defaultAction, Event.element(e).parentNode)[0].href; this.openPopup(null, link); return false; diff --git a/templates/Includes/TableListField_Item.ss b/templates/Includes/TableListField_Item.ss index 734d78afa..e43b413f3 100755 --- a/templates/Includes/TableListField_Item.ss +++ b/templates/Includes/TableListField_Item.ss @@ -1,19 +1,19 @@ - class="$HighlightClasses"<% end_if %>> - <% if Markable %>$MarkingCheckbox<% end_if %> - <% control Fields %> - $Value - <% end_control %> - <% control Actions %> - - <% if IsAllowed %> - title="$TitleText"<% end_if %>> - <% if Icon %>$Label<% else %>$Label<% end_if %> - - <% else %> - - <% if IconDisabled %>$Label<% else %>$Label<% end_if %> - - <% end_if %> - - <% end_control %> - \ No newline at end of file + class="$HighlightClasses"<% end_if %>> + <% if Markable %>$MarkingCheckbox<% end_if %> + <% control Fields %> + $Value + <% end_control %> + <% control Actions %> + + <% if IsAllowed %> + title="$TitleText"<% end_if %>> + <% if Icon %>$Label<% else %>$Label<% end_if %> + + <% else %> + + <% if IconDisabled %>$Label<% else %>$Label<% end_if %> + + <% end_if %> + + <% end_control %> + \ No newline at end of file