Skip to content

Commit

Permalink
minor tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
cornernote committed Jul 7, 2015
1 parent 2099171 commit a7ca997
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 12 deletions.
18 changes: 9 additions & 9 deletions docs/layouts.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,6 @@ echo '<div class="row">';
foreach ($regionPanels as $region => $items) {
echo '<div class="col-md-6">';

// hidden element to store the sort order
echo \yii\helpers\Html::hiddenInput(
'DashboardPanelSort[' . $region . ']',
implode(',', \yii\helpers\ArrayHelper::map($items, 'options.id', 'options.id')),
[
'id' => 'input-dashboard-region-' . $region,
]
);

// sortable widget to enable drag-and-drop
echo \kartik\sortable\Sortable::widget([
'id' => 'dashboard-region-' . $region,
Expand All @@ -113,6 +104,15 @@ foreach ($regionPanels as $region => $items) {
],
]);

// hidden element to store the sort order
echo \yii\helpers\Html::hiddenInput(
'DashboardPanelSort[' . $region . ']',
implode(',', \yii\helpers\ArrayHelper::map($items, 'options.id', 'options.id')),
[
'id' => 'input-dashboard-region-' . $region,
]
);

// create dashboard panel button
echo '<div class="text-center">';
echo \yii\helpers\Html::a('Create Dashboard Panel', [
Expand Down
13 changes: 10 additions & 3 deletions src/views/dashboard/layouts/default/update.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@
echo '<div class="row">';
foreach ($regionPanels as $region => $items) {
echo '<div class="col-md-' . $span . '">';
echo Html::hiddenInput('DashboardPanelSort[' . $region . ']', implode(',', ArrayHelper::map($items, 'options.id', 'options.id')), [
'id' => 'input-dashboard-region-' . $region,
]);

// sortable widget to enable drag-and-drop
echo Sortable::widget([
'id' => 'dashboard-region-' . $region,
'connected' => true,
Expand All @@ -37,6 +36,13 @@
'sortupdate' => 'dashboardPanelSort',
],
]);

// hidden element to store the sort order
echo Html::hiddenInput('DashboardPanelSort[' . $region . ']', implode(',', ArrayHelper::map($items, 'options.id', 'options.id')), [
'id' => 'input-dashboard-region-' . $region,
]);

// create dashboard panel button
echo '<div class="text-center">';
echo Html::a(Yii::t('dashboard', 'Create Dashboard Panel'), [
'dashboard-panel/create',
Expand All @@ -48,6 +54,7 @@
]
], ['class' => 'btn btn-default btn-sm']);
echo '</div>';

echo '</div>';
}
echo '</div>';
Expand Down

0 comments on commit a7ca997

Please sign in to comment.