# HG changeset patch # User nowmad@nowmads-macbook-pro.local # Date 1453245346 -3600 # Node ID 24fef043ea0b4d77d0687c87495b186ea631252c # Parent 15ded106ef1a44af1c44bdb3f111382d6ed9088a add control to go next/previous sound diff -r 15ded106ef1a -r 24fef043ea0b cms/app-client/app/components/player-component.js --- 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); } } }); diff -r 15ded106ef1a -r 24fef043ea0b cms/app-client/app/controllers/application.js --- 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){ diff -r 15ded106ef1a -r 24fef043ea0b cms/app-client/app/controllers/player.js --- 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); - } - } -}); diff -r 15ded106ef1a -r 24fef043ea0b cms/app-client/app/styles/results.scss --- 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{ diff -r 15ded106ef1a -r 24fef043ea0b cms/app-client/app/templates/components/player-component.hbs --- 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 @@
diff -r 15ded106ef1a -r 24fef043ea0b cms/app-client/app/templates/player.hbs --- 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 @@
Title: {{ currentItem.title }}
diff -r 15ded106ef1a -r 24fef043ea0b cms/app-client/app/templates/results.hbs --- 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 @@