--- a/cms/app-client/app/adapters/application.js Mon Jul 18 02:37:48 2016 +0200
+++ b/cms/app-client/app/adapters/application.js Wed Jul 20 21:08:31 2016 +0200
@@ -2,14 +2,21 @@
import ENV from 'app-client/config/environment';
export default RESTAdapter.extend({
- namespace: ENV.baseURL.replace(/\/$/,"")+'/api/v1',
- //TODO: pass this as configuration
- //host: 'http://localhost:8000'
-});
+
+ namespace: ENV.baseURL.replace(/\/$/,"")+'/api/v1',
-//export { default } from 'ember-data-fixture-adapter';
+ buildURL: function(modelName, id) {
+ if(modelName === 'transcript') {
+ return this.urlPrefix() + '/documents/' + id + '/' + modelName;
+ }
+ return this._super(...arguments);
+ },
-// export default DS.RESTAdapter.extend({
-// host: 'http://127.0.0.1:8000',
-// namespace: 'api',
-// });
+ pathForType: function(modelName) {
+ if(modelName === 'transcript') {
+ return modelName;
+ }
+ return this._super(...arguments);
+ }
+
+});
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/cms/app-client/app/components/transcript-component.js Wed Jul 20 21:08:31 2016 +0200
@@ -0,0 +1,9 @@
+import Ember from 'ember';
+
+export default Ember.Component.extend({
+
+ player: Ember.inject.service(),
+
+ language: 'fr'
+
+});
--- a/cms/app-client/app/controllers/application.js Mon Jul 18 02:37:48 2016 +0200
+++ b/cms/app-client/app/controllers/application.js Wed Jul 20 21:08:31 2016 +0200
@@ -92,6 +92,9 @@
this.store.findRecord('document', this.get('player').get('item'), { reload: true }).then(function(model){
self.get('player').set('model', model);
});
+ this.store.findRecord('transcript', encodeURIComponent('11280.100/crdo-09-CAYCHAX_SOUND')).then(function(model) {
+ self.get('player').set('transcript', model);
+ });
}),
notice: null,
@@ -111,8 +114,6 @@
}
}),
-
-
init: function() {
this._super(...arguments);
this.get('player');
--- a/cms/app-client/app/helpers/is-checked.js Mon Jul 18 02:37:48 2016 +0200
+++ b/cms/app-client/app/helpers/is-checked.js Wed Jul 20 21:08:31 2016 +0200
@@ -12,7 +12,7 @@
var filter = decade.filter(function(date){ return dates.indexOf(date) > -1; });
if(filter.length === decade.length) {
- return true
+ return true;
}
return false;
}
--- a/cms/app-client/app/helpers/is-indeterminate.js Mon Jul 18 02:37:48 2016 +0200
+++ b/cms/app-client/app/helpers/is-indeterminate.js Wed Jul 20 21:08:31 2016 +0200
@@ -12,7 +12,7 @@
var filter = decade.filter(function(date){ return dates.indexOf(date) > -1; });
if(filter.length !== decade.length && filter.length) {
- return true
+ return true;
}
return false;
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/cms/app-client/app/models/transcript.js Wed Jul 20 21:08:31 2016 +0200
@@ -0,0 +1,8 @@
+import DS from 'ember-data';
+
+export default DS.Model.extend({
+
+ title: DS.attr(),
+ annotations: DS.attr(),
+
+});
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/cms/app-client/app/serializers/transcript.js Wed Jul 20 21:08:31 2016 +0200
@@ -0,0 +1,27 @@
+import JSONAPISerializer from 'ember-data/serializers/json-api';
+
+export default JSONAPISerializer.extend({
+
+ normalizeResponse: function(store, primaryModelClass, payload, id, requestType) {
+ var annotations = [];
+ payload.annotations.forEach(function(annotation) {
+ annotations.push({
+ 'content': annotation.content.data.content,
+ 'translation': annotation.content.data.transl['@value'],
+ 'start': annotation.begin,
+ 'end': annotation.end
+ });
+ });
+ return {
+ 'data': {
+ 'id': id,
+ 'type': 'transcript',
+ 'attributes': {
+ 'title': payload.meta['dc:title']['@value'],
+ 'annotations': annotations
+ }
+ }
+ };
+ }
+
+});
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/cms/app-client/app/templates/components/transcript-component.hbs Wed Jul 20 21:08:31 2016 +0200
@@ -0,0 +1,8 @@
+<h2>{{player.transcript.title}}</h2>
+<div class="transcript">
+{{#each player.transcript.annotations as |annotation|}}
+ <i class="fa fa-play">Play</i>
+ <p>{{annotation.content}}</p>
+ <p>{{annotation.translation}}</p>
+{{/each}}
+</div>
\ No newline at end of file
--- a/cms/app-client/mirage/config.js Mon Jul 18 02:37:48 2016 +0200
+++ b/cms/app-client/mirage/config.js Wed Jul 20 21:08:31 2016 +0200
@@ -19,6 +19,7 @@
this.get('/documents', function({ documents }) {
return this.serialize(documents.all(), 'sparse-document');
});
+
this.get('/documents/:id', ({documents}, request) => {
let id = decodeURIComponent(request.params.id);
return documents.find(id);
@@ -26,7 +27,6 @@
this.get('/documents/:id/transcript', ({transcripts}, request) => {
let id = decodeURIComponent(request.params.id);
-
return transcripts.find(id).transcript;
});
@@ -47,15 +47,12 @@
res[id] = lexvoRes?lexvoRes.name:null;
return res;
}, {});
-
return {
'lexvoids': resMap
};
-
});
this.get('/bnf/:ids', ({ bnfs }, request) => {
-
var bnfIds = decodeURIComponent(request.params.ids);
var resMap = _.reduce(bnfIds.split(','), function(res, id) {
var fullId = id;
@@ -70,11 +67,9 @@
res[id] = bnfRes?bnfRes.label:null;
return res;
}, {});
-
return {
'bnfids': resMap
};
-
});
--- a/cms/app-client/package.json Mon Jul 18 02:37:48 2016 +0200
+++ b/cms/app-client/package.json Wed Jul 20 21:08:31 2016 +0200
@@ -30,7 +30,7 @@
"broccoli-static-compiler": "^0.2.2",
"corpus-common-addon": "file:../../common/corpus-common-addon",
"ember-ajax": "^2.0.1",
- "ember-cli": "2.6.0-beta.2",
+ "ember-cli": "^2.6.3",
"ember-cli-app-version": "^1.0.0",
"ember-cli-babel": "^5.1.6",
"ember-cli-d3": "1.1.6",
@@ -49,7 +49,7 @@
"ember-data-fixture-adapter": "1.13.0",
"ember-disable-proxy-controllers": "^1.0.1",
"ember-export-application-global": "^1.0.5",
- "ember-font-awesome": "martndemus/ember-font-awesome#pull/91/head",
+ "ember-font-awesome": "github:martndemus/ember-font-awesome#pull/91/head",
"ember-load-initializers": "^0.5.1",
"ember-lodash": "0.0.6",
"ember-resolver": "^2.0.3",
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/cms/app-client/tests/integration/components/transcript-component-test.js Wed Jul 20 21:08:31 2016 +0200
@@ -0,0 +1,24 @@
+import { moduleForComponent, test } from 'ember-qunit';
+import hbs from 'htmlbars-inline-precompile';
+
+moduleForComponent('transcript-component', 'Integration | Component | transcript component', {
+ integration: true
+});
+
+test('it renders', function(assert) {
+ // Set any properties with this.set('myProperty', 'value');
+ // Handle any actions with this.on('myAction', function(val) { ... });
+
+ this.render(hbs`{{transcript-component}}`);
+
+ assert.equal(this.$().text().trim(), '');
+
+ // Template block usage:
+ this.render(hbs`
+ {{#transcript-component}}
+ template block text
+ {{/transcript-component}}
+ `);
+
+ assert.equal(this.$().text().trim(), 'template block text');
+});
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/cms/app-client/tests/unit/models/transcript-test.js Wed Jul 20 21:08:31 2016 +0200
@@ -0,0 +1,12 @@
+import { moduleForModel, test } from 'ember-qunit';
+
+moduleForModel('transcript', 'Unit | Model | transcript', {
+ // Specify the other units that are required for this test.
+ needs: []
+});
+
+test('it exists', function(assert) {
+ let model = this.subject();
+ // let store = this.store();
+ assert.ok(!!model);
+});
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/cms/app-client/tests/unit/serializers/transcript-test.js Wed Jul 20 21:08:31 2016 +0200
@@ -0,0 +1,15 @@
+import { moduleForModel, test } from 'ember-qunit';
+
+moduleForModel('transcript', 'Unit | Serializer | transcript', {
+ // Specify the other units that are required for this test.
+ needs: ['serializer:transcript']
+});
+
+// Replace this with your real tests.
+test('it serializes records', function(assert) {
+ let record = this.subject();
+
+ let serializedRecord = record.serialize();
+
+ assert.ok(serializedRecord);
+});