# HG changeset patch # User nowmad@nowmads-macbook-pro.local # Date 1453327552 -3600 # Node ID acfeddc7821df4a0c79aa2767d0ea28ffd522bf4 # Parent f0609941aa9825942ce4d359873e0b47c63b2516 rename "sound" to "document" diff -r f0609941aa98 -r acfeddc7821d cms/app-client/app/adapters/application.js --- a/cms/app-client/app/adapters/application.js Wed Jan 20 15:53:27 2016 +0100 +++ b/cms/app-client/app/adapters/application.js Wed Jan 20 23:05:52 2016 +0100 @@ -1,17 +1,8 @@ import DS from 'ember-data'; + export { default } from 'ember-data-fixture-adapter'; -// export default DS.FixtureAdapter.extend({ -// host: 'http://127.0.0.1', -// namespace: 'api', -// queryFixtures: function(records, query) { -// return records.filter(function(record) { -// for(var key in query) { -// if (!query.hasOwnProperty(key)) { continue; } -// var value = query[key]; -// if (record[key] !== value) { return false; } -// } -// return true; -// }); -// } +// export default DS.RESTAdapter.extend({ +// host: 'http://int.corpusdelaparole.huma-num.fr/corpus', +// namespace: 'api/v1', // }); diff -r f0609941aa98 -r acfeddc7821d cms/app-client/app/components/player-component.js --- a/cms/app-client/app/components/player-component.js Wed Jan 20 15:53:27 2016 +0100 +++ b/cms/app-client/app/components/player-component.js Wed Jan 20 23:05:52 2016 +0100 @@ -5,11 +5,11 @@ currentTime: "00:00", duration: "00:00", - _soundChanged: Ember.observer('sound', function() { + _documentChanged: Ember.observer('document', function() { this.pause(); this.changeTime(0); this.updateProgress(0); - this.audio.src = this.get("sound").get("master"); + this.audio.src = this.get("document").get("master"); this.audio.load(); this.set("currentTime", "00:00"); }), @@ -110,7 +110,7 @@ this.play(); } }, - prevNextSong(change){ + prevNextDocument(change){ this.sendAction("action", change); } } diff -r f0609941aa98 -r acfeddc7821d cms/app-client/app/components/visu-carto.js --- a/cms/app-client/app/components/visu-carto.js Wed Jan 20 15:53:27 2016 +0100 +++ b/cms/app-client/app/components/visu-carto.js Wed Jan 20 23:05:52 2016 +0100 @@ -114,7 +114,7 @@ var areaList = []; var count = {}; area.svg.g.path.map(function(elt, index){ - var length = _this.get("sounds").filterBy("spatial", elt.title).toArray().length; + var length = _this.get("documents").filterBy("spatial", elt.title).toArray().length; if (length > 0) count[elt.id]= length; }); diff -r f0609941aa98 -r acfeddc7821d cms/app-client/app/controllers/application.js --- a/cms/app-client/app/controllers/application.js Wed Jan 20 15:53:27 2016 +0100 +++ b/cms/app-client/app/controllers/application.js Wed Jan 20 23:05:52 2016 +0100 @@ -10,37 +10,37 @@ isShowingModal: false, currentDetails: null, currentItem: {title: "example", master: 'http://www.noiseaddicts.com/samples_1w72b820/3921.mp3'}, - filteredSounds: Ember.computed('location', 'langue', 'discours', 'date', 'thematique', 'model', function() { + filteredDocuments: Ember.computed('location', 'langue', 'discours', 'date', 'thematique', 'model', function() { var location = this.get('location'); var langue = this.get('langue'); var discours = this.get('discours'); var date = this.get('date'); var thematique = this.get('thematique'); - var sounds = this.get('model'); + var documents = this.get('model'); if (location) { - sounds = sounds.filterBy('spatial', location); + documents = documents.filterBy('spatial', location); } if (langue) { - sounds = sounds.filterBy('language', langue); + documents = documents.filterBy('language', langue); } if (discours) { - sounds = sounds.filterBy('type', discours); + documents = documents.filterBy('type', discours); } if (date.length > 0) { - var temp = sounds; - sounds.map(function(elt){ + var temp = documents; + documents.map(function(elt){ if (date.indexOf(elt.get('created')) === -1){ temp = temp.without(elt); } }); - sounds = temp; + documents = temp; } if (thematique) { - sounds = sounds.filterBy('thematique', thematique); + documents = documents.filterBy('thematique', thematique); } - return sounds; + return documents; }), currentItemChanged: Ember.observer('currentItem', function() { Ember.$(".result-item").toggleClass("playing", false); @@ -61,15 +61,15 @@ this.set(query, newParams); }, - changeSong: function(songDirection){ - var direction = (songDirection === "next") ? 1 : -1; - var index = this.get("filteredSounds").indexOf(this.get("currentItem")); + changeDocument: function(docDirection){ + var direction = (docDirection === "next") ? 1 : -1; + var index = this.get("filteredDocuments").indexOf(this.get("currentItem")); if ( index !== -1){ - if (typeof(this.get("filteredSounds").objectAt(index+direction)) !== 'undefined'){ - return this.set('currentItem', this.get("filteredSounds").objectAt(index+direction)); + if (typeof(this.get("filteredDocuments").objectAt(index+direction)) !== 'undefined'){ + return this.set('currentItem', this.get("filteredDocuments").objectAt(index+direction)); } } - return this.set('currentItem', this.get('filteredSounds').get('firstObject')); + return this.set('currentItem', this.get('filteredDocuments').get('firstObject')); }, play: function(item){ this.set("currentItem", item); diff -r f0609941aa98 -r acfeddc7821d cms/app-client/app/models/document.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cms/app-client/app/models/document.js Wed Jan 20 23:05:52 2016 +0100 @@ -0,0 +1,184 @@ +import DS from 'ember-data'; +import Ember from 'ember'; + +var Document = DS.Model.extend({ + // id: DS.attr('string'), + uri: DS.attr('string'), + title: DS.attr('string'), + language: DS.attr('string'), + publishers: DS.attr({defaultValue: []}), + contributors: DS.attr({defaultValue: []}), + mediaArray: DS.attr({defaultValue: []}), + mediaList: Ember.computed('mediaArray', function() { + var res = []; + var mp3 = null; + Ember.$.forEach(this.get('mediaArray'), function(m) { + if(m.format === 'audio/mpeg') { + mp3 = m; + } else if (m.format.startsWith('audio/')) { + res.push(m); + } + }); + if(mp3) { + res.unshift(mp3); + } + return res; + }) +}); + +Document.reopenClass({ + FIXTURES: [ + { + "id": "crdo-09-CAYCHAX_SOUND", + "uri": "http://purl.org/poi/corpusdelaparole.huma-num.fr/crdo-09-CAYCHAX_SOUND", + "title": "ALLOc : Caychax : Parabole", + "language": "http://lexvo.org/id/iso639-3/oci", + "modified": "2010-10-25T18:16:38+02:00", + "publishers": [ ], + "contributors": [ ], + "mediaArray": [ ] + }, + { + "id": "crdo-09-DUN_SOUND", + "uri": "http://purl.org/poi/corpusdelaparole.huma-num.fr/crdo-09-DUN_SOUND", + "title": "ALLOc : Dun : Parabole", + "language": "http://lexvo.org/id/iso639-3/oci", + "modified": "2010-10-25T18:18:23+02:00", + "publishers": [ ], + "contributors": [ ], + "mediaArray": [ ] + }, + { + "id": "crdo-09-LABASTIDE-DE-LORDAT_SOUND", + "uri": "http://purl.org/poi/corpusdelaparole.huma-num.fr/crdo-09-LABASTIDE-DE-LORDAT_SOUND", + "title": "ALLOc : La Bastide-de-Lordat : Parabole", + "language": "http://lexvo.org/id/iso639-3/oci", + "modified": "2010-10-25T18:20:08+02:00", + "publishers": [ ], + "contributors": [ ], + "mediaArray": [ ] + }, + { + "id": "crdo-09-LOUBENS_SOUND", + "uri": "http://purl.org/poi/corpusdelaparole.huma-num.fr/crdo-09-LOUBENS_SOUND", + "title": "ALLOc : Loubens : Parabole", + "language": "http://lexvo.org/id/iso639-3/oci", + "modified": "2010-10-25T18:21:23+02:00", + "publishers": [ ], + "contributors": [ ], + "mediaArray": [ ] + }, + { + "id": "crdo-09-MERENS-LES-VALS_SOUND", + "uri": "http://purl.org/poi/corpusdelaparole.huma-num.fr/crdo-09-MERENS-LES-VALS_SOUND", + "title": "ALLOc : Mérens-les-Vals : Parabole", + "language": "http://lexvo.org/id/iso639-3/oci", + "modified": "2010-10-25T18:22:24+02:00", + "publishers": [ ], + "contributors": [ ], + "mediaArray": [ ] + }, + { + "id": "crdo-09-MONTSEGUR_SOUND", + "uri": "http://purl.org/poi/corpusdelaparole.huma-num.fr/crdo-09-MONTSEGUR_SOUND", + "title": "ALLOc : Montségur : Parabole", + "language": "http://lexvo.org/id/iso639-3/oci", + "modified": "2010-10-25T18:23:14+02:00", + "publishers": [ ], + "contributors": [ ], + "mediaArray": [ ] + }, + { + "id": "crdo-09-PRAYOLS_SOUND", + "uri": "http://purl.org/poi/corpusdelaparole.huma-num.fr/crdo-09-PRAYOLS_SOUND", + "title": "ALLOc : Prayols : Parabole", + "language": "http://lexvo.org/id/iso639-3/oci", + "modified": "2010-10-25T18:24:06+02:00", + "publishers": [ ], + "contributors": [ ], + "mediaArray": [ ] + }, + { + "id": "crdo-09-QUERIGUT_SOUND", + "uri": "http://purl.org/poi/corpusdelaparole.huma-num.fr/crdo-09-QUERIGUT_SOUND", + "title": "ALLOc : Quérigut : Parabole", + "language": "http://lexvo.org/id/iso639-3/oci", + "modified": "2010-10-25T18:24:56+02:00", + "publishers": [ ], + "contributors": [ ], + "mediaArray": [ ] + }, + { + "id": "crdo-09-SIGUER_SOUND", + "uri": "http://purl.org/poi/corpusdelaparole.huma-num.fr/crdo-09-SIGUER_SOUND", + "title": "ALLOc : Siguer : Parabole", + "language": "http://lexvo.org/id/iso639-3/oci", + "modified": "2010-10-25T18:25:51+02:00", + "publishers": [ ], + "contributors": [ ], + "mediaArray": [ ] + }, + { + "id": "crdo-09-ST-MARTIN-D-OYDES_SOUND", + "uri": "http://purl.org/poi/corpusdelaparole.huma-num.fr/crdo-09-ST-MARTIN-D-OYDES_SOUND", + "title": "ALLOc : Saint-Martin-d'Oydes : Parabole", + "language": "http://lexvo.org/id/iso639-3/oci", + "modified": "2010-10-25T18:26:22+02:00", + "publishers": [ ], + "contributors": [ ], + "mediaArray": [ ] + }, + { + "id": "crdo-09-SURBA_SOUND", + "uri": "http://purl.org/poi/corpusdelaparole.huma-num.fr/crdo-09-SURBA_SOUND", + "title": "ALLOc : Surba : Parabole", + "language": "http://lexvo.org/id/iso639-3/oci", + "modified": "2010-10-25T18:26:42+02:00", + "publishers": [ ], + "contributors": [ ], + "mediaArray": [ ] + }, + { + "id": "crdo-11-GRAMAZIE_SOUND", + "uri": "http://purl.org/poi/corpusdelaparole.huma-num.fr/crdo-11-GRAMAZIE_SOUND", + "title": "ALLOc : Gramazie : Parabole", + "language": "http://lexvo.org/id/iso639-3/oci", + "modified": "2010-10-25T18:27:39+02:00", + "publishers": [ ], + "contributors": [ ], + "mediaArray": [ ] + }, + { + "id": "crdo-11-MOLLEVILLE_SOUND", + "uri": "http://purl.org/poi/corpusdelaparole.huma-num.fr/crdo-11-MOLLEVILLE_SOUND", + "title": "ALLOc : Molleville : Parabole", + "language": "http://lexvo.org/id/iso639-3/oci", + "modified": "2010-10-25T18:28:06+02:00", + "publishers": [ ], + "contributors": [ ], + "mediaArray": [ ] + }, + { + "id": "crdo-11-PUIVERT_SOUND", + "uri": "http://purl.org/poi/corpusdelaparole.huma-num.fr/crdo-11-PUIVERT_SOUND", + "title": "ALLOc : Puivert : Parabole", + "language": "http://lexvo.org/id/iso639-3/oci", + "modified": "2010-10-25T18:28:40+02:00", + "publishers": [ ], + "contributors": [ ], + "mediaArray": [ ] + }, + { + "id": "crdo-11-RIBOUISSE_SOUND", + "uri": "http://purl.org/poi/corpusdelaparole.huma-num.fr/crdo-11-RIBOUISSE_SOUND", + "title": "ALLOc : Ribouisse : Parabole", + "language": "http://lexvo.org/id/iso639-3/oci", + "modified": "2010-10-25T18:29:32+02:00", + "publishers": [ ], + "contributors": [ ], + "mediaArray": [ ] + } + ] +}); + +export default Document; diff -r f0609941aa98 -r acfeddc7821d cms/app-client/app/router.js --- a/cms/app-client/app/router.js Wed Jan 20 15:53:27 2016 +0100 +++ b/cms/app-client/app/router.js Wed Jan 20 23:05:52 2016 +0100 @@ -6,6 +6,7 @@ }); Router.map(function() { + // this.route('application', { path: '/detail/:document_id' }); this.route('tabs/langues', { path: '/langues' }); this.route('tabs/carto', { path: '/cartographie' }); this.route('tabs/thematiques', { path: '/thematiques' }); diff -r f0609941aa98 -r acfeddc7821d cms/app-client/app/routes/application.js --- a/cms/app-client/app/routes/application.js Wed Jan 20 15:53:27 2016 +0100 +++ b/cms/app-client/app/routes/application.js Wed Jan 20 23:05:52 2016 +0100 @@ -19,7 +19,7 @@ return value; }, model() { - return this.store.findAll('sound'); + return this.store.findAll('document'); }, actions: { willTransition: function(transition) { diff -r f0609941aa98 -r acfeddc7821d cms/app-client/app/templates/application.hbs --- a/cms/app-client/app/templates/application.hbs Wed Jan 20 15:53:27 2016 +0100 +++ b/cms/app-client/app/templates/application.hbs Wed Jan 20 23:05:52 2016 +0100 @@ -10,3 +10,19 @@ {{partial "results"}} + +{{#if isShowingModal}} + {{#ember-wormhole to='info-modal'}} +
+
+

