ENH: Simple collection details (#27)
This commit is contained in:
parent
578b8daa32
commit
09a62cf165
14 changed files with 60 additions and 29 deletions
18
app/components/collection-detail-container.js
Normal file
18
app/components/collection-detail-container.js
Normal file
|
@ -0,0 +1,18 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
const { Component } = Ember;
|
||||
|
||||
export default Component.extend({
|
||||
// ARGS
|
||||
model: null,
|
||||
|
||||
columns: [
|
||||
{ label: 'Project', valuePath: 'project.name', },
|
||||
{ label: 'Study Location', valuePath: 'studyLocation.code', },
|
||||
{ label: 'Method', valuePath: 'collectionMethod.code', },
|
||||
{ label: 'Type', valuePath: 'collectionType.name', },
|
||||
{ label: '# of Traps', valuePath: 'numberOfTraps', },
|
||||
{ label: 'Start', valuePath: 'startDateTime', },
|
||||
{ label: 'End', valuePath: 'endDateTime', },
|
||||
],
|
||||
});
|
|
@ -10,5 +10,8 @@ export default Controller.extend({
|
|||
changePage(page) {
|
||||
this.set('page', page);
|
||||
},
|
||||
rowClick(row) {
|
||||
this.transitionToRoute('collections.detail', row.get('id'));
|
||||
},
|
||||
},
|
||||
});
|
|
@ -9,7 +9,9 @@ const Router = Ember.Router.extend({
|
|||
Router.map(function() {
|
||||
this.route('login');
|
||||
this.route('logout');
|
||||
this.route('collections');
|
||||
this.route('collections', function() {
|
||||
this.route('detail', { path: '/:collection_id' });
|
||||
});
|
||||
});
|
||||
|
||||
export default Router;
|
||||
|
|
11
app/routes/collections/detail.js
Normal file
11
app/routes/collections/detail.js
Normal file
|
@ -0,0 +1,11 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
const { Route, RSVP } = Ember;
|
||||
|
||||
export default Route.extend({
|
||||
model(params) {
|
||||
return RSVP.all([
|
||||
this.get('store').findRecord('collection', params.collection_id)
|
||||
]);
|
||||
},
|
||||
});
|
|
@ -1 +0,0 @@
|
|||
{{collections-container model=model changePage=(action 'changePage')}}
|
1
app/templates/collections/detail.hbs
Normal file
1
app/templates/collections/detail.hbs
Normal file
|
@ -0,0 +1 @@
|
|||
{{collection-detail-container model=model}}
|
6
app/templates/collections/index.hbs
Normal file
6
app/templates/collections/index.hbs
Normal file
|
@ -0,0 +1,6 @@
|
|||
{{
|
||||
collections-container
|
||||
model=model
|
||||
changePage=(action 'changePage')
|
||||
onRowClick=(action 'rowClick')
|
||||
}}
|
|
@ -1,12 +1,12 @@
|
|||
{{#if hasBlock}}
|
||||
{{yield (hash
|
||||
table=(component 'light-table' table=table)
|
||||
pagination=(component 'ccdb-pagination' model=model changePage=(action changePage))
|
||||
grid=(component 'light-table' table=table onRowClicked=(action (optional onRowClicked)))
|
||||
pagination=(component 'ccdb-pagination' model=model changePage=(action (optional changePage)))
|
||||
)}}
|
||||
{{else}}
|
||||
{{ccdb-pagination model=model changePage=(action changePage)}}
|
||||
{{ccdb-pagination model=model changePage=(action (optional changePage))}}
|
||||
{{#light-table table tableClassNames="table table-striped" as |t|}}
|
||||
{{t.head}}
|
||||
{{t.body}}
|
||||
{{t.body onRowClick=(action (optional onRowClick))}}
|
||||
{{/light-table}}
|
||||
{{/if}}
|
||||
|
|
6
app/templates/components/collection-detail-container.hbs
Normal file
6
app/templates/components/collection-detail-container.hbs
Normal file
|
@ -0,0 +1,6 @@
|
|||
{{#ccdb-table model=model columns=columns as |c|}}
|
||||
{{#c.grid as |g|}}
|
||||
{{g.head}}
|
||||
{{g.body}}
|
||||
{{/c.grid}}
|
||||
{{/ccdb-table}}
|
|
@ -1 +1,7 @@
|
|||
{{ccdb-table model=model columns=columns changePage=(action changePage)}}
|
||||
{{
|
||||
ccdb-table
|
||||
model=model
|
||||
columns=columns
|
||||
changePage=(action changePage)
|
||||
onRowClick=(action onRowClick)
|
||||
}}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue