diff --git a/app/controllers/DashboardController.php b/app/controllers/DashboardController.php index 24718312..dfeb0a08 100644 --- a/app/controllers/DashboardController.php +++ b/app/controllers/DashboardController.php @@ -9,17 +9,6 @@ class DashboardController extends Controller { return View::make('dashboard.index'); } - /** - * Creates a new incident. - * @return \Illuminate\Http\RedirectResponse - */ - public function createIncidentAction() { - $_incident = Input::get('incident'); - $incident = Incident::create($_incident); - - return Redirect::back()->with('incident', $incident); - } - /** * Shows the components view. * @return \Illuminate\View\View @@ -77,6 +66,27 @@ class DashboardController extends Controller { ]); } + /** + * Shows the add incident view. + * @return \Illuminate\View\View + */ + public function showAddIncident() { + return View::make('dashboard.incident-add')->with([ + 'pageTitle' => 'Add Incident - Dashboard', + ]); + } + + /** + * Creates a new incident. + * @return \Illuminate\Http\RedirectResponse + */ + public function createIncidentAction() { + $_incident = Input::get('incident'); + $incident = Incident::create($_incident); + + return Redirect::back()->with('incident', $incident); + } + /** * Shows the metrics view. * @return \Illuminate\View\View diff --git a/app/lang/en/cachet.php b/app/lang/en/cachet.php index 86184dd1..ff307bf1 100644 --- a/app/lang/en/cachet.php +++ b/app/lang/en/cachet.php @@ -34,6 +34,7 @@ return array( 'components' => 'Components', 'component-add' => 'Add Component', 'incidents' => 'Incidents', + 'incident-add' => 'Add Incident', 'metrics' => 'Metrics', 'status_page' => 'Status Page', 'settings' => 'Settings', diff --git a/app/routes/dashboard.php b/app/routes/dashboard.php index 2aab7ade..5ebf5a48 100644 --- a/app/routes/dashboard.php +++ b/app/routes/dashboard.php @@ -2,7 +2,6 @@ Route::group(['before' => 'auth', 'prefix' => 'dashboard'], function() { Route::get('/', ['as' => 'dashboard', 'uses' => 'DashboardController@showDashboard']); - Route::post('/', 'DashboardController@createIncidentAction'); // TODO: Switch for Route::controller? Route::get('components', ['as' => 'dashboard.components', 'uses' => 'DashboardController@showComponents']); @@ -11,6 +10,9 @@ Route::group(['before' => 'auth', 'prefix' => 'dashboard'], function() { Route::get('components/{component}/delete', 'DashboardController@deleteComponentAction'); Route::get('incidents', ['as' => 'dashboard.incidents', 'uses' => 'DashboardController@showIncidents']); + Route::get('incidents/add', ['as' => 'dashboard.incidents.add', 'uses' => 'DashboardController@showAddIncident']); + Route::post('incidents/add', 'DashboardController@createIncidentAction'); + Route::get('metrics', ['as' => 'dashboard.metrics', 'uses' => 'DashboardController@showMetrics']); Route::get('notifications', ['as' => 'dashboard.notifications', 'uses' => 'DashboardController@showNotifications']); Route::get('status-page', ['as' => 'dashboard.status-page', 'uses' => 'DashboardController@showStatusPage']); diff --git a/app/views/dashboard/incident-add.blade.php b/app/views/dashboard/incident-add.blade.php new file mode 100644 index 00000000..7f09b33a --- /dev/null +++ b/app/views/dashboard/incident-add.blade.php @@ -0,0 +1,53 @@ +@extends('layout.dashboard') + +@section('content') +
Let's put cool things here.