aboutsummaryrefslogtreecommitdiff
path: root/views/default
diff options
context:
space:
mode:
Diffstat (limited to 'views/default')
-rw-r--r--views/default/css.php12
-rw-r--r--views/default/layouts/widgets.php21
-rw-r--r--views/default/widgets/add.php26
-rw-r--r--views/default/widgets/add_button.php2
4 files changed, 37 insertions, 24 deletions
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 "<div class=\"widget_column $widget_class $first\">";
- // button for adding new widgets
- if ($column_index == 1) {
- if ($show_add_widgets && elgg_can_edit_widgets()) {
- echo elgg_view('widgets/add_button');
- }
- }
+ echo "<div class=\"widget_column $widget_class widget_col_$column_index\">";
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'];
+
?>
<div class="widgets_add hidden">
<p>
<?php echo elgg_echo('widgets:add:description'); ?>
</p>
<ul>
- <?php
- foreach ($widget_types as $widget_type) {
- $link = elgg_view('output/url', array('text' => $widget_type->name, 'href' => '#'));
- echo "<li>$link</li>";
- }
- ?>
+<?php
+ foreach ($widget_types as $handler => $widget_type) {
+ $options = array(
+ 'text' => $widget_type->name,
+ 'href' => '#',
+ 'internalid' => $handler,
+ );
+ $link = elgg_view('output/url', $options);
+ echo "<li>$link</li>";
+ }
+?>
</ul>
+<?php
+ $params = array(
+ 'internalname' => 'widget_context',
+ 'value' => $context
+ );
+ echo elgg_view('input/hidden', $params);
+?>
<div class="clearfloat"></div>
</div>
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 @@
<?php
?>
-<div class="widget" id="widget_add_button">
+<div id="widget_add_button">
<?php
$options = array(
'href' => '#',