Ejemplo n.º 1
0
 /**
  * Displays details of a page
  *
  * @return Response
  */
 public function show()
 {
     // what does it mean to be in editing mode? right now it is just when you are logged in
     $editing = !is_null(\Auth::user());
     //&& Input::get('editing', false);
     $pageVersionHash = $this->Input->get('page_version_share', null);
     $pageVersionName = $this->Input->get('page_version', null);
     $page = $pageVersionHash ? $this->PagesRepository->findByRouteNameAndPreviewHash($this->Route->currentRouteName(), $pageVersionHash) : $this->PagesRepository->findByRouteName($this->Route->currentRouteName(), $pageVersionName, $editing);
     $localized = $this->PagesRepository->findLocalizedPage($page);
     return $localized ? $this->Redirect->route($localized->route_name) : $this->retrieveResponse($page);
 }
Ejemplo n.º 2
0
 /**
  * Displays details of a page
  *
  * @return Response
  */
 public function show()
 {
     // what does it mean to be in editing mode? right now it is just when you are logged in
     $editing = \DeviseUser::checkConditions('canUseDeviseEditor');
     //&& Input::get('editing', false);
     $pageVersionHash = $this->Input->get('page_version_share', null);
     $pageVersionName = $this->Input->get('page_version', null);
     $page = $pageVersionHash ? $this->PagesRepository->findByRouteNameAndPreviewHash($this->Route->currentRouteName(), $pageVersionHash) : $this->PagesRepository->findByRouteName($this->Route->currentRouteName(), $pageVersionName, $editing);
     $localized = $this->PagesRepository->findLocalizedPage($page);
     return $localized ? $this->retrieveLocalRedirect($localized) : $this->retrieveResponse($page);
 }
Ejemplo n.º 3
0
 /**
  * Creates a json object that we use for editing a
  * devise page
  *
  * @return string
  */
 public function toJSON()
 {
     // Occurs when there are no data-devise tags on the page
     if (!$this->initialized) {
         $data = new \StdClass();
         $data->database = new \StdClass();
         $data->nodes = [];
         $data->csrfToken = $this->csrfToken;
         return $this->jsonEncode($data);
     }
     $pageVersionId = $this->pageVersionId;
     $pageId = $this->pageId;
     $languageId = $this->languageId;
     $csrfToken = $this->csrfToken;
     $route = Route::getCurrentRoute();
     $params = $route ? $route->parameters() : [];
     $availableLanguages = $this->PagesRepository->availableLanguagesForPage($pageId, $params);
     $pageRoutes = $this->PagesRepository->getRouteList();
     $pageVersions = $this->PagesRepository->getPageVersions($pageId, $pageVersionId);
     $collections = $this->filterTags('collection');
     $fields = $this->filterTags('field');
     $models = $this->filterTags('model');
     $attributes = $this->filterTags('attribute');
     $creators = $this->filterTags('creator');
     $nodes = $this->buildNodes($collections, $fields, $models, $attributes, $creators);
     $database = $this->database;
     return $this->jsonEncode(compact('nodes', 'pageId', 'pageVersionId', 'languageId', 'csrfToken', 'availableLanguages', 'pageRoutes', 'pageVersions', 'database'));
 }
Ejemplo n.º 4
0
 /**
  * Request the page listing
  *
  * @return EloquentCollection
  */
 public function requestPageList($input)
 {
     $term = array_get($input, 'term');
     $includeAdmin = array_get($input, 'includeAdmin') == '1' ? true : false;
     return $this->PagesRepository->getPagesList($includeAdmin, $term);
 }