From c5854870424d87372bcc86a7edf75b9bf8841825 Mon Sep 17 00:00:00 2001 From: cash Date: Thu, 18 Nov 2010 16:13:34 +0000 Subject: Refs #1793 added ability to add widgets to layout through ajax git-svn-id: http://code.elgg.org/elgg/trunk@7338 36083f99-b078-4883-b0ff-0f9b5a30f544 --- views/default/css.php | 12 ++++++------ views/default/layouts/widgets.php | 21 ++++++++++----------- views/default/widgets/add.php | 26 ++++++++++++++++++++------ views/default/widgets/add_button.php | 2 +- 4 files changed, 37 insertions(+), 24 deletions(-) (limited to 'views/default') diff --git a/views/default/css.php b/views/default/css.php index edb0ebe07..d5b96bf59 100644 --- a/views/default/css.php +++ b/views/default/css.php @@ -863,28 +863,28 @@ li.navigation_more ul li { float: right; min-height: 15px; } -.widget_col_1 { +.widget_1_columns { width: 100%; } -.widget_col_2 { +.widget_2_columns { width: 48%; margin-right: 4%; } -.widget_col_3 { +.widget_3_columns { width: 32%; margin-right: 2%; } -.widget_col_4 { +.widget_4_columns { width: 23.5%; margin-right: 2%; } -.widget_first_col { +.widget_col_1 { margin-right: 0; } #widget_add_button { padding: 0px; - background-color: transparent; text-align: right; + margin-bottom: 15px; } .widgets_add { width: 100%; diff --git a/views/default/layouts/widgets.php b/views/default/layouts/widgets.php index 5d6e42a43..38451d1c1 100644 --- a/views/default/layouts/widgets.php +++ b/views/default/layouts/widgets.php @@ -18,12 +18,19 @@ elgg_push_context('widgets'); elgg_get_widgets($owner->guid, $context); if (elgg_can_edit_widgets()) { - echo elgg_view('widgets/add', array('widgets' => $widgets)); + if ($show_add_widgets) { + echo elgg_view('widgets/add_button'); + } + $params = array( + 'widgets' => $widgets, + 'context' => $context, + ); + echo elgg_view('widgets/add', $params); } echo $vars['box']; -$widget_class = "widget_col_$num_columns"; +$widget_class = "widget_{$num_columns}_columns"; for ($column_index = 1; $column_index <= $num_columns; $column_index++) { $widgets = get_widgets($owner->guid, $context, $column_index); @@ -34,15 +41,7 @@ for ($column_index = 1; $column_index <= $num_columns; $column_index++) { $widget2->handler = 'test'; $widgets = array($widget1, $widget2); - $first = ($column_index == 1) ? 'widget_first_col' : ''; - - echo "
"; - // button for adding new widgets - if ($column_index == 1) { - if ($show_add_widgets && elgg_can_edit_widgets()) { - echo elgg_view('widgets/add_button'); - } - } + echo "
"; if (is_array($widgets) && sizeof($widgets) > 0) { foreach ($widgets as $widget) { echo elgg_view_entity($widget); diff --git a/views/default/widgets/add.php b/views/default/widgets/add.php index 2cc06dab7..9687c5bea 100644 --- a/views/default/widgets/add.php +++ b/views/default/widgets/add.php @@ -3,18 +3,32 @@ $widgets = $vars['widgets']; $widget_types = get_widget_types(); +$context = $vars['context']; + ?> diff --git a/views/default/widgets/add_button.php b/views/default/widgets/add_button.php index 8ec36b086..2957513b6 100644 --- a/views/default/widgets/add_button.php +++ b/views/default/widgets/add_button.php @@ -1,7 +1,7 @@ -
+
'#', -- cgit v1.2.3