public function register() { Menu::macro('back', function () { return Menu::new()->setActiveClass('-active')->setActiveFromRequest('/blender'); }); Menu::macro('moduleGroup', function ($title) { return Menu::back()->addParentClass('menu__group')->setParentAttribute('data-menu-group', fragment("back.nav.{$title}"))->registerFilter(function (Link $link) { $link->addParentClass('menu__group__item'); }); }); Menu::macro('module', function (string $action, string $name) { return $this->action("Back\\{$action}", fragment("back.{$name}")); }); Menu::macro('backMain', function () { return Menu::back()->addClass('menu__groups')->setAttribute('data-menu-groups')->add(Menu::moduleGroup('content')->module('ArticlesController@index', 'articles.title')->module('NewsController@index', 'news.title')->module('PeopleController@index', 'people.title'))->add(Menu::moduleGroup('modules')->module('FragmentsController@index', 'fragments.title')->module('FormResponsesController@showDownloadButton', 'formResponses.title')->module('TagsController@index', 'tags.title'))->add(Menu::moduleGroup('users')->module('MembersController@index', 'members.title')->module('AdministratorsController@index', 'administrators.title'))->add(Menu::moduleGroup('system')->module('ActivitylogController@index', 'log.title')->module('RedirectsController@index', 'redirects.title')->module('StatisticsController@index', 'statistics.menuTitle')); }); Menu::macro('backUser', function () { $avatar = Html::avatar(current_user(), '-small') . el('span.:response-desktop-only', current_user()->email); return Menu::new()->action('Back\\AdministratorsController@edit', $avatar, [current_user()->id])->html(view('back.auth._partials.logoutForm')); }); Menu::macro('breadcrumbs', function (array $breadcrumbs) { return Menu::build($breadcrumbs, function (Menu $menu, $actionWithParameters, $label) { if (!is_array($actionWithParameters)) { $actionWithParameters = [$actionWithParameters]; } $action = array_shift($actionWithParameters); return $menu->action($action, $label, $actionWithParameters); })->addClass('breadcrumb')->setActiveFromRequest('/blender'); }); }
protected function getEventDescriptionFor(string $event, User $user) : string { $name = sprintf('<a href="%s">%s</a>', action('Back\\MembersController@edit', [$user->id]), $user->email); if ($event === 'deleted') { $name = $user->email; } return trans("back.events.{$event}", ['model' => fragment('back.members.member'), 'name' => $name]); }
public function handleResponse(FormResponseRequest $request) { $formResponse = FormResponse::create($request->except(['g-recaptcha-response'])); Mail::send(new ContactFormSubmitted($formResponse)); activity()->log("{$formResponse->email} vulde het contactformulier in"); flash()->success(fragment('contact.response')); return redirect()->action('Front\\ContactController@index'); }
/** * @param \App\Http\Requests\Front\FormResponseRequest $request * * @return \Illuminate\Http\RedirectResponse */ public function handleResponse(FormResponseRequest $request) { $formResponse = FormResponse::create($request->all()); event(new ContactFormSubmitted($formResponse)); Activity::log($request->get('email') . ' vulde het contactformulier in'); flash()->success(fragment('contact.response')); return redirect()->action('Front\\ContactController@index'); }
/** * Log the user out of the application. * * @param Request $request * * @return \Illuminate\Http\Response */ public function logout(Request $request) { $this->guard()->logout(); $request->session()->flush(); $request->session()->regenerate(); $frontLink = '<a href="/">' . fragment('back.auth.frontLink') . '</a>'; flash()->info(trans('auth.loggedOut') . ' ' . $frontLink); return redirect(login_url()); }
public function getLastActivityDateAttribute() : string { if ($this->last_activity === null || $this->last_activity->year == -1) { return fragment('back.frontUsers.neverLoggedIn'); } $lastActivityDate = diff_date_for_humans($this->last_activity); if (str_contains($lastActivityDate, 'second')) { $lastActivityDate = fragment('back.frontUsers.justNow'); } return $lastActivityDate; }
function index() { $this->data['users'] = User::all(); $this->fragment['users'] = fragment('users/index', $this); haml_layout('haml-layout', $this); //layout('layout', $this); //param1 = Путь к файлам //param2 = Путь к скомпилированным шаблонам //param3 = Родительский парсер //$parser = new HamlParser(VIEW_PATH.'users'); //echo $parser->setFile('haml-test.haml'); }
/** * @param \App\Http\Requests\Front\NewsletterSubscriptionRequest $request * * @return \Illuminate\Http\JsonResponse */ public function subscribe(NewsletterSubscriptionRequest $request) { $email = strtolower($request->get('email')); if (Newsletter::hasMember($email)) { return $this->respond(['message' => fragment('newsletter.subscription.result.alreadySubscribed'), 'type' => 'info']); } $result = Newsletter::subscribe($email); if (!$result) { return $this->respondWithBadRequest(['message' => fragment('newsletter.subscription.result.error'), 'type' => 'error']); } activity()->log("{$email} schreef zich in op de nieuwsbrief"); return $this->respond(['message' => fragment('newsletter.subscription.result.ok'), 'type' => 'success']); }
public function update($id, FragmentRequest $request) { $fragment = Fragment::find($id); foreach (locales() as $locale) { $requestAttribute = "translated_{$locale}_text"; $fragment->setTranslation($locale, $request->get($requestAttribute)); } $fragment->save(); app('cache')->flush(); $eventDescription = fragment('back.events.updated', ['model' => 'Fragment', 'name' => $fragment->name]); flash()->success(strip_tags($eventDescription)); return redirect()->action('Back\\FragmentsController@index'); }
/** * @param \App\Http\Requests\Front\NewsletterSubscriptionRequest $request * * @return \Illuminate\Http\JsonResponse */ public function subscribe(NewsletterSubscriptionRequest $request) { try { $this->newsletter->subscribe($request->get('email')); Activity::log($request->get('email') . ' schreef zich in op de nieuwsbrief.'); } catch (AlreadySubscribed $exception) { return $this->respond(['message' => fragment('newsletter.subscription.result.alreadySubscribed'), 'type' => 'info']); } catch (ServiceRefusedSubscription $exception) { return $this->respondWithBadRequest(['message' => fragment('newsletter.subscription.result.error'), 'type' => 'error']); } catch (Exception $e) { Log::error('newsletter subscription failed with exception message: ' . $e->getMessage()); return $this->respondWithInternalServerError(['message' => fragment('newsletter.subscription.result.error'), 'type' => 'error']); } return $this->respond(['message' => fragment('newsletter.subscription.result.ok'), 'type' => 'success']); }
function fragment_slug($name, array $replacements = []) : string { $translation = fragment($name, $replacements); return str_slug($translation); }
/** * Get a translated fragment slug. * * @param string $name * @param string $locale * * @return string */ function fragment_slug($name, $locale = null) { $translation = fragment($name, $locale); return str_slug($translation); }
public function submit() : string { return el('div.form__group.-buttons', Form::submit(fragment("back.{$this->module}.save"), ['class' => 'button -default'])); }
public function backToIndex(string $action, array $parameters = []) : string { return el('a.breadcrumb--back', ['href' => action($action, $parameters)], fragment('back.backToIndex')); }