Merge pull request #191 from cachethq/component-reordering

Components can now be re-ordered, closes #165
This commit is contained in:
James Brooks
2015-01-01 13:43:40 +00:00
17 changed files with 35880 additions and 44 deletions
+20
View File
@@ -19,4 +19,24 @@ class DashAPIController extends Controller
App::abort(500);
}
}
/**
* Updates a components ordering.
*
* @return array
*/
public function postUpdateComponentOrder()
{
$componentData = Input::all();
unset($componentData['component'][0]); // Remove random 0 index.
foreach ($componentData['component'] as $componentId => $order) {
$component = Component::find($componentId);
$component->update([
'order' => $order,
]);
}
return $componentData;
}
}
+1 -1
View File
@@ -9,7 +9,7 @@ class DashComponentController extends Controller
*/
public function showComponents()
{
$components = Component::all();
$components = Component::orderBy('order')->orderBy('created_at')->get();
return View::make('dashboard.components.index')->with([
'pageTitle' => 'Components - Dashboard',
+3 -1
View File
@@ -28,8 +28,10 @@ class HomeController extends Controller
*/
public function showIndex()
{
$components = Component::orderBy('order')->orderBy('created_at')->get();
return View::make('index', [
'components' => $this->component->all(),
'components' => $components,
'pageTitle' => Setting::get('app_name')
]);
}