Merge
authorChloe Laisne <chloe.laisne@gmail.com>
Sun, 16 Oct 2016 23:19:57 +0530
changeset 339 766af1228b05
parent 338 4a3899b6a7ed (diff)
parent 330 8a29098c8273 (current diff)
child 340 f0f3888734bb
Merge
cms/app-client/app/controllers/application.js
cms/app-client/app/services/constants.js
cms/app-client/app/templates/components/notice-component.hbs
cms/app-client/app/templates/components/player-component.hbs
cms/app-client/app/templates/components/playlist-component.hbs
--- a/cms/app-client/app/components/notice-component.js	Fri Oct 14 01:28:34 2016 +0200
+++ b/cms/app-client/app/components/notice-component.js	Sun Oct 16 23:19:57 2016 +0530
@@ -3,6 +3,7 @@
 export default Ember.Component.extend({
 
     player: Ember.inject.service(),
+    filter: Ember.inject.service(),
 
     classNames: ['notice-component'],
 
@@ -61,8 +62,12 @@
 
     actions: {
 
-        close: function() {
-            this.set('model', null);
+        addThemeFilter: function(id) {
+            this.get('filter').set('theme', id);
+        },
+
+        addLanguageFilter: function(id) {
+            this.get('filter').set('language', id);
         }
 
     }
--- a/cms/app-client/app/components/playlist-component.js	Fri Oct 14 01:28:34 2016 +0200
+++ b/cms/app-client/app/components/playlist-component.js	Sun Oct 16 23:19:57 2016 +0530
@@ -20,6 +20,22 @@
         }
     }).on('init'),
 
+    playerItemObserver: Ember.observer('player.item', function() {
+        if(this.$() && this.get('player').get('item')) {
+            var ul = this.$().find('ul');
+            var li = this.$().find('li#' + this.get('player').get('item').replace('.', '\\.').replace('/', '\\/'));
+            if(li.offset().top - ul.offset().top < 0) {
+                ul.animate({
+                    'scrollTop': ul.scrollTop() + li.offset().top - ul.offset().top
+                });
+            } else if(li.offset().top + li.outerHeight() - ul.offset().top > ul.outerHeight()) {
+                ul.animate({
+                    'scrollTop': ul.scrollTop() + li.offset().top  + li.outerHeight() - ul.offset().top  - ul.height()
+                });
+            }
+        }
+    }),
+
     init: function() {
         this._super(...arguments);
     },
