-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(permissions): add permission edit view
- Loading branch information
Showing
7 changed files
with
160 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import Controller from "@ember/controller"; | ||
import { action } from "@ember/object"; | ||
|
||
export default class PermissionsEditController extends Controller { | ||
@action | ||
updateModel(model, formElements) { | ||
model.slug = formElements.slug.value; | ||
model.name = formElements.name.value; | ||
model.description = formElements.description.value; | ||
|
||
return model; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import Route from "@ember/routing/route"; | ||
import { inject as service } from "@ember/service"; | ||
|
||
import handleModelErrors from "ember-emeis/decorators/handle-model-errors"; | ||
|
||
export default class PermissionsEditRoute extends Route { | ||
@service notification; | ||
@service intl; | ||
|
||
@handleModelErrors({ routeFor404: "permissions.index" }) | ||
async model({ permission_id: id }) { | ||
return await this.store.findRecord("permission", id); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<EditForm @model={{@model}} @updateModel={{this.updateModel}}> | ||
<EditForm::Element @label={{t "emeis.permissions.headings.slug"}}> | ||
<input | ||
class="uk-input" | ||
type="text" | ||
name="slug" | ||
pattern="^[-a-zA-Z0-9_]+$" | ||
disabled={{not @model.isNew}} | ||
value={{@model.slug}} | ||
/> | ||
<span class="uk-text-meta"> | ||
{{t "emeis.form.slug-hint"}} | ||
</span> | ||
</EditForm::Element> | ||
|
||
<EditForm::Element @label={{t "emeis.permissions.headings.name"}}> | ||
<input | ||
class="uk-input" | ||
type="text" | ||
name="name" | ||
placeholder="{{t "emeis.permissions.headings.name"}}..." | ||
required | ||
value={{@model.name}} | ||
/> | ||
</EditForm::Element> | ||
|
||
<EditForm::Element @label={{t "emeis.permissions.headings.description"}}> | ||
<textarea | ||
class="uk-textarea" | ||
rows="5" | ||
name="description" | ||
placeholder="{{t "emeis.permissions.headings.description"}}..." | ||
value={{@model.description}} | ||
required | ||
></textarea> | ||
</EditForm::Element> | ||
|
||
<EditForm::Element @label={{t "emeis.permissions.headings.roles"}}> | ||
<RelationshipSelect | ||
@modelName="role" | ||
@selected={{@model.roles}} | ||
@placeholder="{{t "emeis.permissions.headings.roles"}}..." | ||
@onChange={{set @model.roles}} | ||
@multiple="true" | ||
required as |role| | ||
> | ||
{{role.name}} | ||
</RelationshipSelect> | ||
</EditForm::Element> | ||
</EditForm> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default } from "ember-emeis/controllers/permissions/edit"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default } from "ember-emeis/routes/permissions/edit"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default } from "ember-emeis/templates/permissions/edit"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters