--- a/cms/app-client/app/components/player-component.js Tue Jan 19 19:06:17 2016 +0100
+++ b/cms/app-client/app/components/player-component.js Wed Jan 20 00:15:46 2016 +0100
@@ -20,11 +20,11 @@
this.audio = new Audio("http://stop.com.pk/file/music_folder/700.mp3");
this.button = {
- play: $('#action_play'),
- progress: $('.progress')
+ play: this.$('#action_play'),
+ progress: this.$('.progress')
};
- $(document).on('touchmove', function(e){
+ this.$(document).on('touchmove', function(e){
e.preventDefault();
});
@@ -45,7 +45,6 @@
this.audio.addEventListener('timeupdate',function (){
var curtime = _this.audio.currentTime,
percent = (curtime/_this.audio.duration)*100,
- rounded = Math.round(percent*1000)/1000,
deg = 360/100*percent,
minutes = Math.floor( curtime / 60),
seconds = Math.floor(curtime) % 60;
@@ -66,7 +65,7 @@
this.audio.currentTime = t;
},
updateProgress: function(deg){
- var $slice = $('.slice');
+ var $slice = this.$('.slice');
if (deg > 180 && !$slice.is('.gt50')) {
$slice.addClass('gt50');
@@ -110,6 +109,9 @@
} else {
this.play();
}
+ },
+ prevNextSong(change){
+ this.sendAction("action", change);
}
}
});
--- a/cms/app-client/app/controllers/application.js Tue Jan 19 19:06:17 2016 +0100
+++ b/cms/app-client/app/controllers/application.js Wed Jan 20 00:15:46 2016 +0100
@@ -30,7 +30,7 @@
}
if (date.length > 0) {
var temp = sounds;
- sounds.map(function(elt, index){
+ sounds.map(function(elt){
if (date.indexOf(elt.get('created')) === -1){
temp = temp.without(elt);
}
@@ -44,28 +44,38 @@
}),
actions: {
deleteTag: function(query, item){
- var queryParams = {};
+ var queryParams = {},
+ newParams = null;
if (query === 'date'){
- var array = this.get('date');
- if(array.indexOf(item) !== -1) {
- array.splice(array.indexOf(item), 1);
+ newParams = this.get('date');
+ if(newParams.indexOf(item) !== -1) {
+ newParams = newParams.splice(newParams.indexOf(item), 1);
}
}
- queryParams[query] = array || null;
+ queryParams[query] = newParams;
this.transitionToRoute({queryParams: queryParams});
},
- previous: function(){
- console.log("previous");
+ changeSong: function(songDirection){
+ var direction = (songDirection === "next") ? 1 : -1;
+ var index = this.get("filteredSounds").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));
+ }
+ }
+ return this.set('currentItem', this.get('filteredSounds').get('firstObject'));
},
- next: function(){
- console.log("next");
+ play: function(item){
+ this.set("currentItem", item);
+ Ember.$(".result-item").toggleClass("playing", false);
+ Ember.$("#"+item.id).toggleClass("playing", true);
},
details: function(item){
- if ($("#"+item.id).hasClass("details")){
- $("#"+item.id).toggleClass("details", false);
+ if (Ember.$("#"+item.id).hasClass("details")){
+ Ember.$("#"+item.id).toggleClass("details", false);
} else{
- $(".result-item").toggleClass("details", false);
- $("#"+item.id).toggleClass("details", true);
+ Ember.$(".result-item").toggleClass("details", false);
+ Ember.$("#"+item.id).toggleClass("details", true);
}
},
toggleModal: function(item){
--- a/cms/app-client/app/controllers/player.js Tue Jan 19 19:06:17 2016 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,76 +0,0 @@
-import Ember from 'ember';
-
-export default Ember.Controller.extend({
- queryParams: ['location', 'langue', 'discours', 'date', 'thematique'],
- location: null,
- langue: null,
- discours: null,
- date: [],
- thematique: null,
- 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() {
- 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');
-
- if (location) {
- sounds = sounds.filterBy('spatial', location);
- }
- if (langue) {
- sounds = sounds.filterBy('language', langue);
- }
- if (discours) {
- sounds = sounds.filterBy('type', discours);
- }
- if (date.length > 0) {
- var temp = sounds;
- sounds.map(function(elt, index){
- if (date.indexOf(elt.get('created')) === -1){
- temp = temp.without(elt);
- }
- });
- sounds = temp;
- }
- if (thematique) {
- sounds = sounds.filterBy('thematique', thematique);
- }
- return sounds;
- }),
- actions: {
- deleteTag: function(query, item){
- var queryParams = {};
- if (query === 'date'){
- var array = this.get('date');
- if(array.indexOf(item) !== -1) {
- array.splice(array.indexOf(item), 1);
- }
- }
- queryParams[query] = array || null;
- this.transitionToRoute({queryParams: queryParams});
- },
- previous: function(){
- console.log("previous");
- },
- next: function(){
- console.log("next");
- },
- details: function(item){
- if ($("#"+item.id).hasClass("details")){
- $("#"+item.id).toggleClass("details", false);
- } else{
- $(".result-item").toggleClass("details", false);
- $("#"+item.id).toggleClass("details", true);
- }
- },
- toggleModal: function(item){
- this.set("isShowingModal", !this.isShowingModal);
- this.set("currentDetails", item);
- }
- }
-});
--- a/cms/app-client/app/styles/results.scss Tue Jan 19 19:06:17 2016 +0100
+++ b/cms/app-client/app/styles/results.scss Wed Jan 20 00:15:46 2016 +0100
@@ -74,8 +74,18 @@
margin-top: 10px;
}
-.result-item.playing .fa {
- // background: url('images/playing.gif') no-repeat;
+.playing-indicator{
+ color: #287288;
+}
+
+.result-item.playing .playing-indicator {
+ background: rgba(0, 0, 0, 0) url("images/equalizer.png") no-repeat scroll 0 0 / 15px auto;
+ height: 14px;
+ margin: 2px 7px;
+ width: 15px;
+}
+.result-item.playing .playing-indicator:before {
+ content: none;
}
.result-item button{
--- a/cms/app-client/app/templates/components/player-component.hbs Tue Jan 19 19:06:17 2016 +0100
+++ b/cms/app-client/app/templates/components/player-component.hbs Wed Jan 20 00:15:46 2016 +0100
@@ -1,5 +1,5 @@
<div class="audio-wrapper">
- <span class="audio-controls fa fa-backward fa-5" {{action 'previous'}}></span>
+ <span class="audio-controls fa fa-backward" {{action 'prevNextSong' 'previous'}}></span>
<div id="audio_player">
<span id="action_play" class="btn btn_play" {{action 'tooglePlay'}}>Play</span>
<div class="background"></div>
@@ -9,7 +9,7 @@
</div>
</div>
</div>
- <span class="audio-controls fa fa-forward fa-5" {{action 'next'}}></span>
+ <span class="audio-controls fa fa-forward fa-5" {{action 'prevNextSong' 'next'}}></span>
</div>
<p class="duration">
--- a/cms/app-client/app/templates/player.hbs Tue Jan 19 19:06:17 2016 +0100
+++ b/cms/app-client/app/templates/player.hbs Wed Jan 20 00:15:46 2016 +0100
@@ -1,7 +1,7 @@
<div class="corpus-app-content">
- {{player-component sound=currentItem}}
-
+ {{player-component action="changeSong" sound=currentItem}}
+
<p>
Title: {{ currentItem.title }}
</p>
--- a/cms/app-client/app/templates/results.hbs Tue Jan 19 19:06:17 2016 +0100
+++ b/cms/app-client/app/templates/results.hbs Wed Jan 20 00:15:46 2016 +0100
@@ -24,7 +24,7 @@
<div class='result-list'>
{{#each filteredSounds as |item| }}
<div id="{{item.id}}" {{action "details" item}} class='result-item'>
- <span class="fa fa-play-circle fa-lg fa-fw pull-right" {{action 'play' item}}></span>
+ <span class="playing-indicator fa fa-play-circle fa-lg fa-fw pull-right" {{action 'play' item}}></span>
<strong>{{ item.title }}</strong> - {{item.interviewer}}
<div class="description">
{{item.description}}
Binary file cms/app-client/public/assets/images/equalizer.png has changed