Skip to content
This repository has been archived by the owner on May 13, 2024. It is now read-only.

Commit

Permalink
fix: changeset was not trigger the form change (save button was not b…
Browse files Browse the repository at this point in the history
…een enabled)
  • Loading branch information
MitanOmar committed Mar 14, 2023
1 parent cc34ff0 commit bac534c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
9 changes: 9 additions & 0 deletions app/index/activities/edit/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import Controller from "@ember/controller";
import { action } from "@ember/object";
import { inject as service } from "@ember/service";
import { tracked } from "@glimmer/tracking";

/**
* Controller to edit an activity
Expand All @@ -17,6 +18,7 @@ import { inject as service } from "@ember/service";
export default class IndexActivitiesEditController extends Controller {
@service notify;
@service router;
@tracked changeset;

/**
* Whether the save button is enabled
Expand Down Expand Up @@ -92,4 +94,11 @@ export default class IndexActivitiesEditController extends Controller {
this.notify.error("Error while deleting the activity");
}
}

@action
setTask(task) {
if (task.id !== this.changeset.task.id) {
this.changeset.task = task;
}
}
}
4 changes: 2 additions & 2 deletions app/index/activities/edit/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
<TaskSelection
@initial={{hash task=this.changeset.task}}
@task={{this.changeset.task}}
@on-set-task={{fn (mut this.changeset.task)}}
@on-set-task={{fn this.setTask this.changeset.task}}
as |t|
>
<div class="form-group">{{t.customer}}</div>
<div class="form-group">{{t.project}}</div>
<div
class="form-group"
{{did-update t.reset @model.task}}
{{did-update t.reset @model.task.id}}
>{{t.task}}</div>
</TaskSelection>
</div>
Expand Down

0 comments on commit bac534c

Please sign in to comment.