@@ -48,14 +64,10 @@
         },
 
         displayNotice: function(id) {
-            if(this.get('player').get('item') === id) {
+            if(this.get('player').get('window') !== 'notice') {
                 this.get('player').displayMetadata('notice');
             } else {
-                if(this.get('notice') !== id) {
-                    this.set('notice', id);
-                } else {
-                    this.set('notice', null);
-                }
+                this.get('player').displayMetadata(false);
             }
 
         }
--- a/cms/app-client/app/components/sorting-component.js	Fri Oct 14 01:28:34 2016 +0200
+++ b/cms/app-client/app/components/sorting-component.js	Sun Oct 16 23:19:57 2016 +0530
@@ -19,9 +19,11 @@
         this.$('ul').on('scroll', Ember.run.bind(this, this.scrolling));
     }),
     scrolling: function(event) {
-        if(Ember.$(event.target).scrollTop() + Ember.$(event.target).height() > Ember.$(event.target).get(0).scrollHeight - 50) {
-            this.triggerAction({ action:'loadMore', target: this });
-            Ember.$(event.target).off('scroll');
+        if(Ember.$(event.target).scrollTop() !== 0 ) {
+            if(Ember.$(event.target).scrollTop() + Ember.$(event.target).height() > Ember.$(event.target).get(0).scrollHeight - 50) {
+                this.triggerAction({ action:'loadMore', target: this });
+                Ember.$(event.target).off('scroll');
+            }
         }
     },
 
--- a/cms/app-client/app/components/visu-carto.js	Fri Oct 14 01:28:34 2016 +0200
+++ b/cms/app-client/app/components/visu-carto.js	Sun Oct 16 23:19:57 2016 +0530
@@ -4,6 +4,8 @@
 
 export default Ember.Component.extend({
 
+    constants: Ember.inject.service(),
+
     map: null,
 
     continentsMapVar: AmCharts.maps.continentsLow,
@@ -21,7 +23,7 @@
     filter: Ember.inject.service(),
     locationObserver: Ember.observer('filter.location', function() {
         if(!this.get('filter').get('location')) {
-            this.sendAction('setLocation', '6295630');
+            this.sendAction('setLocation', this.get('constants').GEONAMES['world']);
         }
     }),
 
@@ -30,7 +32,7 @@
         if(this.get('map')) {
             if(this.get('map').selectedObject.id) {
                 if(this.get('map').selectedObject.parentObject.mapVar === this.get('countriesMapVar')) {
-                    if(this.get('map').selectedObject.id === '3017382') {
+                    if(this.get('map').selectedObject.id === this.get('constants').GEONAMES['france']) {
                         this.setFranceAreas();
                         this.set('dataProvider', {
                             'mapVar': this.get('franceMapVar'),
--- a/cms/app-client/app/controllers/application.js	Fri Oct 14 01:28:34 2016 +0200
+++ b/cms/app-client/app/controllers/application.js	Sun Oct 16 23:19:57 2016 +0530
@@ -22,7 +22,9 @@
 
     filter: Ember.inject.service(),
     setFilter: Ember.observer('discourse', 'language', 'location', 'theme', function(sender, key) {
-        this.get('filter').set(key, this.get(key));
+        if(this.get('filter').get(key) !== this.get(key)) {
+            this.get('filter').set(key, this.get(key));    
+        }
     }),
     filterObserver: Ember.observer('filter.discourse', 'filter.language', 'filter.location', 'filter.theme', function(sender, key) {
         key = key.split('.').pop();
--- a/cms/app-client/app/router.js	Fri Oct 14 01:28:34 2016 +0200
+++ b/cms/app-client/app/router.js	Sun Oct 16 23:19:57 2016 +0530
@@ -10,9 +10,11 @@
 
     didTransition:function() {
     	this.get('player').toggleVideoscreen(false);
-    	this.get('player').displayMetadata(false);
+    	this.get('player').displayMetadata(this.get('player').get('window'));
+
     	this._super(...arguments);
     }
+
 });
 
 Router.map(function() {
--- a/cms/app-client/app/routes/tabs/carto.js	Fri Oct 14 01:28:34 2016 +0200
+++ b/cms/app-client/app/routes/tabs/carto.js	Sun Oct 16 23:19:57 2016 +0530
@@ -2,7 +2,16 @@
 
 export default Ember.Route.extend({
 
-    modelQueryParam: '6295630',
+    constants: Ember.inject.service(),
+    player: Ember.inject.service(),
+
+    modelQueryParam: '',
+
+    init: function() {
+        this._super(...arguments);
+
+        this.set('modelQueryParam', this.get('constants').GEONAMES['world']);
+    },
 
     model: function() {
         return this.store.query('geostat', {
@@ -11,8 +20,12 @@
         });
     },
 
+    activate: function() {
+        this.get('player').set('window', false);
+    },
+
     deactivate: function () {
-        this.set('modelQueryParam', '6295630');
+        this.set('modelQueryParam', this.get('constants').GEONAMES['world']);
     },
 
     setupController: function(controller) {
--- a/cms/app-client/app/routes/tabs/chrono.js	Fri Oct 14 01:28:34 2016 +0200
+++ b/cms/app-client/app/routes/tabs/chrono.js	Sun Oct 16 23:19:57 2016 +0530
@@ -1,4 +1,11 @@
 import Ember from 'ember';
 
 export default Ember.Route.extend({
+
+	player: Ember.inject.service(),
+
+    activate: function() {
+        this.get('player').set('window', false);
+    }
+
 });
--- a/cms/app-client/app/routes/tabs/discours.js	Fri Oct 14 01:28:34 2016 +0200
+++ b/cms/app-client/app/routes/tabs/discours.js	Sun Oct 16 23:19:57 2016 +0530
@@ -1,4 +1,11 @@
 import Ember from 'ember';
 
 export default Ember.Route.extend({
+
+	player: Ember.inject.service(),
+	
+	activate: function() {
+        this.get('player').set('window', false);
+    }
+
 });
\ No newline at end of file
--- a/cms/app-client/app/routes/tabs/thematiques.js	Fri Oct 14 01:28:34 2016 +0200
+++ b/cms/app-client/app/routes/tabs/thematiques.js	Sun Oct 16 23:19:57 2016 +0530
@@ -2,6 +2,8 @@
 
 export default Ember.Route.extend({
 
+    player: Ember.inject.service(),
+
     index: 0,
     limit: 40,
     sort: 'alphabetical',
@@ -29,6 +31,14 @@
         controller.set('themes', this.get('themes'));
     },
 
+    deactivate: function () {
+        this.set('themes', []);
+    },
+
+    activate: function() {
+        this.get('player').set('window', false);
+    },
+
     actions: {
 
         setIndexQueryparams: function() {
@@ -37,11 +47,15 @@
 
         setSortQueryparams: function(sort) {
             this.set('sort', sort);
-            this.get('themes').replaceContent(0, this.get('themes').get('content').length, null);
-            // Force property reset to trigger request.
-            this.propertyWillChange('index');
-            this.set('index', 0);
-            this.propertyDidChange('index');            
+            this.get('themes').get('content').clear();
+            if(this.get('index') === 0) {
+                // Force property reset to trigger request
+                this.propertyWillChange('index');
+                this.set('index', 0);
+                this.propertyDidChange('index');
+            } else {
+                this.set('index', 0);
+            }
         }
         
     }
--- a/cms/app-client/app/services/constants.js	Fri Oct 14 01:28:34 2016 +0200
+++ b/cms/app-client/app/services/constants.js	Sun Oct 16 23:19:57 2016 +0530
@@ -1,5 +1,10 @@
 import Ember from 'ember';
 
+const GEONAMES = {
+  'world': '6295630',
+  'france': '3017382'
+};
+
 const OLAC_ROLES = {
   'http://www.language-archives.org/OLAC/1.1/annotator': 'bo.olac_role_annotator',
   'http://www.language-archives.org/OLAC/1.1/author': 'bo.olac_role_author',
@@ -310,6 +315,7 @@
   OLAC_ROLES: OLAC_ROLES,
   DISCOURSE_CATEGORY_KEYS: DISCOURSE_CATEGORY_KEYS,
   DISCOURSE_CATEGORY_VALUES: DISCOURSE_CATEGORY_VALUES,
+  GEONAMES: GEONAMES,
   KEY_CODES: KEY_CODES,
   VIAF_BASE_URL: "http://viaf.org/viaf/",
   LEXVO_BASE_URL: "http://lexvo.org/id/iso639-3/",
--- a/cms/app-client/app/services/player.js	Fri Oct 14 01:28:34 2016 +0200
+++ b/cms/app-client/app/services/player.js	Sun Oct 16 23:19:57 2016 +0530
@@ -20,12 +20,16 @@
         if(el === 'video') {
             this.toggleVideoscreen();
         } else {
-            this.displayMetadata(el);
+            if(this.get('window') !== el) {
+                this.displayMetadata(el);
+            } else {
+                this.displayMetadata(false);
+            }
         }
     },
 
     displayMetadata: function(el) {
-         if(this.get('window') !== el) {
+         if(typeof el !== 'undefined') {
             this.set('window', el);
         } else {
             this.set('window', false);
--- a/cms/app-client/app/styles/components/notice-component.scss	Fri Oct 14 01:28:34 2016 +0200
+++ b/cms/app-client/app/styles/components/notice-component.scss	Sun Oct 16 23:19:57 2016 +0530
@@ -7,11 +7,27 @@
     color: $dark-grey;
 }
 
-.notice-component a {
+.notice-component a.fa {
+    text-decoration: none;
+    color: inherit;
+    font-size: 0px;
+    margin-left: 5px;
+}
+
+.notice-component a.fa:before {
+    font-size: 12px;
+}
+
+.notice-component .action {
+    cursor: pointer;
+}
+
+.notice-component a.doc-link-bnf, 
+.notice-component a.doc-link-lexvo {
     cursor: pointer;
     color: $dark-grey;
     text-decoration: none;
-    border-bottom: 1px dashed $dark-grey;
+    pointer-events: none;
 }
 
 .notice-component .language a {
--- a/cms/app-client/app/styles/components/player-component.scss	Fri Oct 14 01:28:34 2016 +0200
+++ b/cms/app-client/app/styles/components/player-component.scss	Sun Oct 16 23:19:57 2016 +0530
@@ -203,15 +203,18 @@
     margin: 0 auto;
 }
 
-.player-component #audio .controls.extra i.fa-bars {
+.player-component #audio .controls.extra i.fa-text-height {
     position: relative;
+    overflow: hidden;
+    display: inline-block;
+    width: 16px;
 }
 
-.player-component #audio .controls.extra i.fa-bars::before {
+.player-component #audio .controls.extra i.fa-text-height::before {
     font-size: 21px;
 }
 
-.player-component #audio .controls.extra i.fa-bars.active::before {
+.player-component #audio .controls.extra i.fa-text-height.active::before {
     color: $blue;
 }
 
--- a/cms/app-client/app/styles/components/playlist-component.scss	Fri Oct 14 01:28:34 2016 +0200
+++ b/cms/app-client/app/styles/components/playlist-component.scss	Sun Oct 16 23:19:57 2016 +0530
@@ -18,6 +18,7 @@
     font-size: 0px;
     overflow-y: scroll;
     background-color: $light-white;
+    position: relative;
 }
 
 .playlist-component ul li {
@@ -47,9 +48,14 @@
     float: right;
     text-align: right;
     font-size: 0px;
+    margin-left: 20px;
 }
 
-.playlist-component ul li .tools button,
+.playlist-component ul li .tools > * {
+    clear: both;
+}
+
+.playlist-component ul li .tools .notice,
 .playlist-component ul li .tools .fa {
     border: 1px solid $dark-grey;
     cursor: pointer;
@@ -57,56 +63,54 @@
     pointer-events: all;
 }
 
-.playlist-component ul li.playing .tools button,
+.playlist-component ul li.playing .tools .notice,
 .playlist-component ul li.playing .tools .fa {
     border-color: $medium-blue;
 }
 
-.playlist-component ul li.notice .tools button,
+.playlist-component ul li.notice .tools .notice,
 .playlist-component ul li.notice .tools .fa {
     border-color: $dark-grey;
 }
 
-.playlist-component ul li .tools button.active,
-.playlist-component ul li .tools button:hover,
+.playlist-component ul li .tools .notice.active,
+.playlist-component ul li .tools .notice:hover,
 .playlist-component ul li .tools .fa:hover {
     background-color: $dark-grey;
     color: $light-white;
 }
 
-.playlist-component ul li.playing .tools button.active,
-.playlist-component ul li.playing .tools button:hover,
+.playlist-component ul li .tools .fa.active,
+.playlist-component ul li.playing .tools .notice.active,
+.playlist-component ul li.playing .tools .notice:hover,
 .playlist-component ul li.playing .tools .fa:hover {
     background-color: $medium-blue;
     color: $light-blue;
 }
 
-.playlist-component ul li.playing .tools button:hover,
+.playlist-component ul li.playing .tools .notice:hover,
 .playlist-component ul li.playing .tools .fa:hover {
     color: $light-blue;
 }
 
-.playlist-component ul li:not(.playing) .fa-bars {
+.playlist-component ul li:not(.playing) .notice,
+.playlist-component ul li:not(.playing) .fa-share-alt,
+.playlist-component ul li:not(.playing) .fa-text-height {
     pointer-events: none;
     cursor: default;
     opacity: 0.5;
 }
 
-.playlist-component ul li .meta {
-    padding-right: 78px;
-}
-
 .playlist-component ul li .meta p {
     margin: 0;
 }
 
-.playlist-component ul li .tools button {
+.playlist-component ul li .tools .notice {
     font-size: 12px;
     background-color: transparent;
     line-height: 20px;
     padding: 0 10px;
     margin-top: 10px;
-    display: block;
     width: 68px;
 }
 
@@ -120,6 +124,11 @@
     display: inline-block;
 }
 
+.playlist-component ul li .tools .fa-play,
+.playlist-component ul li .tools .fa-pause {
+    float: right;
+}
+
 .playlist-component ul li .tools .fa-play::before {
     margin-left: 3px;
 }
@@ -145,12 +154,15 @@
     float: right;
 }
 
-.playlist-component ul li .title .fa-bars {
-    margin-right: 10px;
+.playlist-component ul li .fa-text-height {
+    
 }
 
-.playlist-component ul li .title .fa-bars::before {
-    font-size: 14px;
+.playlist-component ul li .fa-text-height::before {
+    font-size: 13px;
+    display: inline-block;
+    overflow: hidden;
+    width: 10px;
 }
 
 .playlist-component ul li .language a {
--- a/cms/app-client/app/styles/components/toolbar-component.scss	Fri Oct 14 01:28:34 2016 +0200
+++ b/cms/app-client/app/styles/components/toolbar-component.scss	Sun Oct 16 23:19:57 2016 +0530
@@ -32,5 +32,6 @@
 .toolbar-component ul li.active {
     border-left-color: $dark-blue;
     background-color: $light-white;
+    pointer-events: none;
     color: $dark-blue;
 }
\ No newline at end of file
--- a/cms/app-client/app/templates/application.hbs	Fri Oct 14 01:28:34 2016 +0200
+++ b/cms/app-client/app/templates/application.hbs	Sun Oct 16 23:19:57 2016 +0530
@@ -2,12 +2,6 @@
 
 <div class="corpus-window">
 
-    {{#if notice}}
-    <div class="corpus-app-modal">
-        {{ notice-component class="overlay" model=noticeModel }}
-    </div>
-    {{/if}}
-
     <div class="corpus-app-container{{if player.window ' window'}}">
     {{#if player.window}}
         {{#if (eq player.window 'notice')}}
--- a/cms/app-client/app/templates/components/notice-component.hbs	Fri Oct 14 01:28:34 2016 +0200
+++ b/cms/app-client/app/templates/components/notice-component.hbs	Sun Oct 16 23:19:57 2016 +0530
@@ -1,7 +1,3 @@
-{{#if model}}
-<i class="fa fa-close" {{action 'close'}}>Close</i>
-{{/if}}
-
 <h2>Notice</h2>
 <h3>{{ item.title }}</h3>
 <table>
@@ -17,7 +13,7 @@
 </tr>
 <tr>
 	<td class="title">Langue</td>
-	<td>{{#each item.languages as |lang index|}}{{if index ", "}}{{doc-language url=lang class="language"}}{{/each}}</td>
+	<td>{{#each item.languages as |lang index|}}{{if index ", "}}<span class="action" {{action 'addLanguageFilter' lang}}>{{ doc-language url=lang class="language"}}</span><a href="{{lang}}" target="_blank" class="fa fa-share-square">Share</a>{{/each}}</td>
 </tr>
 <tr>
 	<td class="title">Sujet{{#if (if-operator item.computedSubjects.length '>' 1)}}s{{/if}}</td>
@@ -26,9 +22,12 @@
 		{{#each subjects as |subject|}}
 			<li>
 			{{#if subject.url}}
-				<a href="{{subject.url}}" target="_blank">
-					{{#if subject.name}}{{subject.name}}{{else}}{{component (getLinkType subject.url) url=subject.url}}{{/if}}
-				</a>
+				{{#if subject.name}}
+					{{subject.name}}
+				{{else}}
+					<span class="action" {{action 'addThemeFilter' subject.url}}>{{component (getLinkType subject.url) url=subject.url}}</span>
+				{{/if}}
+				<a href="{{subject.url}}" target="_blank" class="fa fa-share-square">Share</a>
 			{{else}}
 				{{subject.name}}
 			{{/if}}
--- a/cms/app-client/app/templates/components/player-component.hbs	Fri Oct 14 01:28:34 2016 +0200
+++ b/cms/app-client/app/templates/components/player-component.hbs	Sun Oct 16 23:19:57 2016 +0530
@@ -22,7 +22,7 @@
 		{{/if}}
 	{{/if}}
 	{{#if player.transcript}}
-		<i title="Transcript" class="fa fa-bars{{if (eq player.window 'transcript') ' active'}}" {{action 'display' 'transcript'}}>Transcript</i>
+		<i title="Transcript" class="fa fa-text-height{{if (eq player.window 'transcript') ' active'}}" {{action 'display' 'transcript'}}>Transcript</i>
 	{{/if}}
 	</div>
 	<div class="meta">
--- a/cms/app-client/app/templates/components/playlist-component.hbs	Fri Oct 14 01:28:34 2016 +0200
+++ b/cms/app-client/app/templates/components/playlist-component.hbs	Sun Oct 16 23:19:57 2016 +0530
@@ -3,15 +3,22 @@
     {{#each documents as |document| }}
     <li id="{{document.id}}" class="{{if (eq player.item document.id) 'playing'}}{{if (eq document.id notice) 'notice'}}" {{action 'select' document.id}}>
         <div class="tools">
+            <div>
             {{#if document.transcript_url}}
-                <i title="Transcript" class="fa fa-bars{{if (ifOr (eq player.window 'transcript') (eq player.item document.id)) ' active'}}"{{action 'displayTranscript'}}>Transcript</i>
+                <i title="Transcript" class="fa fa-text-height{{if (ifAnd (eq player.window 'transcript') (eq player.item document.id)) ' active'}}"{{action 'displayTranscript'}}>Transcript</i>
             {{/if}}
             {{#if (ifAnd (eq player.playing true) (eq player.item document.id))}}
-                <i class="fa fa-pause" {{ action 'pause' }}>Pause</i>
+                <i title="Pause" class="fa fa-pause" {{ action 'pause' }}>Pause</i>
             {{else}}
-                <i class="fa fa-play" {{ action 'play' document.id }}>Play</i>
+                <i title="Play" class="fa fa-play" {{ action 'play' document.id }}>Play</i>
             {{/if}}
-            <button{{action 'displayNotice' document.id bubbles=false}} class="{{if (ifOr (ifAnd (eq player.window 'notice') (eq player.item document.id)) (eq document.id notice)) 'active'}}">Notice</button>
+            </div>
+            <div>
+                <button title="Notice" {{action 'displayNotice' document.id}} class="notice{{if (ifOr (ifAnd (eq player.window 'notice') (eq player.item document.id)) (eq document.id notice)) ' active'}}">
+                    Notice
+                </button>
+                <i title="Share notice" class="fa fa-share-alt">Share notice</i>
+            </div>
         </div>
         <div class="meta">
             <p class="head">
--- a/cms/app-client/app/templates/components/transcript-component.hbs	Fri Oct 14 01:28:34 2016 +0200
+++ b/cms/app-client/app/templates/components/transcript-component.hbs	Sun Oct 16 23:19:57 2016 +0530
@@ -13,7 +13,9 @@
     <ol class="annotations">
         {{#each annotations as |annotation|}}
         <li class="sentence {{if (if-and (if-operator player.progress '>=' annotation.begin) (if-operator player.progress '<' annotation.end)) 'active'}}" {{action 'play' annotation.begin}}>
+            {{#unless (if-and (if-operator player.progress '>=' annotation.begin) (if-operator player.progress '<' annotation.end))}}
             <i class="fa fa-play" {{action 'play' annotation.begin}}>Play</i>
+            {{/unless}}
             {{#if annotation.title}}<span class="title">{{annotation.title}}</span>{{/if}}
             {{#each annotation.fragments as |fragment|}}
             <div class="fragment">