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
This commit is contained in:
Sam Minnee 2010-10-13 01:10:05 +00:00
parent 1a12f98382
commit 6f3866936d
2 changed files with 22 additions and 20 deletions

View File

@ -16,7 +16,8 @@ ComplexTableField.prototype = {
rules['#'+this.id+' table.data a.deletelink'] = {onclick: this.deleteRecord.bind(this)}; rules['#'+this.id+' table.data a.deletelink'] = {onclick: this.deleteRecord.bind(this)};
// invoke row action-link based on default-action set in classname // invoke row action-link based on default-action set in classname
defaultAction = this.getDefaultAction(); var defaultAction = this.getDefaultAction();
if(defaultAction) { if(defaultAction) {
rules['#'+this.id+' table.data tbody td'] = { rules['#'+this.id+' table.data tbody td'] = {
onclick: function(e) { onclick: function(e) {
@ -27,6 +28,7 @@ ComplexTableField.prototype = {
if (elt.tagName != 'TD' && elt.tagName != 'TR') { if (elt.tagName != 'TD' && elt.tagName != 'TR') {
return; return;
} }
var link = $$('.'+defaultAction, Event.element(e).parentNode)[0].href; var link = $$('.'+defaultAction, Event.element(e).parentNode)[0].href;
this.openPopup(null, link); this.openPopup(null, link);
return false; return false;

View File

@ -1,19 +1,19 @@
<tr id="record-$Parent.id-$ID"<% if HighlightClasses %> class="$HighlightClasses"<% end_if %>> <tr id="record-$Parent.id-$ID"<% if HighlightClasses %> class="$HighlightClasses"<% end_if %>>
<% if Markable %><td width="16" class="markingcheckbox">$MarkingCheckbox</td><% end_if %> <% if Markable %><td width="16" class="markingcheckbox">$MarkingCheckbox</td><% end_if %>
<% control Fields %> <% control Fields %>
<td class="field-$Title.HTMLATT $FirstLast $Name">$Value</td> <td class="field-$Title.HTMLATT $FirstLast $Name">$Value</td>
<% end_control %> <% end_control %>
<% control Actions %> <% control Actions %>
<td width="16"> <td width="16" class="action">
<% if IsAllowed %> <% if IsAllowed %>
<a class="$Class" href="$Link"<% if TitleText %> title="$TitleText"<% end_if %>> <a class="$Class" href="$Link"<% if TitleText %> title="$TitleText"<% end_if %>>
<% if Icon %><img src="$Icon" alt="$Label" /><% else %>$Label<% end_if %> <% if Icon %><img src="$Icon" alt="$Label" /><% else %>$Label<% end_if %>
</a> </a>
<% else %> <% else %>
<span class="disabled"> <span class="disabled">
<% if IconDisabled %><img src="$IconDisabled" alt="$Label" /><% else %>$Label<% end_if %> <% if IconDisabled %><img src="$IconDisabled" alt="$Label" /><% else %>$Label<% end_if %>
</span> </span>
<% end_if %> <% end_if %>
</td> </td>
<% end_control %> <% end_control %>
</tr> </tr>