From 54032a4ad3033020f746e990de6016a90a5fed91 Mon Sep 17 00:00:00 2001 From: Gregory Eremin Date: Mon, 19 Sep 2011 16:44:15 +0400 Subject: [PATCH] Shuffle, repeat, empty playlist buttons. Working! --- app/assets/javascripts/player.coffee | 10 +++++----- app/assets/stylesheets/player.scss | 18 ++++++++++++++++++ app/views/layouts/application.html.haml | 6 +++++- config/locales/en.yml | 8 ++++---- config/locales/ru.yml | 8 ++++---- 5 files changed, 36 insertions(+), 14 deletions(-) diff --git a/app/assets/javascripts/player.coffee b/app/assets/javascripts/player.coffee index 9c9b9ae..0d42ada 100644 --- a/app/assets/javascripts/player.coffee +++ b/app/assets/javascripts/player.coffee @@ -147,10 +147,10 @@ class window.Player false onShuffle: -> - #return $('#shuffle').hasClass 'active' + return $('.shuffle').hasClass 'on' onRepeat: -> - #return $('#repeat').hasClass 'active' + return $('.repeat').hasClass 'on' updateNowListening: (track) -> if _session.getUser().lastfm_username @@ -184,11 +184,11 @@ $('.player .progress').live 'click', (e) -> # Player Additional Controls -$('#repeat, #shuffle').live 'click', -> - $(this).toggleClass 'active' +$('.repeat, .shuffle').live 'click', -> + $(this).toggleClass 'on' false -$('#empty-playlist').live 'click', -> +$('.do_empty').live 'click', -> if confirm('Are you sure?') $('.playlist li').remove() $('#jplayer').jPlayer 'clearMedia' diff --git a/app/assets/stylesheets/player.scss b/app/assets/stylesheets/player.scss index b5e75fc..8c3cd47 100644 --- a/app/assets/stylesheets/player.scss +++ b/app/assets/stylesheets/player.scss @@ -34,6 +34,24 @@ } } } + .secondary-buttons { + margin: 10px 0; + text-align: center; + a { + font-size: 11px; + color: #cacaca; + font-weight: bold; + text-decoration: none; + cursor: pointer; + + &:hover { + color: #b0b0b0; + } + &.on { + color: #a0a0a0; + } + } + } } .playlist { diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index fca84a5..14ebf89 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -18,7 +18,7 @@ %a#logo{ :href => "#/" } BeatHaven %ul.nav %li - %a{ :href => "http://blog.beathaven.org/" }= I18n.t 'global.news' + %a{ :href => "http://blog.beathaven.org/", :target => "_blank" }= I18n.t 'global.news' %li %a.about{ :href => "#/about/" }= I18n.t 'global.about' %form#search-form{ :action => "" } @@ -61,6 +61,10 @@ %a.btn.large.play ► %a.btn.large.pause II %a.btn.small-round.next » + .secondary-buttons + %a.shuffle= I18n.t 'player.shuffle' + %a.repeat= I18n.t 'player.repeat' + %a.do_empty= I18n.t 'player.do_empty' %ul.playlist diff --git a/config/locales/en.yml b/config/locales/en.yml index 28e6318..bb37e47 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -7,9 +7,6 @@ en: logout: "Log out" do_add: "Add some music to playlist" do_login: "Don't forget to log in, please. It's simple." - repeat: "Repeat" - shuffle: "Shuffle" - do_empty: "Empty playlist" hello: "Hi there" settings: "Settings" your_ad_here: "Your ad couldn't
be here" @@ -48,4 +45,7 @@ en: reload_alert: "To change application language it is needed to reload page. Your current playlist will be emptied and music will stop. Do you really wish to continue?" player: - add: "Add to Now Playing" \ No newline at end of file + add: "Add to Now Playing" + repeat: "REPEAT" + shuffle: "SHUFFLE" + do_empty: "EMPTY" \ No newline at end of file diff --git a/config/locales/ru.yml b/config/locales/ru.yml index d0f2fd4..6366a16 100644 --- a/config/locales/ru.yml +++ b/config/locales/ru.yml @@ -7,9 +7,6 @@ ru: logout: "Выйти" do_add: "Добавьте музыку в плей-лист" do_login: "Авторизуйтесь, пожалуйста. Это действительно просто." - repeat: "Повторять" - shuffle: "Перемешать" - do_empty: "Очистить" hello: "Привет" settings: "Настройки" your_ad_here: "Здесь не могла бы
быть Ваша реклама" @@ -48,4 +45,7 @@ ru: reload_alert: "Чтобы изменить язык приложения, необходимо перезагрузить страницу. Ваш текущий плей-лист будет очищен и музыка остановится. Вы действительно хотите продолжить?" player: - add: "Добавить в плей-лист" \ No newline at end of file + add: "Добавить в плей-лист" + repeat: "ПОВТОРЯТЬ" + shuffle: "ПЕРЕМЕШАТЬ" + do_empty: "ОЧИСТИТЬ" \ No newline at end of file