Skip to content

Commit

Permalink
Merge pull request #1201 from Yelinz/fix-org-edit
Browse files Browse the repository at this point in the history
Fix identity editing
  • Loading branch information
open-dynaMIX authored Jan 24, 2025
2 parents 8e77700 + b9bd803 commit b04d656
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 53 deletions.
4 changes: 2 additions & 2 deletions compose.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
x-version: 0.5.0
x-version: 0.5.1

services:
db:
Expand Down Expand Up @@ -66,7 +66,7 @@ services:
command: start

ember:
image: ghcr.io/adfinis/mysagw/ember:0.2.2
image: ghcr.io/adfinis/mysagw/ember:0.2.3

minio:
image: minio/minio:RELEASE.2024-12-13T22-19-12Z
Expand Down
2 changes: 1 addition & 1 deletion ember/app/ui/components/identity-addresses/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
<p>{{t "components.identity-addresses.list.empty"}}</p>
{{/if}}

{{#if (and (can "add address" @identity) (not @readOnlyView))}}
{{#if (can "add address" @identity)}}
<p class="uk-text-right">
<button
class="uk-button uk-button-default"
Expand Down
2 changes: 1 addition & 1 deletion ember/app/ui/components/identity-emails/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
<p>{{t "components.identity-emails.list.empty"}}</p>
{{/if}}

{{#if (and (can "add additional-email" @identity) (not @readOnlyView))}}
{{#if (can "add additional-email" @identity)}}
<p class="uk-text-right">
<button
class="uk-button uk-button-default"
Expand Down
8 changes: 8 additions & 0 deletions ember/app/ui/components/identity-form/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export default class IdentityFormComponent extends Component {
@service store;
@service intl;
@service router;
@service can;

@tracked changeset;
@tracked backToIdentities;
Expand Down Expand Up @@ -79,6 +80,13 @@ export default class IdentityFormComponent extends Component {
return this.args.cancelRouteOverride || "identities";
}

get disabledOnProfileView() {
return (
this.can.cannot("edit identity", this.changeset.data) ||
(this.changeset.isOrganisation && this.args.profileView)
);
}

@action
eventTarget(handler, event) {
handler(event.target.value);
Expand Down
59 changes: 13 additions & 46 deletions ember/app/ui/components/identity-form/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
class="uk-margin-remove-last-child"
as |Form|
>
{{#unless @customEndpoint}}
{{#unless @profileView}}
<Form.input
@label={{t "components.identity-form.label.isOrganisation"}}
@type="checkbox"
Expand All @@ -22,10 +22,7 @@
<Form.input
@label={{t "components.identity-form.label.organisationName"}}
@name="organisationName"
@disabled={{or
(cannot "edit identity" this.changeset.data)
@readOnlyView
}}
@disabled={{cannot "edit identity" this.changeset.data}}
/>

<div uk-grid>
Expand All @@ -34,28 +31,22 @@
@label={{t "components.identity-form.label.isExpertAssociation"}}
@type="checkbox"
@name="isExpertAssociation"
@disabled={{or
(cannot "edit identity" this.changeset.data)
@readOnlyView
}}
@disabled={{cannot "edit identity" this.changeset.data}}
/>
</div>
<div>
<Form.input
@label={{t "components.identity-form.label.isAdvisoryBoard"}}
@type="checkbox"
@name="isAdvisoryBoard"
@disabled={{or
(cannot "edit identity" this.changeset.data)
@readOnlyView
}}
@disabled={{cannot "edit identity" this.changeset.data}}
/>
</div>
</div>
{{/if}}
{{/unless}}

{{#if (and this.changeset.isOrganisation @customEndpoint)}}
{{#if (and this.changeset.isOrganisation @profileView)}}
<Form.input
@label={{t "components.identity-form.label.organisationName"}}
@name="organisationName"
Expand All @@ -71,11 +62,7 @@
@options={{this.salutations}}
@optionLabelPath="label"
@optionTargetPath="value"
@disabled={{or
(cannot "edit identity" this.changeset.data)
@readOnlyView
@customEndpoint
}}
@disabled={{this.disabledOnProfileView}}
/>
</div>
<div>
Expand All @@ -86,11 +73,7 @@
@options={{this.titles}}
@optionLabelPath="label"
@optionTargetPath="value"
@disabled={{or
(cannot "edit identity" this.changeset.data)
@readOnlyView
@customEndpoint
}}
@disabled={{this.disabledOnProfileView}}
/>
</div>
</div>
Expand All @@ -99,22 +82,14 @@
<Form.input
@label={{t "components.identity-form.label.firstName"}}
@name="firstName"
@disabled={{or
(cannot "edit identity" this.changeset.data)
@readOnlyView
@customEndpoint
}}
@disabled={{this.disabledOnProfileView}}
/>
</div>
<div>
<Form.input
@label={{t "components.identity-form.label.lastName"}}
@name="lastName"
@disabled={{or
(cannot "edit identity" this.changeset.data)
@readOnlyView
@customEndpoint
}}
@disabled={{this.disabledOnProfileView}}
/>
</div>
</div>
Expand All @@ -135,8 +110,7 @@
disabled={{or
this.changeset.idpId
(cannot "edit identity" this.changeset.data)
@readOnlyView
@customEndpoint
@profileView
}}
value={{field.value}}
{{on "input" (fn this.eventTarget field.update)}}
Expand Down Expand Up @@ -164,11 +138,7 @@
@options={{this.languages}}
@optionLabelPath="label"
@optionTargetPath="value"
@disabled={{or
(cannot "edit identity" this.changeset.data)
@readOnlyView
@customEndpoint
}}
@disabled={{this.disabledOnProfileView}}
/>

{{#if @profileView}}
Expand All @@ -178,15 +148,12 @@
@disabled={{cannot "edit identity" this.changeset.data}}
/>
</div>
{{else if (not @readOnlyView @customEndpoint)}}
{{else}}
<Form.input
@label={{t "components.identity-form.label.comment"}}
@name="comment"
@type="textarea"
@disabled={{or
(cannot "edit identity" this.changeset.data)
@customEndpoint
}}
@disabled={{cannot "edit identity" this.changeset.data}}
/>

<p class="uk-flex uk-flex-between">
Expand Down
2 changes: 1 addition & 1 deletion ember/app/ui/components/identity-interests/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
{{/each}}
</ul>

{{#if (and (can "add interest to identity" @identity) (not @readOnlyView))}}
{{#if (can "add interest to identity" @identity)}}
<p class="uk-text-right">
<button
class="uk-button uk-button-default"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
<p>{{t "components.identity-phone-numbers.list.empty"}}</p>
{{/if}}

{{#if (and (can "add phone-number" @identity) (not @readOnlyView))}}
{{#if (can "add phone-number" @identity)}}
<p class="uk-text-right">
<button
class="uk-button uk-button-default"
Expand Down
1 change: 1 addition & 0 deletions ember/app/ui/profile/edit/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
@identity={{@model}}
@customEndpoint="my-orgs/{{@model.id}}"
@cancelRouteOverride="profile"
@profileView={{true}}
/>

<hr />
Expand Down
2 changes: 1 addition & 1 deletion ember/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mysagw",
"version": "0.2.2",
"version": "0.2.3",
"private": true,
"description": "Small description for mySAGW goes here",
"repository": "",
Expand Down

0 comments on commit b04d656

Please sign in to comment.