Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide resource form if the role of the user is anonymous #429

Open
wants to merge 2 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/cms/lib/modules/resource-form-widgets/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ module.exports = {
{
name: 'Role',
label: 'Role',
fields: ['labelRole', 'infoRole', 'displayRole', 'requiredRole', 'typeRole', 'minRole', 'maxRole']
fields: ['labelRole', 'infoRole', 'displayRole', 'requiredRole', 'typeRole', 'minRole', 'maxRole', 'noAnonymousAllowedText']
},
{
name: 'Phone',
Expand Down
6 changes: 6 additions & 0 deletions packages/cms/lib/modules/resource-form-widgets/lib/fields.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ const fields = [
type: 'string',
label: 'Login text'
},
{
name: 'noAnonymousAllowedText',
type: 'string',
label: 'Login text',
def: 'Anonieme gebruikers kunnen geen plannen indienen'
},
{
name: 'hideAdminAfterPublicAction',
label: 'Hide admin after first public action? (not yet connected to the API)',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,14 @@
{% endif %}

<div class="pageContent newactiveResource" id="content">
{% if not data.widget.showForm %}

{% if data.openstadUser.role === 'anonymous'%}
<div class="box-grey">
<h1>{% if data.widget.noAnonymousAllowedText %} {{ data.widget.noAnonymousAllowedText | sanitize | safe }} {% else %} Anonieme gebruikers kunnen geen plannen indienen {% endif %}</h1>
<p>Klik <a href="{{data.siteUrl}}/oauth/login">hier</a> om in te loggen met een andere gebruiker.</p>
LorenzoJokhan marked this conversation as resolved.
Show resolved Hide resolved
</div>

{% elseif not data.widget.showForm %}
<div class="box-grey">
<h1>{% if data.widget.loginText %} {{ data.widget.loginText | sanitize | safe }} {% else %} Om een plan in te dienen moet je ingelogd zijn.{% endif %}</h1>
<p>Klik <a href="{{data.siteUrl}}/oauth/login">hier</a> om in te loggen.</p>
Expand Down