{{currentDetails.title}}

+

Description: {{currentDetails.description}}

+

Interviewer: {{currentDetails.interviewer}}

+

Type de Discours: {{currentDetails.type}}

+

Localisation: {{currentDetails.spatial}}

+

Langue: {{currentDetails.language}}

+

Date de Creation: {{currentDetails.created}}

+ +
+ {{/ember-wormhole}} +{{/if}} diff -r f0609941aa98 -r acfeddc7821d cms/app-client/app/templates/components/player-component.hbs --- a/cms/app-client/app/templates/components/player-component.hbs Wed Jan 20 15:53:27 2016 +0100 +++ b/cms/app-client/app/templates/components/player-component.hbs Wed Jan 20 23:05:52 2016 +0100 @@ -1,5 +1,5 @@
- +
Play
@@ -9,7 +9,7 @@
- +

diff -r f0609941aa98 -r acfeddc7821d cms/app-client/app/templates/player.hbs --- a/cms/app-client/app/templates/player.hbs Wed Jan 20 15:53:27 2016 +0100 +++ b/cms/app-client/app/templates/player.hbs Wed Jan 20 23:05:52 2016 +0100 @@ -1,6 +1,6 @@

- {{player-component action="changeSong" sound=currentItem}} + {{player-component action="changeDocument" document=currentItem}}

Title: {{ currentItem.title }} diff -r f0609941aa98 -r acfeddc7821d cms/app-client/app/templates/results.hbs --- a/cms/app-client/app/templates/results.hbs Wed Jan 20 15:53:27 2016 +0100 +++ b/cms/app-client/app/templates/results.hbs Wed Jan 20 23:05:52 2016 +0100 @@ -22,7 +22,7 @@

- {{#each filteredSounds as |item| }} + {{#each filteredDocuments as |item| }}
{{ item.title }} - {{item.interviewer}} @@ -32,19 +32,4 @@
{{/each}} - {{#if isShowingModal}} - {{#ember-wormhole to='info-modal'}} -
-
-

{{currentDetails.title}}

-

Description: {{currentDetails.description}}

-

Interviewer: {{currentDetails.interviewer}}

-

Type de Discours: {{currentDetails.type}}

-

Localisation: {{currentDetails.spatial}}

-

Langue: {{currentDetails.language}}

-

Date de Creation: {{currentDetails.created}}

- -
- {{/ember-wormhole}} - {{/if}}
diff -r f0609941aa98 -r acfeddc7821d cms/app-client/app/templates/tabs/carto.hbs --- a/cms/app-client/app/templates/tabs/carto.hbs Wed Jan 20 15:53:27 2016 +0100 +++ b/cms/app-client/app/templates/tabs/carto.hbs Wed Jan 20 23:05:52 2016 +0100 @@ -1,1 +1,1 @@ -{{visu-carto action="updateUrl" sounds=model}} +{{visu-carto action="updateUrl" documents=model}}