Example #1
0
 /**
  * Bind data to the view.
  *
  * @param \Illuminate\Contracts\View\View $view
  *
  * @return void
  */
 public function compose(View $view)
 {
     $view->withIncidentCount(Incident::notScheduled()->count());
     $view->withIncidentTemplateCount(IncidentTemplate::count());
     $view->withComponentCount(Component::all()->count());
     $view->withSubscriberCount(Subscriber::isVerified()->count());
 }
Example #2
0
 /**
  * Returns a template by slug.
  *
  * @throws \Illuminate\Database\Eloquent\ModelNotFoundException
  *
  * @return \CachetHQ\Cachet\Models\IncidentTemplate
  */
 public function getIncidentTemplate()
 {
     $templateSlug = Binput::get('slug');
     if ($template = IncidentTemplate::where('slug', $templateSlug)->first()) {
         return $template;
     }
     throw new ModelNotFoundException("Incident template for {$templateSlug} could not be found.");
 }
Example #3
0
 /**
  * Edit an incident template.
  *
  * @param \CachetHQ\Cachet\Models\IncidentTemplate $template
  *
  * @return \Illuminate\Http\RedirectResponse
  */
 public function editTemplateAction(IncidentTemplate $template)
 {
     try {
         $template->update(Binput::get('template'));
     } catch (ValidationException $e) {
         return Redirect::route('dashboard.templates.edit', ['id' => $template->id])->withUpdatedTemplate($template)->withTemplateErrors($e->getMessageBag()->getErrors());
     }
     return Redirect::route('dashboard.templates.edit', ['id' => $template->id])->withUpdatedTemplate($template);
 }
 /**
  * Compiles an incident template into an incident message.
  *
  * @param string $templateSlug
  * @param array  $vars
  *
  * @return string
  */
 protected function parseIncidentTemplate($templateSlug, $vars)
 {
     Twig::setLoader(new Twig_Loader_String());
     $template = IncidentTemplate::forSlug($templateSlug)->first();
     return Twig::render($template->template, $vars);
 }
Example #5
0
 /**
  * Shows the edit schedule maintenance form.
  *
  * @param \CachetHQ\Cachet\Models\Incident $schedule
  *
  * @return \Illuminate\View\View
  */
 public function showEditSchedule(Incident $schedule)
 {
     $incidentTemplates = IncidentTemplate::all();
     return View::make('dashboard.schedule.edit')->withPageTitle(trans('dashboard.schedule.edit.title') . ' - ' . trans('dashboard.dashboard'))->withIncidentTemplates($incidentTemplates)->withSchedule($schedule);
 }
Example #6
0
 /**
  * Shows the edit schedule maintenance form.
  *
  * @param \CachetHQ\Cachet\Models\Incident $schedule
  *
  * @return \Illuminate\View\View
  */
 public function showEditSchedule(Incident $schedule)
 {
     $incidentTemplates = IncidentTemplate::all();
     return View::make('dashboard.schedule.edit')->withIncidentTemplates($incidentTemplates)->withSchedule($schedule);
 }
Example #7
0
 /**
  * Edit an incident template.
  *
  * @param \CachetHQ\Cachet\Models\IncidentTemplate $template
  *
  * @return \Illuminate\Http\RedirectResponse
  */
 public function editTemplateAction(IncidentTemplate $template)
 {
     try {
         $template->update(Binput::get('template'));
     } catch (ValidationException $e) {
         return Redirect::back()->withUpdatedTemplate($template)->withTemplateErrors($e->getMessageBag()->getErrors());
     }
     return Redirect::back()->withUpdatedTemplate($template);
 }
Example #8
0
 /**
  * Shows the edit schedule maintenance form.
  *
  * @param \CachetHQ\Cachet\Models\Incident $schedule
  *
  * @return \Illuminate\View\View
  */
 public function showEditSchedule(Incident $schedule)
 {
     $incidentTemplates = IncidentTemplate::all();
     return View::make('dashboard.schedule.edit')->with(['incidentTemplates' => $incidentTemplates, 'schedule' => $schedule]);
 }
Example #9
0
 /**
  * Seed the incident templates table.
  *
  * @return void
  */
 protected function seedIncidentTemplates()
 {
     IncidentTemplate::truncate();
 }
 /**
  * Edit an incident template.
  *
  * @param \CachetHQ\Cachet\Models\IncidentTemplate $template
  *
  * @return \Illuminate\Http\RedirectResponse
  */
 public function editTemplateAction(IncidentTemplate $template)
 {
     segment_track('Dashboard', ['event' => 'Edited Incident Template']);
     $template->update(Binput::get('template'));
     return Redirect::back()->with('updatedTemplate', $template);
 }
 /**
  * Creates a new incident template.
  *
  * @return \Illuminate\Http\RedirectResponse
  */
 public function createIncidentTemplateAction()
 {
     $_template = Binput::get('template');
     $template = IncidentTemplate::create($_template);
     return Redirect::back()->with('template', $template);
 }
 /**
  * Compiles an incident template into an incident message.
  *
  * @param string $templateSlug
  * @param array  $vars
  *
  * @return string
  */
 protected function parseIncidentTemplate($templateSlug, $vars)
 {
     if ($vars === null) {
         $vars = [];
     }
     $this->twig->setLoader(new Twig_Loader_String());
     $template = IncidentTemplate::forSlug($templateSlug)->first();
     return $this->twig->render($template->template, $vars);
 }
Example #13
0
 /**
  * Edit an incident template.
  *
  * @param \CachetHQ\Cachet\Models\IncidentTemplate $template
  *
  * @return \Illuminate\Http\RedirectResponse
  */
 public function editTemplateAction(IncidentTemplate $template)
 {
     $template->update(Binput::get('template'));
     return Redirect::back()->with('updatedTemplate', $template);
 }