This commit is contained in:
Graham Campbell
2014-12-20 21:20:17 +00:00
parent 26e4361d8a
commit 9d8d89248f
103 changed files with 2478 additions and 2353 deletions
+9 -4
View File
@@ -3,12 +3,14 @@
/**
* Logs users into their account
*/
class AuthController extends Controller {
class AuthController extends Controller
{
/**
* Shows the login view.
* @return \Illuminate\View\View
*/
public function showLogin() {
public function showLogin()
{
return View::make('auth.login');
}
@@ -16,7 +18,8 @@ class AuthController extends Controller {
* Logs the user in.
* @return \Illuminate\Http\RedirectResponse
*/
public function postLogin() {
public function postLogin()
{
if (Auth::attempt(Input::only(['email', 'password']))) {
return Redirect::intended('dashboard');
} else {
@@ -30,8 +33,10 @@ class AuthController extends Controller {
* Logs the user out, deleting their session etc.
* @return \Illuminate\Http\RedirectResponse
*/
public function logoutAction() {
public function logoutAction()
{
Auth::logout();
return Redirect::to('/');
}
}
+66 -59
View File
@@ -1,71 +1,78 @@
<?php
class DashComponentController extends Controller {
/**
* Shows the components view.
* @return \Illuminate\View\View
*/
public function showComponents() {
$components = Component::all();
class DashComponentController extends Controller
{
/**
* Shows the components view.
* @return \Illuminate\View\View
*/
public function showComponents()
{
$components = Component::all();
return View::make('dashboard.components')->with([
'pageTitle' => 'Components - Dashboard',
'components' => $components
]);
}
return View::make('dashboard.components')->with([
'pageTitle' => 'Components - Dashboard',
'components' => $components,
]);
}
/**
* Shows the edit component view.
* @param Component $component
* @return \Illuminate\View\View
*/
public function showEditComponent(Component $component) {
/**
* Shows the edit component view.
* @param Component $component
* @return \Illuminate\View\View
*/
public function showEditComponent(Component $component)
{
return View::make('dashboard.component-edit')->with([
'pageTitle' => 'Editing "'.$component->name.'" Component - Dashboard',
'component' => $component,
]);
}
return View::make('dashboard.component-edit')->with([
'pageTitle' => 'Editing "' . $component->name . '" Component - Dashboard',
'component' => $component
]);
}
/**
* Updates a component.
* @return \Illuminate\Http\RedirectResponse
*/
public function updateComponentAction(Component $component)
{
$_component = Input::get('component');
$component->update($_component);
/**
* Updates a component.
* @return \Illuminate\Http\RedirectResponse
*/
public function updateComponentAction(Component $component) {
$_component = Input::get('component');
$component->update($_component);
return Redirect::back()->with('savedComponent', $component);
}
return Redirect::back()->with('savedComponent', $component);
}
/**
* Shows the add component view.
* @return \Illuminate\View\View
*/
public function showAddComponent()
{
return View::make('dashboard.component-add')->with([
'pageTitle' => 'Add Component - Dashboard',
]);
}
/**
* Shows the add component view.
* @return \Illuminate\View\View
*/
public function showAddComponent() {
return View::make('dashboard.component-add')->with([
'pageTitle' => 'Add Component - Dashboard',
]);
}
/**
* Creates a new component.
* @return \Illuminate\Http\RedirectResponse
*/
public function createComponentAction()
{
$_component = Input::get('component');
$component = Component::create($_component);
/**
* Creates a new component.
* @return \Illuminate\Http\RedirectResponse
*/
public function createComponentAction() {
$_component = Input::get('component');
$component = Component::create($_component);
return Redirect::back()->with('component', $component);
}
return Redirect::back()->with('component', $component);
}
/**
* Deletes a given component.
* @param Component $component
* @return \Illuminate\Http\RedirectResponse
*/
public function deleteComponentAction(Component $component)
{
$component->delete();
/**
* Deletes a given component.
* @param Component $component
* @return \Illuminate\Http\RedirectResponse
*/
public function deleteComponentAction(Component $component) {
$component->delete();
return Redirect::back();
}
return Redirect::back();
}
}
+54 -48
View File
@@ -1,58 +1,64 @@
<?php
class DashIncidentController extends Controller {
/**
* Shows the incidents view.
* @return \Illuminate\View\View
*/
public function showIncidents() {
$incidents = Incident::all();
class DashIncidentController extends Controller
{
/**
* Shows the incidents view.
* @return \Illuminate\View\View
*/
public function showIncidents()
{
$incidents = Incident::all();
return View::make('dashboard.incidents')->with([
'pageTitle' => 'Incidents - Dashboard',
'incidents' => $incidents
]);
}
return View::make('dashboard.incidents')->with([
'pageTitle' => 'Incidents - Dashboard',
'incidents' => $incidents,
]);
}
/**
* Shows the add incident view.
* @return \Illuminate\View\View
*/
public function showAddIncident() {
return View::make('dashboard.incident-add')->with([
'pageTitle' => 'Add Incident - Dashboard',
]);
}
/**
* Shows the add incident view.
* @return \Illuminate\View\View
*/
public function showAddIncident()
{
return View::make('dashboard.incident-add')->with([
'pageTitle' => 'Add Incident - Dashboard',
]);
}
/**
* Shows the add incident template view.
* @return \Illuminate\View\View
*/
public function showAddIncidentTemplate() {
return View::make('dashboard.incident-template')->with([
'pageTitle' => 'Add Incident Template - Dashboard',
]);
}
/**
* Shows the add incident template view.
* @return \Illuminate\View\View
*/
public function showAddIncidentTemplate()
{
return View::make('dashboard.incident-template')->with([
'pageTitle' => 'Add Incident Template - Dashboard',
]);
}
/**
* Creates a new incident template.
* @return \Illuminate\Http\RedirectResponse
*/
public function createIncidentTemplateAction() {
$_template = Input::get('template');
$template = IncidentTemplate::create($_template);
/**
* Creates a new incident template.
* @return \Illuminate\Http\RedirectResponse
*/
public function createIncidentTemplateAction()
{
$_template = Input::get('template');
$template = IncidentTemplate::create($_template);
return Redirect::back()->with('template', $template);
}
return Redirect::back()->with('template', $template);
}
/**
* Creates a new incident.
* @return \Illuminate\Http\RedirectResponse
*/
public function createIncidentAction() {
$_incident = Input::get('incident');
$incident = Incident::create($_incident);
/**
* 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);
}
return Redirect::back()->with('incident', $incident);
}
}
+36 -33
View File
@@ -1,40 +1,43 @@
<?php
<?php
class DashSettingsController extends Controller {
/**
* Shows the settings view.
* @return \Illuminate\View\View
*/
public function showSettings() {
return View::make('dashboard.settings')->with([
'pageTitle' => 'Settings - Dashboard'
]);
}
class DashSettingsController extends Controller
{
/**
* Shows the settings view.
* @return \Illuminate\View\View
*/
public function showSettings()
{
return View::make('dashboard.settings')->with([
'pageTitle' => 'Settings - Dashboard',
]);
}
/**
* Updates the statsu page settings.
* @return \Illuminate\View\View
*/
public function postSettings() {
$settings = Input::all();
/**
* Updates the statsu page settings.
* @return \Illuminate\View\View
*/
public function postSettings()
{
$settings = Input::all();
foreach ($settings as $settingName => $settingValue) {
// Don't save empty settings. Kinda useless...
if (!$settingValue) {
continue;
}
foreach ($settings as $settingName => $settingValue) {
// Don't save empty settings. Kinda useless...
if (!$settingValue) {
continue;
}
if (strstr($settingName, 'style_')) {
$settingValue = str_replace('#', '', $settingValue);
}
if (strstr($settingName, 'style_')) {
$settingValue = str_replace('#', '', $settingValue);
}
$setting = Setting::firstOrCreate([
'name' => $settingName,
])->update([
'value' => $settingValue
]);
}
$setting = Setting::firstOrCreate([
'name' => $settingName,
])->update([
'value' => $settingValue,
]);
}
return Redirect::back();
}
return Redirect::back();
}
}
+10 -6
View File
@@ -1,11 +1,13 @@
<?php
class DashboardController extends Controller {
class DashboardController extends Controller
{
/**
* Shows the dashboard view.
* @return \Illuminate\View\View
*/
public function showDashboard() {
public function showDashboard()
{
return View::make('dashboard.index');
}
@@ -13,9 +15,10 @@ class DashboardController extends Controller {
* Shows the metrics view.
* @return \Illuminate\View\View
*/
public function showMetrics() {
public function showMetrics()
{
return View::make('dashboard.metrics')->with([
'pageTitle' => 'Metrics - Dashboard'
'pageTitle' => 'Metrics - Dashboard',
]);
}
@@ -23,9 +26,10 @@ class DashboardController extends Controller {
* Shows the notifications view.
* @return \Illuminate\View\View
*/
public function showNotifications() {
public function showNotifications()
{
return View::make('dashboard.notifications')->with([
'pageTitle' => 'Notifications - Dashboard'
'pageTitle' => 'Notifications - Dashboard',
]);
}
}
+6 -3
View File
@@ -1,12 +1,14 @@
<?php
class HomeController extends Controller {
class HomeController extends Controller
{
/**
* @var Component $component
*/
protected $component;
public function __construct(Component $component) {
public function __construct(Component $component)
{
$this->component = $component;
}
@@ -14,7 +16,8 @@ class HomeController extends Controller {
* Returns the rendered Blade templates.
* @return \Illuminate\View\View
*/
public function showIndex() {
public function showIndex()
{
return View::make('index', ['components' => $this->component->all()]);
}
}
+6 -4
View File
@@ -1,11 +1,13 @@
<?php
class RSSController extends Controller {
class RSSController extends Controller
{
/**
* Generates an RSS feed of all incidents.
* @return \Illuminate\Http\Response
*/
public function feedAction() {
public function feedAction()
{
$feed = RSS::feed('2.0', 'UTF-8');
$feed->channel([
'title' => Setting::get('app_name'),
@@ -13,7 +15,7 @@ class RSSController extends Controller {
'link' => Setting::get('app_domain'),
]);
Incident::get()->map(function($incident) use ($feed) {
Incident::get()->map(function ($incident) use ($feed) {
$componentName = null;
$component = $incident->component;
if ($component) {
@@ -26,7 +28,7 @@ class RSSController extends Controller {
'component' => $componentName,
'status' => $incident->humanStatus,
'created_at' => $incident->created_at,
'updated_at' => $incident->updated_at
'updated_at' => $incident->updated_at,
]);
});
+11 -7
View File
@@ -1,7 +1,9 @@
<?php
class SetupController extends Controller {
public function __construct() {
class SetupController extends Controller
{
public function __construct()
{
$this->beforeFilter('csrf', ['only' => ['postCachet']]);
}
@@ -9,9 +11,10 @@ class SetupController extends Controller {
* Returns the setup page.
* @return \Illuminate\View\View
*/
public function getIndex() {
public function getIndex()
{
return View::make('setup')->with([
'pageTitle' => 'Setup'
'pageTitle' => 'Setup',
]);
}
@@ -19,7 +22,8 @@ class SetupController extends Controller {
* Handles the actual app setup.
* @return \Illuminate\Http\RedirectResponse
*/
public function postIndex() {
public function postIndex()
{
$postData = Input::get();
$v = Validator::make($postData, [
@@ -38,7 +42,7 @@ class SetupController extends Controller {
// TODO: Do we want to just use Eloquent::unguard() here?
$user = User::create([
'username' => $userDetails['username'],
'email' => $userDetails['email'],
'email' => $userDetails['email'],
'password' => $userDetails['password'],
]);
@@ -47,7 +51,7 @@ class SetupController extends Controller {
$settings = array_get($postData, 'settings');
foreach ($settings as $settingName => $settingValue) {
$setting = new Setting;
$setting = new Setting();
$setting->name = $settingName;
$setting->value = $settingValue;
$setting->save();