Skip to content

Commit

Permalink
Hide resource form if the role of the user is anonymous
Browse files Browse the repository at this point in the history
  • Loading branch information
LorenzoJokhan committed Sep 4, 2023
1 parent 9c45225 commit ec2415d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
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>
</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

1 comment on commit ec2415d

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Published new image: openstad/frontend:feature-hide-resource-form-if-anonymous-ec2415d

Please sign in to comment.