diff options
author | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-11-20 22:19:11 +0000 |
---|---|---|
committer | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-11-20 22:19:11 +0000 |
commit | b827319a8b0c17ea362bf55548557862a04f0ba9 (patch) | |
tree | ea5873d2fa2ca427323dc6ca9d1e8dff8450f8d8 /js/lib | |
parent | 96f880d1e535aaf47d0c67cfe3da8fca638dc00d (diff) | |
download | elgg-b827319a8b0c17ea362bf55548557862a04f0ba9.tar.gz elgg-b827319a8b0c17ea362bf55548557862a04f0ba9.tar.bz2 |
added collapsible state to widgets
git-svn-id: http://code.elgg.org/elgg/trunk@7392 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'js/lib')
-rw-r--r-- | js/lib/ui.widgets.js | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/js/lib/ui.widgets.js b/js/lib/ui.widgets.js index a26be4154..93de96407 100644 --- a/js/lib/ui.widgets.js +++ b/js/lib/ui.widgets.js @@ -32,6 +32,7 @@ elgg.ui.widgets.init = function() { $('a.widget_delete_button').click(elgg.ui.widgets.remove);
$('a.widget_edit_button').click(elgg.ui.widgets.editToggle);
$('.widget_edit > form ').submit(elgg.ui.widgets.saveSettings);
+ $('a.widget_collapse_button').click(elgg.ui.widgets.collapseToggle);
elgg.ui.widgets.equalHeight(".widget_column");
};
@@ -65,8 +66,11 @@ elgg.ui.widgets.add = function(event) { },
success: function(json) {
$('#widget_col_1').prepend(json.output);
- $('#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);
+ var $widget = $('#widget_col_1').children(":first");
+ $widget.find('a.widget_delete_button').click(elgg.ui.widgets.remove);
+ $widget.find('a.widget_edit_button').click(elgg.ui.widgets.editToggle);
+ $widget.find('a.widget_collapse_button').click(elgg.ui.widgets.collapseToggle);
+ $widget.find('.widget_edit > form ').submit(elgg.ui.widgets.saveSettings);
}
});
event.preventDefault();
@@ -108,7 +112,7 @@ elgg.ui.widgets.move = function(event, ui) { * @return void
*/
elgg.ui.widgets.remove = function(event) {
- var $widget = $(this).parent().parent().parent().parent();
+ var $widget = $(this).parent().parent();
// if widget type is single instance type, enable the add buton
var type = $widget.attr('class');
@@ -146,7 +150,19 @@ elgg.ui.widgets.remove = function(event) { * @return void
*/
elgg.ui.widgets.editToggle = function(event) {
- $(this).parent().parent().parent().parent().find('.widget_edit').slideToggle('medium');
+ $(this).parent().parent().find('.widget_edit').slideToggle('medium');
+ event.preventDefault();
+}
+
+/**
+ * Toogle the collapse state of the widget
+ *
+ * @param {Object} event
+ * @return void
+ */
+elgg.ui.widgets.collapseToggle = function(event) {
+ $(this).toggleClass('widget_collapsed');
+ $(this).parent().parent().find('.widget_container').slideToggle('medium');
event.preventDefault();
}
|