aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-12-19 22:51:23 +0000
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-12-19 22:51:23 +0000
commit1f68d84ee83efd73ce5fec5af7a14a1fb234977a (patch)
treec218e5282a9c536e921b35c2a8448c04cb4a8f05 /js
parent8784c7282009b9cd14b166d57617525424ef94a5 (diff)
downloadelgg-1f68d84ee83efd73ce5fec5af7a14a1fb234977a.tar.gz
elgg-1f68d84ee83efd73ce5fec5af7a14a1fb234977a.tar.bz2
fixed a few bugs and updated the widget code
git-svn-id: http://code.elgg.org/elgg/trunk@7694 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'js')
-rw-r--r--js/lib/ui.js2
-rw-r--r--js/lib/ui.widgets.js36
2 files changed, 13 insertions, 25 deletions
diff --git a/js/lib/ui.js b/js/lib/ui.js
index 1ebc3bca6..c7eda593c 100644
--- a/js/lib/ui.js
+++ b/js/lib/ui.js
@@ -6,7 +6,7 @@ elgg.ui.init = function () {
$(this).stop().fadeOut('fast');
});
- $('.elgg-toggle').click(elgg.ui.toggle);
+ $('.elgg-toggle').live('click', elgg.ui.toggle);
$('a.collapsibleboxlink').click(elgg.ui.toggleCollapsibleBox);
diff --git a/js/lib/ui.widgets.js b/js/lib/ui.widgets.js
index 867b53af5..87f552d50 100644
--- a/js/lib/ui.widgets.js
+++ b/js/lib/ui.widgets.js
@@ -24,10 +24,10 @@ elgg.ui.widgets.init = function() {
});
$('.elgg-widgets-add-panel li.elgg-widget-available').click(elgg.ui.widgets.add);
- $('a.elgg-widget-delete-button').click(elgg.ui.widgets.remove);
- $('a.elgg-widget-edit-button').click(elgg.ui.widgets.editToggle);
- $('.elgg-widget-edit > form ').submit(elgg.ui.widgets.saveSettings);
- $('a.elgg-widget-collapse-button').click(elgg.ui.widgets.collapseToggle);
+
+ $('a.elgg-widget-delete-button').live('click', elgg.ui.widgets.remove);
+ $('.elgg-widget-edit > form ').live('submit', elgg.ui.widgets.saveSettings);
+ $('a.elgg-widget-collapse-button').live('click', elgg.ui.widgets.collapseToggle);
elgg.ui.widgets.equalHeight(".elgg-widgets");
};
@@ -62,10 +62,6 @@ elgg.ui.widgets.add = function(event) {
success: function(json) {
$('#elgg-widget-col-1').prepend(json.output);
var $widget = $('#elgg-widget-col-1').children(":first");
- $widget.find('a.elgg-widget-delete-button').click(elgg.ui.widgets.remove);
- $widget.find('a.elgg-widget-edit-button').click(elgg.ui.widgets.editToggle);
- $widget.find('a.elgg-widget-collapse-button').click(elgg.ui.widgets.collapseToggle);
- $widget.find('.elgg-widget-edit > form ').submit(elgg.ui.widgets.saveSettings);
}
});
event.preventDefault();
@@ -141,20 +137,7 @@ elgg.ui.widgets.remove = function(event) {
}
/**
- * Toggle the edit panel of a widget
- *
- * Yes, I'm quite bad at selectors.
- *
- * @param {Object} event
- * @return void
- */
-elgg.ui.widgets.editToggle = function(event) {
- $(this).parent().parent().find('.elgg-widget-edit').slideToggle('medium');
- event.preventDefault();
-}
-
-/**
- * Toogle the collapse state of the widget
+ * Toggle the collapse state of the widget
*
* @param {Object} event
* @return void
@@ -176,8 +159,13 @@ elgg.ui.widgets.collapseToggle = function(event) {
elgg.ui.widgets.saveSettings = function(event) {
$(this).parent().slideToggle('medium');
var $widgetContent = $(this).parent().parent().children('.elgg-widget-content');
- // @todo - change to ajax loader
- $widgetContent.html('loading');
+
+ // stick the ajaxk loader in there
+ var $loader = $('#elgg-widget-loader').clone();
+ $loader.attr('id', '#elgg-widget-active-loader');
+ $loader.removeClass('hidden');
+ $widgetContent.html($loader);
+
elgg.action('widgets/save', {
data: $(this).serialize(),
success: function(json) {