ENH: Create collections (#38)

Fixes #35
This commit is contained in:
Matthew Ryan Dillon 2017-10-01 16:49:43 -07:00 committed by GitHub
parent 09a62cf165
commit e1abc5e4cb
20 changed files with 260 additions and 6 deletions

View file

@ -0,0 +1,10 @@
{{
collection-create-container
model=model
projectOptions=projectOptions
studyLocationOptions=studyLocationOptions
collectionTypeOptions=collectionTypeOptions
collectionMethodOptions=collectionMethodOptions
onSave=(action 'onSave')
onCancel=(action 'onCancel')
}}

View file

@ -3,4 +3,5 @@
model=model
changePage=(action 'changePage')
onRowClick=(action 'rowClick')
createCollection=(action 'createCollection')
}}

View file

@ -0,0 +1 @@
{{label}}

View file

@ -0,0 +1,107 @@
{{#crud-form
changeset=changeset
onSave=(action onSave)
onCancel=(action onCancel) as |f|
}}
<div class="well">
{{#f.content class='form-horizontal'}}
<div class="form-group">
<label class="col-md-2 control-label">Project</label>
<div class="col-md-10">
{{#power-select
options=projectOptions
selected=changeset.project
onchange=(action (mut changeset.project))
searchField='name'
as |project|
}}
{{project.name}}
{{/power-select}}
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">Study location</label>
<div class="col-md-10">
{{#power-select
options=studyLocationOptions
selected=changeset.studyLocation
onchange=(action (mut changeset.studyLocation))
searchField='name'
as |studyLocation|
}}
{{studyLocation.name}}
{{/power-select}}
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">Collection type</label>
<div class="col-md-10">
{{#power-select
options=collectionTypeOptions
selected=changeset.collectionType
onchange=(action (mut changeset.collectionType))
searchField='name'
as |collectionType|
}}
{{collectionType.name}}
{{/power-select}}
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">Collection method</label>
<div class="col-md-10">
{{#power-select
options=collectionMethodOptions
selected=changeset.collectionMethod
onchange=(action (mut changeset.collectionMethod))
searchField='name'
as |collectionMethod|
}}
{{collectionMethod.name}}
{{/power-select}}
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">Number of traps</label>
<div class="col-md-10">
{{input value=changeset.numberOfTraps type='number' class='form-control'}}
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">Collection start date</label>
<div class="col-md-10">
{{input value=changeset.collectionStartDate type='date' class='form-control'}}
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">Collection start time</label>
<div class="col-md-10">
{{input value=changeset.collectionStartTime type='time' class='form-control'}}
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">Collection end date</label>
<div class="col-md-10">
{{input value=changeset.collectionEndDate type='date' class='form-control'}}
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">Collection end time</label>
<div class="col-md-10">
{{input value=changeset.collectionEndTime type='time' class='form-control'}}
</div>
</div>
{{/f.content}}
{{f.save}} {{f.cancel}}
</div>
{{/crud-form}}

View file

@ -1,3 +1,9 @@
{{
action-button
isPrimary=true
label='New Collection'
onClick=(action createCollection)
}}
{{
ccdb-table
model=model

View file

@ -0,0 +1,15 @@
{{#if hasBlock}}
{{yield (hash
content=(component 'form-content' changeset=changeset)
cancel=(component 'action-button'
label='Cancel'
isDanger=true
onClick=(action onCancel changeset))
save=(component 'action-button'
label='Save'
isSuccess=true
onClick=(action onSave changeset))
)}}
{{else}}
MISSING CONTENT BLOCK
{{/if}}

View file

@ -0,0 +1 @@
{{yield}}