aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-11-18 23:01:39 +0000
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-11-18 23:01:39 +0000
commitebcbf0cb3b4c4053565adc089acfb8bc96605701 (patch)
treed2fcaba04d6da52016dae5389b92f4cc54853790 /js
parenta24e700999b38185bea3e80dc8461aed271406cb (diff)
downloadelgg-ebcbf0cb3b4c4053565adc089acfb8bc96605701.tar.gz
elgg-ebcbf0cb3b4c4053565adc089acfb8bc96605701.tar.bz2
Added functions to support moving and adding widgets
git-svn-id: http://code.elgg.org/elgg/trunk@7340 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'js')
-rw-r--r--js/lib/ui.widgets.js20
1 files changed, 16 insertions, 4 deletions
diff --git a/js/lib/ui.widgets.js b/js/lib/ui.widgets.js
index b1e7b2a99..507a1a1a8 100644
--- a/js/lib/ui.widgets.js
+++ b/js/lib/ui.widgets.js
@@ -1,7 +1,7 @@
elgg.provide('elgg.ui.widgets');
elgg.ui.widgets.init = function() {
- $(".widget_column" ).sortable({
+ $(".widget_column").sortable({
items: 'div.widget',
connectWith: '.widget_column',
handle: 'div.drag_handle',
@@ -27,11 +27,23 @@ elgg.ui.widgets.init = function() {
});
event.preventDefault();
});
+
+ elgg.ui.widgets.equalHeight(".widget_column");
};
// insert a widget into the layout
elgg.ui.widgets.insert = function(html) {
- $('.widget_first_col').prepend(html);
+ $('.widget_col_1').prepend(html);
+}
+
+elgg.ui.widgets.equalHeight = function(selector) {
+ var maxHeight = 0;
+ $(selector).each(function() {
+ if ($(this).height() > maxHeight) {
+ maxHeight = $(this).height();
+ }
+ })
+ $(selector).css('min-height', maxHeight);
}
//List active widgets for each page column
@@ -85,7 +97,7 @@ elgg.ui.widgets.toggleContent = function(e) {
// set cookie for widget panel open-state
thisWidgetName = $(this.parentNode.parentNode.parentNode).attr('id');
- elgg.session.cookie(thisWidgetName, 'expanded', {expires: 365 });
+ elgg.session.cookie(thisWidgetName, 'expanded', {expires: 365});
} else {
targetContent.slideUp(400);
@@ -96,7 +108,7 @@ elgg.ui.widgets.toggleContent = function(e) {
// set cookie for widget panel closed-state
thisWidgetName = $(this.parentNode.parentNode.parentNode).attr('id');
- elgg.session.cookie(thisWidgetName, 'collapsed', { expires: 365 });
+ elgg.session.cookie(thisWidgetName, 'collapsed', {expires: 365});
}
return false;
};