Skip to content

Commit

Permalink
Merge pull request #508 from nextcloud/enh/use-webpack-global-config
Browse files Browse the repository at this point in the history
  • Loading branch information
skjnldsv authored Jul 14, 2020
2 parents 017c0dd + c7e5d0e commit 769e863
Show file tree
Hide file tree
Showing 11 changed files with 179 additions and 279 deletions.
8 changes: 4 additions & 4 deletions appinfo/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@
['name' => 'page#index', 'url' => '/', 'verb' => 'GET'],

// Before /{hash} to avoid conflict
['name' => 'page#createForm', 'url' => '/new', 'verb' => 'GET'],
['name' => 'page#editForm', 'url' => '/{hash}/edit', 'verb' => 'GET'],
['name' => 'page#cloneForm', 'url' => '/{hash}/clone', 'verb' => 'GET'],
['name' => 'page#getResult', 'url' => '/{hash}/results', 'verb' => 'GET'],
['name' => 'page#index', 'url' => '/new', 'verb' => 'GET', 'postfix' => 'create'],
['name' => 'page#index', 'url' => '/{hash}/edit', 'verb' => 'GET', 'postfix' => 'edit'],
['name' => 'page#index', 'url' => '/{hash}/clone', 'verb' => 'GET', 'postfix' => 'clone'],
['name' => 'page#index', 'url' => '/{hash}/results', 'verb' => 'GET', 'postfix' => 'results'],

['name' => 'page#goto_form', 'url' => '/{hash}', 'verb' => 'GET'],

Expand Down
58 changes: 2 additions & 56 deletions lib/Controller/PageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,61 +126,7 @@ public function __construct(string $appName,
* @return TemplateResponse
*/
public function index(): TemplateResponse {
Util::addScript($this->appName, 'forms');
Util::addStyle($this->appName, 'forms');
$this->initialStateService->provideInitialState($this->appName, 'maxStringLengths', $this->maxStringLengths);
return new TemplateResponse($this->appName, self::TEMPLATE_MAIN);
}

/**
* @NoAdminRequired
* @NoCSRFRequired
*
* @return TemplateResponse
*/
public function createForm(): TemplateResponse {
Util::addScript($this->appName, 'forms');
Util::addStyle($this->appName, 'forms');
$this->initialStateService->provideInitialState($this->appName, 'maxStringLengths', $this->maxStringLengths);
return new TemplateResponse($this->appName, self::TEMPLATE_MAIN);
}

/**
* @NoAdminRequired
* @NoCSRFRequired
*
* TODO: Implement cloning
*
* @return TemplateResponse
*/
public function cloneForm(): TemplateResponse {
Util::addScript($this->appName, 'forms');
Util::addStyle($this->appName, 'forms');
$this->initialStateService->provideInitialState($this->appName, 'maxStringLengths', $this->maxStringLengths);
return new TemplateResponse($this->appName, self::TEMPLATE_MAIN);
}

/**
* @NoAdminRequired
* @NoCSRFRequired
*
* @return TemplateResponse
*/
public function editForm(): TemplateResponse {
Util::addScript($this->appName, 'forms');
Util::addStyle($this->appName, 'forms');
$this->initialStateService->provideInitialState($this->appName, 'maxStringLengths', $this->maxStringLengths);
return new TemplateResponse($this->appName, self::TEMPLATE_MAIN);
}

/**
* @NoAdminRequired
* @NoCSRFRequired
*
* @return TemplateResponse
*/
public function getResult(): TemplateResponse {
Util::addScript($this->appName, 'forms');
Util::addScript($this->appName, 'forms-main');
Util::addStyle($this->appName, 'forms');
$this->initialStateService->provideInitialState($this->appName, 'maxStringLengths', $this->maxStringLengths);
return new TemplateResponse($this->appName, self::TEMPLATE_MAIN);
Expand Down Expand Up @@ -219,7 +165,7 @@ public function gotoForm($hash): ?TemplateResponse {
}

// Main Template to fill the form
Util::addScript($this->appName, 'submit');
Util::addScript($this->appName, 'forms-submit');
$this->initialStateService->provideInitialState($this->appName, 'form', $this->formsService->getPublicForm($form->getId()));
$this->initialStateService->provideInitialState($this->appName, 'maxStringLengths', $this->maxStringLengths);
return $this->provideTemplate(self::TEMPLATE_MAIN, $form);
Expand Down
Loading

0 comments on commit 769e863

Please sign in to comment.