diff --git a/app/routes/dashboard.php b/app/routes/dashboard.php index 449730fe..2adb886e 100644 --- a/app/routes/dashboard.php +++ b/app/routes/dashboard.php @@ -17,6 +17,8 @@ Route::group(['before' => 'auth', 'prefix' => 'dashboard', 'namespace' => 'Cache Route::get('incidents/add', ['as' => 'dashboard.incidents.add', 'uses' => 'DashIncidentController@showAddIncident']); Route::post('incidents/add', 'DashIncidentController@createIncidentAction'); Route::get('incidents/{incident}/delete', 'DashIncidentController@deleteIncidentAction'); + Route::get('incidents/{incident}/edit', 'DashIncidentController@showEditIncidentAction'); + Route::post('incidents/{incident}/edit', 'DashIncidentController@editIncidentAction'); Route::get('incidents/template', ['as' => 'dashboard.incidents.template', 'uses' => 'DashIncidentController@showAddIncidentTemplate']); Route::post('incidents/template', 'DashIncidentController@createIncidentTemplateAction'); diff --git a/app/views/dashboard/incidents/edit.blade.php b/app/views/dashboard/incidents/edit.blade.php new file mode 100644 index 00000000..9d28b1af --- /dev/null +++ b/app/views/dashboard/incidents/edit.blade.php @@ -0,0 +1,57 @@ +@extends('layout.dashboard') + +@section('content') +
+ + {{ trans('cachet.dashboard.incident-add') }} + + > Edit an Incident +
+
+
+
+ {{ Form::open(['name' => 'IncidentForm', 'class' => 'form-vertical', 'role' => 'form']) }} +
+
+ + name}} /> +
+
+
+ + + + +
+
+ + + You may also use Markdown. +
+
+ + + id}} /> + + Cancel + {{ Form::close() }} +
+
+
+@stop diff --git a/app/views/dashboard/incidents/index.blade.php b/app/views/dashboard/incidents/index.blade.php index d90f667e..5d33adfd 100644 --- a/app/views/dashboard/incidents/index.blade.php +++ b/app/views/dashboard/incidents/index.blade.php @@ -25,6 +25,7 @@ @endif
+ Edit Delete
diff --git a/src/Http/Controllers/DashIncidentController.php b/src/Http/Controllers/DashIncidentController.php index 88579907..0f4dea08 100644 --- a/src/Http/Controllers/DashIncidentController.php +++ b/src/Http/Controllers/DashIncidentController.php @@ -89,4 +89,34 @@ class DashIncidentController extends Controller return Redirect::back(); } + + /** + * Shows the edit incident view. + * + * @param \CachetHQ\Cachet\Models\Incident $incident + * + * @return \Illuminate\View\View + */ + public function showEditIncidentAction(Incident $incident) + { + return View::make('dashboard.incidents.edit')->with([ + 'pageTitle' => 'Edit Incident - Dashboard', + 'incident' => $incident + ]); + } + + /** + * Edit an incident. + * + * @param \CachetHQ\Cachet\Models\Incident $incident + * + * @return \Illuminate\Http\RedirectResponse + */ + public function editIncidentAction(Incident $incident) + { + $_incident = Binput::get('incident'); + $incident->update($_incident); + + return Redirect::to('dashboard/incidents'); + } }