From 215c00a1a8189633fa901dc1ba2eb4eb32b7bf45 Mon Sep 17 00:00:00 2001 From: Gregory Eremin Date: Mon, 19 Sep 2011 12:21:03 +0400 Subject: [PATCH 1/6] Misc links fixes --- app/assets/javascripts/ajax.coffee | 2 +- app/assets/javascripts/page.coffee | 3 +++ app/assets/javascripts/search.coffee | 6 ++++-- app/assets/javascripts/vkontakte.coffee | 2 +- app/assets/stylesheets/albums.scss | 1 + app/views/layouts/application.html.haml | 2 +- 6 files changed, 11 insertions(+), 5 deletions(-) diff --git a/app/assets/javascripts/ajax.coffee b/app/assets/javascripts/ajax.coffee index 905be2b..587cafb 100644 --- a/app/assets/javascripts/ajax.coffee +++ b/app/assets/javascripts/ajax.coffee @@ -34,7 +34,7 @@ class window.Ajax detectPage: () -> if m = _ajax.getAnchor().match /\/artist\/(.+)\// _search.loadArtistData m[1] - else if _ajax.getAnchor() == '' + else if _ajax.getAnchor().match /\// _ajax.loadIndexPage(); else if _ajax.getAnchor().match /\/settings\// _settings.loadSettingsPage() diff --git a/app/assets/javascripts/page.coffee b/app/assets/javascripts/page.coffee index c1ee9bc..65bcc1b 100644 --- a/app/assets/javascripts/page.coffee +++ b/app/assets/javascripts/page.coffee @@ -29,6 +29,9 @@ class window.Page false $ -> + $('#logo').live 'click', -> + _ajax.go '/' + false $('.about').live 'click', -> _ajax.go '/about/' false diff --git a/app/assets/javascripts/search.coffee b/app/assets/javascripts/search.coffee index a1effa6..decbbc9 100644 --- a/app/assets/javascripts/search.coffee +++ b/app/assets/javascripts/search.coffee @@ -19,8 +19,10 @@ class window.Search if data.status in ['ok', 'loading'] _ajax.setArchor '/artist/' +name+ '/' _page.print data.html - for album in data.albums - _player.albums[album.id] = album + if _session.getUser().id + for album in data.albums + _player.albums[album.id] = album + $('.button-container').show() _search.hideSpinner() if data.status is 'loading' setTimeout () -> diff --git a/app/assets/javascripts/vkontakte.coffee b/app/assets/javascripts/vkontakte.coffee index 3fe62d4..f9f07fd 100644 --- a/app/assets/javascripts/vkontakte.coffee +++ b/app/assets/javascripts/vkontakte.coffee @@ -132,8 +132,8 @@ $('#login').live 'click', -> , 8 false $('#logout').live 'click', -> - _ajax.go '/search/'; VK.Auth.logout (response) -> _vkontakte.authInfo(response) + $('.button-container').hide() false false diff --git a/app/assets/stylesheets/albums.scss b/app/assets/stylesheets/albums.scss index ae85418..9805228 100644 --- a/app/assets/stylesheets/albums.scss +++ b/app/assets/stylesheets/albums.scss @@ -19,6 +19,7 @@ max-width: 220px; } .button-container { + display: none; text-align: center; margin-top: 10px; } diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 4df60a6..fca84a5 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -15,7 +15,7 @@ .topbar-inner .container %h3 - %a{ :href => "#/" } BeatHaven + %a#logo{ :href => "#/" } BeatHaven %ul.nav %li %a{ :href => "http://blog.beathaven.org/" }= I18n.t 'global.news' From 9305237bac5d57fed21f98abfc9bc64b2fa8aac5 Mon Sep 17 00:00:00 2001 From: Gregory Eremin Date: Mon, 19 Sep 2011 16:31:05 +0400 Subject: [PATCH 2/6] About page, index page[en] --- app/assets/javascripts/ajax.coffee | 10 ++++------ app/controllers/application_controller.rb | 4 ++++ app/views/application/_about.en.html.haml | 13 +++++++++++++ app/views/application/_about.ru.html.haml | 13 +++++++++++++ app/views/application/_greetings.en.html.haml | 1 + app/views/application/_greetings.ru.html.haml | 2 +- config/routes.rb | 1 + 7 files changed, 37 insertions(+), 7 deletions(-) create mode 100644 app/views/application/_about.en.html.haml create mode 100644 app/views/application/_about.ru.html.haml create mode 100644 app/views/application/_greetings.en.html.haml diff --git a/app/assets/javascripts/ajax.coffee b/app/assets/javascripts/ajax.coffee index 587cafb..3355629 100644 --- a/app/assets/javascripts/ajax.coffee +++ b/app/assets/javascripts/ajax.coffee @@ -9,12 +9,12 @@ class window.Ajax loadIndexPage: -> $('#content').load '/greetings/' + _ajax.setTitle '' false loadAboutPage: -> - $.get '/templates/about.html', (data) -> - _page.renderTextpage data - _ajax.setTitle 'About' + $('#content').load '/about/' + _ajax.setTitle 'About' false setArchor: (anchor) -> @@ -34,14 +34,12 @@ class window.Ajax detectPage: () -> if m = _ajax.getAnchor().match /\/artist\/(.+)\// _search.loadArtistData m[1] - else if _ajax.getAnchor().match /\// - _ajax.loadIndexPage(); else if _ajax.getAnchor().match /\/settings\// _settings.loadSettingsPage() else if _ajax.getAnchor().match /\/about\// _ajax.loadAboutPage() else - #_ajax.loadSearchPage() + _ajax.loadIndexPage(); false $(window).bind 'hashchange', -> diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 881fe78..6ac1097 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -11,6 +11,10 @@ class ApplicationController < ActionController::Base render :partial => 'greetings' end + def about + render :partial => 'about' + end + protected def authorize diff --git a/app/views/application/_about.en.html.haml b/app/views/application/_about.en.html.haml new file mode 100644 index 0000000..21d4cf7 --- /dev/null +++ b/app/views/application/_about.en.html.haml @@ -0,0 +1,13 @@ +%h2 Write us a letter! +%br +.row + .span3 + %address + %strong Site issues? + %br + %a{ :href => "mailto:support@beathaven.org" } support@beathaven.org + .span6 + %address + %strong Everything else (suggestions, compliments, threats) + %br + %a{ :href => "mailto:contact@beathaven.org" } contact@beathaven.org \ No newline at end of file diff --git a/app/views/application/_about.ru.html.haml b/app/views/application/_about.ru.html.haml new file mode 100644 index 0000000..9fc8bf6 --- /dev/null +++ b/app/views/application/_about.ru.html.haml @@ -0,0 +1,13 @@ +%h2 Напишите нам письмо! +%br +.row + .span3 + %address + %strong Проблемы с сайтом? + %br + %a{ :href => "mailto:support@beathaven.org" } support@beathaven.org + .span6 + %address + %strong Все остальное (пожелания, благодарности, угрозы) + %br + %a{ :href => "mailto:contact@beathaven.org" } contact@beathaven.org \ No newline at end of file diff --git a/app/views/application/_greetings.en.html.haml b/app/views/application/_greetings.en.html.haml new file mode 100644 index 0000000..4a346a2 --- /dev/null +++ b/app/views/application/_greetings.en.html.haml @@ -0,0 +1 @@ +%h2 Halló! \ No newline at end of file diff --git a/app/views/application/_greetings.ru.html.haml b/app/views/application/_greetings.ru.html.haml index 4628499..196a8bb 100644 --- a/app/views/application/_greetings.ru.html.haml +++ b/app/views/application/_greetings.ru.html.haml @@ -1 +1 @@ -%h1 Привет! \ No newline at end of file +%h2 Привет! \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 776864d..ba3142f 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -58,6 +58,7 @@ Beathaven::Application.routes.draw do match '/' => 'application#index' match '/greetings/' => 'application#greetings' + match '/about/' => 'application#about' match 'user/auth' => 'user#auth' match 'user/update' => 'user#update' From 54032a4ad3033020f746e990de6016a90a5fed91 Mon Sep 17 00:00:00 2001 From: Gregory Eremin Date: Mon, 19 Sep 2011 16:44:15 +0400 Subject: [PATCH 3/6] 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 From 48cf08446111ccd7cde0f5382646ac8a072e86a2 Mon Sep 17 00:00:00 2001 From: Gregory Eremin Date: Mon, 19 Sep 2011 19:14:01 +0400 Subject: [PATCH 4/6] Gemfile: use pch's repo for lastfm-client, use latest version of musicbrainz gem --- Gemfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index 6863a70..07cc83c 100644 --- a/Gemfile +++ b/Gemfile @@ -14,8 +14,8 @@ gem 'barista' gem 'awesome_print', :require => 'ap' gem 'delayed_job' -gem 'lastfm-client', :git => 'http://github.com/magnolia-fan/lastfm-client.git' -gem 'musicbrainz', '~> 0.4.3' +gem 'lastfm-client', :git => 'http://github.com/pch/lastfm-client.git' +gem 'musicbrainz' gem 'bitmask_attributes' From 21eb1250ea48393cd659e5dd2e0fb11dbee71ffa Mon Sep 17 00:00:00 2001 From: Gregory Eremin Date: Mon, 19 Sep 2011 19:30:02 +0400 Subject: [PATCH 5/6] Gemfile.lock for the last commit --- Gemfile.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 16cf4db..45aee7c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,6 +1,6 @@ GIT - remote: http://github.com/magnolia-fan/lastfm-client.git - revision: 26fec825943d0bb77606bf058386e786ee97572b + remote: http://github.com/pch/lastfm-client.git + revision: d17806722c1da685f7d2f283b0064cb92eb96965 specs: lastfm-client (0.0.2) json (>= 1.4.6) @@ -128,7 +128,7 @@ DEPENDENCIES haml json lastfm-client! - musicbrainz (~> 0.4.3) + musicbrainz nokogiri pg rails (= 3.1.0) From db1b62771e562daa56e5888bf1e3fe45dc35c74a Mon Sep 17 00:00:00 2001 From: Gregory Eremin Date: Mon, 19 Sep 2011 20:01:26 +0400 Subject: [PATCH 6/6] Player secondary buttons update --- app/assets/stylesheets/player.scss | 2 +- app/views/layouts/application.html.haml | 6 +++--- config/locales/en.yml | 6 +++--- config/locales/ru.yml | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/app/assets/stylesheets/player.scss b/app/assets/stylesheets/player.scss index 8c3cd47..2b19f9e 100644 --- a/app/assets/stylesheets/player.scss +++ b/app/assets/stylesheets/player.scss @@ -48,7 +48,7 @@ color: #b0b0b0; } &.on { - color: #a0a0a0; + color: #606060; } } } diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 14ebf89..36bb410 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -62,9 +62,9 @@ %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' + %a.shuffle= (I18n.t 'player.shuffle').upcase + %a.repeat= (I18n.t 'player.repeat').upcase + %a.do_empty= (I18n.t 'player.do_empty').upcase %ul.playlist diff --git a/config/locales/en.yml b/config/locales/en.yml index bb37e47..5086dbf 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -46,6 +46,6 @@ en: player: add: "Add to Now Playing" - repeat: "REPEAT" - shuffle: "SHUFFLE" - do_empty: "EMPTY" \ No newline at end of file + 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 6366a16..b9e12d7 100644 --- a/config/locales/ru.yml +++ b/config/locales/ru.yml @@ -46,6 +46,6 @@ ru: player: add: "Добавить в плей-лист" - repeat: "ПОВТОРЯТЬ" - shuffle: "ПЕРЕМЕШАТЬ" - do_empty: "ОЧИСТИТЬ" \ No newline at end of file + repeat: "Повторять" + shuffle: "Перемешать" + do_empty: "Очистить" \ No newline at end of file