Add title on public page
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
This commit is contained in:
parent
78b53cbb8e
commit
5b9f65f11b
|
@ -1,19 +0,0 @@
|
||||||
.flex-row {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
|
||||||
flex-grow: 1;
|
|
||||||
/* align-items: center; */
|
|
||||||
&.align-centered {
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.flex-column {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
flex-grow: 0;
|
|
||||||
flex-shrink: 0;
|
|
||||||
&.align-centered {
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,4 +1,26 @@
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (c) 2020 John Molakvoæ <skjnldsv@protonmail.com>
|
||||||
|
*
|
||||||
|
* @author John Molakvoæ <skjnldsv@protonmail.com>
|
||||||
|
*
|
||||||
|
* @license GNU AGPL version 3 or any later version
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as
|
||||||
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
// Icon definitions
|
// Icon definitions
|
||||||
@include icon-black-white('forms', 'forms', 3);
|
@include icon-black-white('forms', 'forms', 3);
|
||||||
@include icon-black-white('clone', 'forms', 1);
|
@include icon-black-white('clone', 'forms', 1);
|
||||||
|
|
|
@ -1,46 +0,0 @@
|
||||||
h1 {
|
|
||||||
font-size: 1.8em;
|
|
||||||
margin-bottom: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.icon-forms {
|
|
||||||
background-image: var(--icon-forms);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* allow horizontal scrollbar
|
|
||||||
otherwise user management is not usable on mobile */
|
|
||||||
@media only screen and (max-width: 768px) {
|
|
||||||
#app-content {
|
|
||||||
overflow-x: auto !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#controls {
|
|
||||||
// adopted from NC13 for compatibily with OC10 and NC11-NC12
|
|
||||||
width: 100%;
|
|
||||||
position: relative;
|
|
||||||
top: 4px;
|
|
||||||
h2 {
|
|
||||||
margin-top: 12px;
|
|
||||||
}
|
|
||||||
.breadcrumb {
|
|
||||||
flex-grow: 1;
|
|
||||||
overflow: hidden;
|
|
||||||
|
|
||||||
div.crumb {
|
|
||||||
overflow: hidden;
|
|
||||||
white-space: nowrap;
|
|
||||||
flex-shrink: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
input[type='text'] {
|
|
||||||
display: block;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* OC10 and NC11 fixes*/
|
|
||||||
.symbol {
|
|
||||||
display: inline-block;
|
|
||||||
}
|
|
|
@ -1,11 +1,31 @@
|
||||||
#header {
|
/**
|
||||||
#appmenu,
|
* @copyright Copyright (c) 2020 John Molakvoæ <skjnldsv@protonmail.com>
|
||||||
.header-right,
|
*
|
||||||
nav {
|
* @author John Molakvoæ <skjnldsv@protonmail.com>
|
||||||
display: none;
|
*
|
||||||
}
|
* @license GNU AGPL version 3 or any later version
|
||||||
}
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
div.crumb {
|
* it under the terms of the GNU Affero General Public License as
|
||||||
background-image: none;
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#header .header-shared-by {
|
||||||
|
color: var(--color-primary-text);
|
||||||
|
position: relative;
|
||||||
|
font-weight: 300;
|
||||||
|
font-size: 11px;
|
||||||
|
line-height: 11px;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,73 +0,0 @@
|
||||||
.app-forms {
|
|
||||||
margin: auto;
|
|
||||||
width: 50%;
|
|
||||||
margin-top: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sv-q-description {
|
|
||||||
font-size: 420px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* hotfixcss
|
|
||||||
setting the width to 70% so it takes a more reasonable place for long titles
|
|
||||||
line height to 1 so the lines don't overlap
|
|
||||||
adding a margin-bottom for confort
|
|
||||||
*/
|
|
||||||
.sv_container {
|
|
||||||
h3 {
|
|
||||||
width: 70%;
|
|
||||||
line-height: 1;
|
|
||||||
margin-bottom: 5%;
|
|
||||||
font-size: 30px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* hotfixcss
|
|
||||||
changing to color so it matches the header
|
|
||||||
setting the width to 70% to match the previous fix
|
|
||||||
setting a more confortable margin-bottom
|
|
||||||
*/
|
|
||||||
.sv_qstn .sq-root {
|
|
||||||
border: 1px solid gray;
|
|
||||||
border-left: 4px solid #0082c9;
|
|
||||||
border-radius: 5px;
|
|
||||||
padding: 20px;
|
|
||||||
width: 70%;
|
|
||||||
margin-bottom: 6%;
|
|
||||||
font-size: 18px;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* hotfixcss
|
|
||||||
adding a margin
|
|
||||||
*/
|
|
||||||
.sq-title {
|
|
||||||
font-size: 20px;
|
|
||||||
margin-left: 20px;
|
|
||||||
margin-bottom: 2%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sq-title-required {
|
|
||||||
color: black;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* hotfixcss
|
|
||||||
display fex and align items center so the radio button is aligned with the text
|
|
||||||
*/
|
|
||||||
.sq-label {
|
|
||||||
margin-left: 30px;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sq-item:nth-child(1) {
|
|
||||||
margin-bottom: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* hotfixcss
|
|
||||||
adding the checkbox text's class to add a comfort margin
|
|
||||||
*/
|
|
||||||
.sv_q_checkbox_control_label {
|
|
||||||
margin-left: 1%;
|
|
||||||
}
|
|
|
@ -29,17 +29,19 @@ namespace OCA\Forms\Controller;
|
||||||
|
|
||||||
use OCA\Forms\Db\Form;
|
use OCA\Forms\Db\Form;
|
||||||
use OCA\Forms\Db\FormMapper;
|
use OCA\Forms\Db\FormMapper;
|
||||||
use OCA\Forms\Db\OptionMapper;
|
|
||||||
use OCA\Forms\Db\QuestionMapper;
|
|
||||||
use OCA\Forms\Service\FormsService;
|
use OCA\Forms\Service\FormsService;
|
||||||
|
|
||||||
|
use OCP\Accounts\IAccountManager;
|
||||||
use OCP\AppFramework\Controller;
|
use OCP\AppFramework\Controller;
|
||||||
use OCP\AppFramework\Db\DoesNotExistException;
|
use OCP\AppFramework\Db\DoesNotExistException;
|
||||||
|
use OCP\AppFramework\Http\Template\PublicTemplateResponse;
|
||||||
use OCP\AppFramework\Http\TemplateResponse;
|
use OCP\AppFramework\Http\TemplateResponse;
|
||||||
use OCP\IGroupManager;
|
use OCP\IGroupManager;
|
||||||
use OCP\IInitialStateService;
|
use OCP\IInitialStateService;
|
||||||
|
use OCP\IL10N;
|
||||||
use OCP\IRequest;
|
use OCP\IRequest;
|
||||||
use OCP\IURLGenerator;
|
use OCP\IUser;
|
||||||
|
use OCP\IUserManager;
|
||||||
use OCP\IUserSession;
|
use OCP\IUserSession;
|
||||||
use OCP\Util;
|
use OCP\Util;
|
||||||
|
|
||||||
|
@ -48,22 +50,28 @@ class PageController extends Controller {
|
||||||
|
|
||||||
/** @var FormMapper */
|
/** @var FormMapper */
|
||||||
private $formMapper;
|
private $formMapper;
|
||||||
|
|
||||||
|
/** @var FormsService */
|
||||||
|
private $formsService;
|
||||||
|
|
||||||
/** @var IURLGenerator */
|
/** @var IAccountManager */
|
||||||
private $urlGenerator;
|
protected $accountManager;
|
||||||
|
|
||||||
/** @var IGroupManager */
|
/** @var IGroupManager */
|
||||||
private $groupManager;
|
private $groupManager;
|
||||||
|
|
||||||
|
/** @var IInitialStateService */
|
||||||
|
private $initialStateService;
|
||||||
|
|
||||||
|
/** @var IL10N */
|
||||||
|
private $l10n;
|
||||||
|
|
||||||
|
/** @var IUserManager */
|
||||||
|
private $userManager;
|
||||||
|
|
||||||
/** @var IUserSession */
|
/** @var IUserSession */
|
||||||
private $userSession;
|
private $userSession;
|
||||||
|
|
||||||
/** @var IInitialStateService */
|
|
||||||
private $initialStateService;
|
|
||||||
|
|
||||||
/** @var FormsService */
|
|
||||||
private $formService;
|
|
||||||
|
|
||||||
/** @var Array
|
/** @var Array
|
||||||
*
|
*
|
||||||
* Maximum String lengths, the database is set to store.
|
* Maximum String lengths, the database is set to store.
|
||||||
|
@ -78,25 +86,27 @@ class PageController extends Controller {
|
||||||
|
|
||||||
public function __construct(string $appName,
|
public function __construct(string $appName,
|
||||||
IRequest $request,
|
IRequest $request,
|
||||||
IGroupManager $groupManager,
|
|
||||||
IURLGenerator $urlGenerator,
|
|
||||||
FormMapper $formMapper,
|
FormMapper $formMapper,
|
||||||
QuestionMapper $questionMapper,
|
FormsService $formsService,
|
||||||
OptionMapper $optionMapper,
|
IAccountManager $accountManager,
|
||||||
IUserSession $userSession,
|
IGroupManager $groupManager,
|
||||||
IInitialStateService $initialStateService,
|
IInitialStateService $initialStateService,
|
||||||
FormsService $formsService) {
|
IL10N $l10n,
|
||||||
|
IUserManager $userManager,
|
||||||
|
IUserSession $userSession) {
|
||||||
parent::__construct($appName, $request);
|
parent::__construct($appName, $request);
|
||||||
|
|
||||||
$this->groupManager = $groupManager;
|
|
||||||
$this->urlGenerator = $urlGenerator;
|
|
||||||
$this->appName = $appName;
|
$this->appName = $appName;
|
||||||
|
|
||||||
$this->formMapper = $formMapper;
|
$this->formMapper = $formMapper;
|
||||||
$this->questionMapper = $questionMapper;
|
|
||||||
$this->optionMapper = $optionMapper;
|
|
||||||
$this->userSession = $userSession;
|
|
||||||
$this->initialStateService = $initialStateService;
|
|
||||||
$this->formsService = $formsService;
|
$this->formsService = $formsService;
|
||||||
|
|
||||||
|
$this->accountManager = $accountManager;
|
||||||
|
$this->groupManager = $groupManager;
|
||||||
|
$this->initialStateService = $initialStateService;
|
||||||
|
$this->l10n = $l10n;
|
||||||
|
$this->userManager = $userManager;
|
||||||
|
$this->userSession = $userSession;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -194,12 +204,30 @@ class PageController extends Controller {
|
||||||
return new TemplateResponse('forms', 'expired');
|
return new TemplateResponse('forms', 'expired');
|
||||||
}
|
}
|
||||||
|
|
||||||
$renderAs = $this->userSession->isLoggedIn() ? 'user' : 'public';
|
|
||||||
|
|
||||||
Util::addScript($this->appName, 'submit');
|
Util::addScript($this->appName, 'submit');
|
||||||
$this->initialStateService->provideInitialState($this->appName, 'form', $this->formsService->getForm($form->getId()));
|
$this->initialStateService->provideInitialState($this->appName, 'form', $this->formsService->getForm($form->getId()));
|
||||||
$this->initialStateService->provideInitialState($this->appName, 'maxStringLengths', $this->maxStringLengths);
|
$this->initialStateService->provideInitialState($this->appName, 'maxStringLengths', $this->maxStringLengths);
|
||||||
return new TemplateResponse($this->appName, 'main', [], $renderAs);
|
|
||||||
|
if (!$this->userSession->isLoggedIn()) {
|
||||||
|
Util::addStyle($this->appName, 'public');
|
||||||
|
$response = new PublicTemplateResponse($this->appName, 'main');
|
||||||
|
$response->setHeaderTitle($form->getTitle());
|
||||||
|
|
||||||
|
// Get owner and check display name privacy settings
|
||||||
|
$owner = $this->userManager->get($form->getOwnerId());
|
||||||
|
if ($owner instanceof IUser) {
|
||||||
|
$ownerAccount = $this->accountManager->getAccount($owner);
|
||||||
|
|
||||||
|
$ownerName = $ownerAccount->getProperty(IAccountManager::PROPERTY_DISPLAYNAME);
|
||||||
|
if ($ownerName->getScope() === IAccountManager::VISIBILITY_PUBLIC) {
|
||||||
|
$response->setHeaderDetails($this->l10n->t('Shared by %s', [$ownerName->getValue()]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new TemplateResponse($this->appName, 'main');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue