Skip to content

Commit

Permalink
refactor(ember/project-form): single file component
Browse files Browse the repository at this point in the history
  • Loading branch information
c0rydoras committed Mar 27, 2024
1 parent cb6489d commit 6faead1
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 55 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
import { concat } from '@ember/helper';
import { service } from '@ember/service';
import Component from '@glimmer/component';
import { dropTask } from 'ember-concurrency';
import perform from 'ember-concurrency/helpers/perform';
import { scheduleTask } from 'ember-lifeline';
import { pageTitle } from 'ember-page-title';
import { eq, gt } from 'ember-truth-helpers';
import { tracked } from 'tracked-built-ins';

import Form from './form';

import { emptyChangeset } from 'outdated/utils';
import ProjectValidations from 'outdated/validations/project';

Expand Down Expand Up @@ -88,4 +94,61 @@ export default class ProjectFormComponent extends Component {
get repoTypes() {
return ['public', 'access-token'];
}
<template>
{{pageTitle @project.name}}

<Form
@name={{if
@project
(concat 'Edit project ' @project.name)
'Track new Project'
}}
@model={{this.project}}
@onSubmit={{perform this.saveProject}}
as |f|
>
<f.input @name='name' />
<div class='uk-margin'>
<label class='uk-form-label'>Repo</label>
<div class='repo-inputs'>
<f.input @name='repo' @raw={{true}} />
<f.input
@name='repoType'
@type='select'
@options={{this.repoTypes}}
@raw={{true}}
/>
</div>
</div>

<f.input
@name='accessToken'
type='password'
autocomplete='off'
@hidden={{(eq this.project.repoType 'public')}}
/>

<f.input
@name='users'
@type='select'
@label='Maintainers'
@multiple={{true}}
@value={{this.project.users}}
@options={{this.users}}
@searchField='searchField'
@visibleField='fullName'
/>
{{#if (gt this.project.users.length 1)}}
<f.input
@name='primaryMaintainer'
@type='select'
@options={{this.project.users}}
@value={{this.primaryMaintainer}}
@searchField='searchField'
@visibleField='fullName'
/>
{{/if}}
<f.button @loading={{this.saveProject.isRunning}} />
</Form>
</template>
}
55 changes: 0 additions & 55 deletions ember/app/components/project-form/template.hbs

This file was deleted.

0 comments on commit 6faead1

Please sign in to comment.