chore: 🤖 convert project form to rose form component
This commit is contained in:
3 files changed
+17
-35
No files matched your search
@@ -1,44 +1,30 @@
|
||||
<form
|
||||
...attributes
|
||||
novalidate
|
||||
method="post"
|
||||
{{on "submit" @submit}}>
|
||||
<Rose::Form
|
||||
@onSubmit={{@submit}}
|
||||
@cancel={{@cancel}}
|
||||
@disabled={{@model.isSaving}}
|
||||
as |form|
|
||||
>
|
||||
|
||||
<Rose::Form::Input
|
||||
<form.input
|
||||
name="name"
|
||||
@type="name"
|
||||
@value={{@model.name}}
|
||||
@label={{t "form.label.name"}}
|
||||
@error={{false}}
|
||||
disabled={{@model.isSaving}}
|
||||
readonly={{false}}
|
||||
/>
|
||||
readonly={{false}} />
|
||||
|
||||
<Rose::Form::Textarea
|
||||
<form.textarea
|
||||
name="description"
|
||||
@type="description"
|
||||
@value={{@model.description}}
|
||||
@label={{t "form.label.description"}}
|
||||
@error={{false}}
|
||||
disabled={{@model.isSaving}}
|
||||
readonly={{false}}
|
||||
/>
|
||||
readonly={{false}} />
|
||||
|
||||
<section class="form-actions">
|
||||
<Rose::Button
|
||||
@disabled={{@model.cannotSave}}
|
||||
@submit={{true}}
|
||||
@style="primary"
|
||||
>
|
||||
{{t 'actions.save'}}
|
||||
</Rose::Button>
|
||||
<form.actions
|
||||
@disabled={{if @model.cannotSave @model.cannotSave}}
|
||||
@submitText={{t "actions.save"}}
|
||||
@cancelText={{t "actions.cancel"}} />
|
||||
|
||||
<Rose::Button
|
||||
@disabled={{@model.cannotSave}}
|
||||
@style="secondary"
|
||||
{{on "click" @cancel}}
|
||||
>
|
||||
{{t 'actions.cancel'}}
|
||||
</Rose::Button>
|
||||
</section>
|
||||
</form>
|
||||
</Rose::Form>
|
||||
@@ -31,9 +31,7 @@ export default class OrgsOrgProjectsNewRoute extends Route {
|
||||
* @param {Event} e
|
||||
*/
|
||||
@action
|
||||
async save(project, e) {
|
||||
// Prevent default behavior, since this was trigger from a form submission.
|
||||
e.preventDefault();
|
||||
async save(project) {
|
||||
try {
|
||||
await project.save();
|
||||
this.transitionTo('orgs.org.projects.project', project);
|
||||
|
||||
@@ -44,9 +44,7 @@ export default class OrgsOrgProjectsProjectRoute extends Route {
|
||||
* @param {Event} e
|
||||
*/
|
||||
@action
|
||||
async save(project, e) {
|
||||
// Prevent default behavior, since this was trigger from a form submission.
|
||||
e.preventDefault();
|
||||
async save(project) {
|
||||
try {
|
||||
await project.save();
|
||||
} catch (e) {
|
||||
|
||||
Reference in new issue
Block a user