diff options
author | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-11-19 19:11:03 +0000 |
---|---|---|
committer | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-11-19 19:11:03 +0000 |
commit | f42382e0bff1692e2ddcd1c8eb316836e3020f1e (patch) | |
tree | bd11cb29bbae69f0daff3c0cd9c273203c788dc9 /js/lib | |
parent | b70654070d83323853f808beccc6780cfcd51ce4 (diff) | |
download | elgg-f42382e0bff1692e2ddcd1c8eb316836e3020f1e.tar.gz elgg-f42382e0bff1692e2ddcd1c8eb316836e3020f1e.tar.bz2 |
users can delete widgets from layout
git-svn-id: http://code.elgg.org/elgg/trunk@7349 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'js/lib')
-rw-r--r-- | js/lib/ui.widgets.js | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/js/lib/ui.widgets.js b/js/lib/ui.widgets.js index 32de71871..59cafd7ad 100644 --- a/js/lib/ui.widgets.js +++ b/js/lib/ui.widgets.js @@ -39,14 +39,30 @@ elgg.ui.widgets.init = function() { event.preventDefault();
});
+ $('a.widget_delete').bind('click', elgg.ui.widgets.remove);
+
elgg.ui.widgets.equalHeight(".widget_column");
};
// insert a widget into the layout
elgg.ui.widgets.insert = function(html) {
$('#widget_col_1').prepend(html);
+ $('#widget_col_1').children(":first").find('a.widget_delete').bind('click', elgg.ui.widgets.remove);
+}
+
+// remove a widget from the layout
+elgg.ui.widgets.remove = function(event) {
+ $(this).parent().parent().parent().parent().remove();
+ elgg.action('widgets/delete', {
+ data: {
+ // widget_delete_<guid>
+ guid: $(this).attr('id').substring(14)
+ }
+ });
+ event.preventDefault();
}
+
elgg.ui.widgets.equalHeight = function(selector) {
var maxHeight = 0;
$(selector).each(function() {
|