aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-11-19 20:43:48 +0000
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-11-19 20:43:48 +0000
commit3b46665b3f4ee10e9d2778033ea7180cca7571eb (patch)
tree6cbea6da55887db7bbd587df9b7e4d8cb209cea2 /js
parentf42382e0bff1692e2ddcd1c8eb316836e3020f1e (diff)
downloadelgg-3b46665b3f4ee10e9d2778033ea7180cca7571eb.tar.gz
elgg-3b46665b3f4ee10e9d2778033ea7180cca7571eb.tar.bz2
saving widget settings
git-svn-id: http://code.elgg.org/elgg/trunk@7350 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'js')
-rw-r--r--js/lib/ui.widgets.js24
1 files changed, 19 insertions, 5 deletions
diff --git a/js/lib/ui.widgets.js b/js/lib/ui.widgets.js
index 59cafd7ad..f20ac19c2 100644
--- a/js/lib/ui.widgets.js
+++ b/js/lib/ui.widgets.js
@@ -39,15 +39,17 @@ elgg.ui.widgets.init = function() {
event.preventDefault();
});
- $('a.widget_delete').bind('click', elgg.ui.widgets.remove);
-
+ $('a.widget_delete_button').bind('click', elgg.ui.widgets.remove);
+ $('a.widget_edit_button').bind('click', elgg.ui.widgets.editToggle);
+ $('.widget_edit > form ').bind('submit', elgg.ui.widgets.saveSettings);
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);
+ $('#widget_col_1').children(":first").find('a.widget_delete_button').bind('click', elgg.ui.widgets.remove);
+ $('#widget_col_1').children(":first").find('a.widget_edit_button').bind('click', elgg.ui.widgets.editToggle);
}
// remove a widget from the layout
@@ -55,13 +57,25 @@ 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)
+ // widget_delete_button_<guid>
+ guid: $(this).attr('id').substring(21)
}
});
event.preventDefault();
}
+elgg.ui.widgets.editToggle = function(event) {
+ $(this).parent().parent().parent().parent().find('.widget_edit').slideToggle('medium');
+ event.preventDefault();
+}
+
+elgg.ui.widgets.saveSettings = function(event) {
+ $(this).parent().slideToggle('medium');
+ elgg.action('widgets/save', {
+ data: $(this).serialize()
+ });
+ event.preventDefault();
+}
elgg.ui.widgets.equalHeight = function(selector) {
var maxHeight = 0;