# HG changeset patch # User Chloe Laisne # Date 1471440619 -7200 # Node ID ed05b89e3299217321a843ee345ead364e48b1e2 # Parent a7cf2887e99339c64f67fc499a5ade4ad03750a4 Add words to transcript diff -r a7cf2887e993 -r ed05b89e3299 cms/app-client/app/components/transcript-component.js --- a/cms/app-client/app/components/transcript-component.js Tue Aug 16 00:16:08 2016 +0200 +++ b/cms/app-client/app/components/transcript-component.js Wed Aug 17 15:30:19 2016 +0200 @@ -16,9 +16,10 @@ didUpdate: function() { var self = this; - if(this.get('autoscroll')) { + var target = Ember.$('.sentence.active'); + if(this.get('autoscroll') && target.length) { Ember.$(this.get('autoscrollElement')).animate({ - scrollTop: Ember.$('.sentence.active').offset().top + Ember.$(this.get('autoscrollElement')).scrollTop() - Ember.$(this.get('autoscrollElement')).offset().top - 154 + scrollTop: target.offset().top + Ember.$(this.get('autoscrollElement')).scrollTop() - Ember.$(this.get('autoscrollElement')).offset().top - 154 }, 150); } }, diff -r a7cf2887e993 -r ed05b89e3299 cms/app-client/app/serializers/transcript.js --- a/cms/app-client/app/serializers/transcript.js Tue Aug 16 00:16:08 2016 +0200 +++ b/cms/app-client/app/serializers/transcript.js Wed Aug 17 15:30:19 2016 +0200 @@ -5,12 +5,27 @@ normalizeResponse: function(store, primaryModelClass, payload, id, requestType) { var annotations = []; payload.annotations.forEach(function(annotation) { - annotations.push({ + console.log('ANNOT', annotation.content.data.words); + var annotationObject = { 'content': annotation.content.data.content, - 'translation': annotation.content.data.transl['@value'], 'start': annotation.begin, 'end': annotation.end - }); + }; + if(annotation.content.data.transl) { + annotationObject.translation = annotation.content.data.transl['@value']; + } + if(annotation.content.data.words) { + var words = []; + annotation.content.data.words.forEach(function(word) { + var wordObject = { + 'content': word.content, + 'translation': word.transl['@value'] + }; + words.push(wordObject); + }) + annotationObject.words = words; + } + annotations.push(annotationObject); }); return { 'data': { diff -r a7cf2887e993 -r ed05b89e3299 cms/app-client/app/styles/app.scss --- a/cms/app-client/app/styles/app.scss Tue Aug 16 00:16:08 2016 +0200 +++ b/cms/app-client/app/styles/app.scss Wed Aug 17 15:30:19 2016 +0200 @@ -10,6 +10,8 @@ $medium-white: #f5f5f5; $light-white: #fbfbfb; +$content-height: 600px; + body { background-color: $medium-white; @@ -78,7 +80,8 @@ } body.videoscreen .corpus-app-container { - padding-top: 308px; + margin-top: 308px; + height: 292px; } h2 { diff -r a7cf2887e993 -r ed05b89e3299 cms/app-client/app/styles/components/transcript-component.scss --- a/cms/app-client/app/styles/components/transcript-component.scss Tue Aug 16 00:16:08 2016 +0200 +++ b/cms/app-client/app/styles/components/transcript-component.scss Wed Aug 17 15:30:19 2016 +0200 @@ -53,6 +53,42 @@ color: $light-white; } +.transcript-component .transcript .sentence .words { + font-size: 0px; + margin: 20px 0px; +} + +.transcript-component .transcript .sentence .words .word { + display: inline-block; +} + +.transcript-component .transcript .sentence .words .word .original, +.transcript-component .transcript .sentence .words .word .translation { + background-color: $medium-grey; + padding: 0px 4px; + margin-right: 2px; + margin-bottom: 2px; + font-size: 12px; +} + +.transcript-component .transcript .sentence.active .words .word .original, +.transcript-component .transcript .sentence.active .words .word .translation { + background-color: $light-white; +} + +.transcript-component .transcript .sentence .words .word { + color: $light-blue; +} + +.transcript-component .transcript .sentence.active .words .word .original { + color: $grey-blue; +} + +.transcript-component .transcript .sentence .words .word .translation { + margin-bottom: 4px; +} + + .transcript-component .transcript .sentence.active .translation { color: $light-blue; } diff -r a7cf2887e993 -r ed05b89e3299 cms/app-client/app/templates/application.hbs --- a/cms/app-client/app/templates/application.hbs Tue Aug 16 00:16:08 2016 +0200 +++ b/cms/app-client/app/templates/application.hbs Wed Aug 17 15:30:19 2016 +0200 @@ -7,13 +7,10 @@ {{/if}}
- {{#if player.window}} - {{#if (eq player.window 'notice')}} - {{ notice-component }} - {{/if}} - {{#if (eq player.window 'transcript')}} - {{ transcript-component }} - {{/if}} + {{#if (if-and player.window (eq player.window 'notice'))}} + {{ notice-component }} + {{else if (if-and player.window player.transcript (eq player.window 'transcript'))}} + {{ transcript-component }} {{else}} {{ outlet }} {{/if}} diff -r a7cf2887e993 -r ed05b89e3299 cms/app-client/app/templates/components/transcript-component.hbs --- a/cms/app-client/app/templates/components/transcript-component.hbs Tue Aug 16 00:16:08 2016 +0200 +++ b/cms/app-client/app/templates/components/transcript-component.hbs Wed Aug 17 15:30:19 2016 +0200 @@ -1,16 +1,37 @@

{{player.transcript.title}}

    {{#each player.transcript.annotations as |annotation|}} +{{log 'each-annotation'}} {{#if (if-and (if-operator player.progress '>=' annotation.start) (if-operator player.progress '<' annotation.end))}}
  1. Play {{#if annotation.content}}

    {{annotation.content}}

    {{/if}} + {{#if annotation.words}} +
    + {{#each annotation.words as |word|}} +
    +

    {{word.content}}

    +

    {{word.translation}}

    +
    + {{/each}} +
    + {{/if}} {{#if annotation.translation}}

    {{annotation.translation}}

    {{/if}}
  2. {{else}}
  3. Play {{#if annotation.content}}

    {{annotation.content}}

    {{/if}} + {{#if annotation.words}} +
    + {{#each annotation.words as |word|}} +
    +

    {{word.content}}

    +

    {{word.translation}}

    +
    + {{/each}} +
    + {{/if}} {{#if annotation.translation}}

    {{annotation.translation}}

    {{/if}}
  4. {{/if}}