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') +
+ {{ Lang::get('cachet.dashboard.incident-add') }} +
+
+
+

Create an Incident

+ + @if($incident = Session::get('incident')) +
+ @if($incident->isValid()) + Awesome. Incident added. + @else + Whoops. Something went wrong with the incident. + @endif +
+ @endif + + {{ Form::open(['name' => 'IncidentForm', 'class' => 'form-vertical', 'role' => 'form']) }} +
+
+ + +
+
+
+ + + + +
+
+ + +
+
+ + + + {{ Form::close() }} +
+
+@stop diff --git a/app/views/dashboard/index.blade.php b/app/views/dashboard/index.blade.php index 18f662fe..a3415c2d 100644 --- a/app/views/dashboard/index.blade.php +++ b/app/views/dashboard/index.blade.php @@ -6,48 +6,9 @@
-

Create an Incident

+

Dashboard

- @if($incident = Session::get('incident')) -
- @if($incident->isValid()) - Awesome. Incident added. - @else - Whoops. Something went wrong with the incident. - @endif -
- @endif - - {{ Form::open(['name' => 'IncidentForm', 'class' => 'form-vertical', 'role' => 'form']) }} -
-
- - -
-
-
- - - - -
-
- - -
-
- - - - {{ Form::close() }} +

Let's put cool things here.

@stop diff --git a/app/views/partials/dashboard/sidebar.blade.php b/app/views/partials/dashboard/sidebar.blade.php index 9f2b407f..fd3fc335 100644 --- a/app/views/partials/dashboard/sidebar.blade.php +++ b/app/views/partials/dashboard/sidebar.blade.php @@ -17,6 +17,16 @@ {{ Lang::get('cachet.dashboard.dashboard') }} +
  • + + {{ Lang::get('cachet.dashboard.incidents') }} + +
  • +
  • {{ Lang::get('cachet.dashboard.components') }} @@ -27,11 +37,6 @@ {{ Lang::get('cachet.dashboard.component-add') }}
  • -
  • - - {{ Lang::get('cachet.dashboard.incidents') }} - -
  • {{ Lang::get('cachet.dashboard.metrics') }}