From 96413beb3bc024d3ee30a0c22335c6285724ace5 Mon Sep 17 00:00:00 2001 From: "David E. Wheeler" Date: Tue, 23 Mar 2010 02:02:13 -0400 Subject: [PATCH] Move `deleteContrib()` function to `lib.js`. Don't know why there were two different versions of this function, but the one in `widgets/profile/contributors.index` didn't work very well at all. So let's just use one and load it only once, hrm? --- comp/media/js/lib.js | 12 ++++++++++++ comp/widgets/profile/contributors/edit.html | 8 +------- comp/widgets/story_prof/edit_meta.html | 12 ------------ 3 files changed, 13 insertions(+), 19 deletions(-) diff --git a/comp/media/js/lib.js b/comp/media/js/lib.js index d6dfa0424..63412e0bd 100644 --- a/comp/media/js/lib.js +++ b/comp/media/js/lib.js @@ -181,6 +181,18 @@ function validateStory(obj) { return true; } +// Deletes a contributor table row from the DOM. +function deleteContrib(button) { + var id = $(button).value; + var index = $('contrib_order_' + id).selectedIndex; + $('contribs').select('.reorder').each(function(select) { + if (select.selectedIndex > index) select.selectedIndex--; + Element.remove(select.options[select.options.length - 1]); + }); + Element.remove($('contrib_id_' + id).parentNode.parentNode); + alternateTableRows('contribs'); +} + /* returns number of words in form field, based on number of spaces found */ diff --git a/comp/widgets/profile/contributors/edit.html b/comp/widgets/profile/contributors/edit.html index c26efe301..a73e2593f 100644 --- a/comp/widgets/profile/contributors/edit.html +++ b/comp/widgets/profile/contributors/edit.html @@ -1,12 +1,6 @@ <& '/widgets/wrappers/table_top.mc', caption => 'Current Contributors' &> -
<& '_list.html', asset => $asset, @@ -32,7 +26,7 @@ disp => 'Save', name => 'save', button => 'save_red', - js => qq{onclick="window.opener.document.getElementById('contribs').innerHTML = \$('contribs').innerHTML; self.close(); return false"}, + js => q{onclick="window.opener.document.getElementById('contribs').innerHTML = $('contribs').innerHTML; self.close(); return false"}, useTable => 0 &>
diff --git a/comp/widgets/story_prof/edit_meta.html b/comp/widgets/story_prof/edit_meta.html index b90fd0fd6..7f733e794 100644 --- a/comp/widgets/story_prof/edit_meta.html +++ b/comp/widgets/story_prof/edit_meta.html @@ -177,18 +177,6 @@ caption => "Contributors", number => $num++ &> -
<& '/widgets/profile/contributors/_list.html', asset => $story,