From 998ebfdc6cbbf087ed8c3c94669bf60f4b87df6b Mon Sep 17 00:00:00 2001 From: Brian Smith Date: Sun, 26 Jan 2014 16:46:41 -0500 Subject: [PATCH] VRFS-986 landing page sidebar complete / session landing fixes --- ruby/lib/jam_ruby/models/band.rb | 11 +- .../jam_ruby/models/music_session_history.rb | 12 +- ruby/lib/jam_ruby/models/recorded_track.rb | 3 + ruby/lib/jam_ruby/models/track.rb | 10 ++ ruby/lib/jam_ruby/models/user.rb | 11 +- .../stylesheets/client/screen_common.css.scss | 123 ++++++++---------- web/app/assets/stylesheets/web/main.css.scss | 17 ++- .../assets/stylesheets/web/sessions.css.scss | 17 +++ web/app/views/music_sessions/show.html.erb | 28 ++-- web/app/views/recordings/show.html.erb | 2 +- .../views/shared/_landing_sidebar.html.erb | 67 ++++++---- web/app/views/shared/_track_details.html.erb | 6 +- web/config/environments/development.rb | 2 +- 13 files changed, 186 insertions(+), 123 deletions(-) diff --git a/ruby/lib/jam_ruby/models/band.rb b/ruby/lib/jam_ruby/models/band.rb index 1ae5b26a0..e40817623 100644 --- a/ruby/lib/jam_ruby/models/band.rb +++ b/ruby/lib/jam_ruby/models/band.rb @@ -63,8 +63,15 @@ module JamRuby end def recent_history - recordings = ClaimedRecording.joins(:recordings).where(:recordings => {:band_id => "#{self.id}"}).limit(10) - msh = MusicSessionHistory.where(:band_id => self.id).limit(10) + recordings = ClaimedRecording.joins(:recordings) + .where(:recordings => {:band_id => "#{self.id}"}) + .order('created_at DESC') + .limit(10) + + msh = MusicSessionHistory.where(:band_id => self.id) + .order('created_at DESC') + .limit(10) + recordings.concat(msh) recordings.sort! {|a,b| b.created_at <=> a.created_at}.first(5) end diff --git a/ruby/lib/jam_ruby/models/music_session_history.rb b/ruby/lib/jam_ruby/models/music_session_history.rb index 7b552c08b..3ca4c4b17 100644 --- a/ruby/lib/jam_ruby/models/music_session_history.rb +++ b/ruby/lib/jam_ruby/models/music_session_history.rb @@ -15,7 +15,7 @@ module JamRuby :foreign_key => :band_id, :inverse_of => :music_session_history) - has_many :music_session_user_history, :class_name => "JamRuby::MusicSessionUserHistory", :foreign_key => "music_session_id" + has_many :music_session_user_histories, :class_name => "JamRuby::MusicSessionUserHistory", :foreign_key => "music_session_id" has_many :comments, :class_name => "JamRuby::MusicSessionComment", :foreign_key => "music_session_id" has_many :likes, :class_name => "JamRuby::MusicSessionLiker", :foreign_key => "music_session_id" @@ -31,16 +31,22 @@ module JamRuby def tracks tracks = [] - self.music_session_user_history.each do |msuh| + binding.pry + self.music_session_user_histories.each do |msuh| user = User.find(msuh.user_id) instruments = msuh.instruments.split(SEPARATOR) instruments.each do |instrument| t = Track.new - t.user = user + binding.pry + t.musician = user + binding.pry t.instrument_id = instrument + binding.pry tracks << t + binding.pry end end + binding.pry tracks end diff --git a/ruby/lib/jam_ruby/models/recorded_track.rb b/ruby/lib/jam_ruby/models/recorded_track.rb index b67ec410d..69933a560 100644 --- a/ruby/lib/jam_ruby/models/recorded_track.rb +++ b/ruby/lib/jam_ruby/models/recorded_track.rb @@ -29,6 +29,9 @@ module JamRuby validate :validate_part_complete validate :validate_too_many_upload_failures + def musician + self.user + end def can_download?(some_user) !ClaimedRecording.find_by_user_id_and_recording_id(some_user.id, recording.id).nil? diff --git a/ruby/lib/jam_ruby/models/track.rb b/ruby/lib/jam_ruby/models/track.rb index 21f45c40f..d91f00f42 100644 --- a/ruby/lib/jam_ruby/models/track.rb +++ b/ruby/lib/jam_ruby/models/track.rb @@ -7,6 +7,8 @@ module JamRuby default_scope order('created_at ASC') + attr_accessor :musician + SOUND = %w(mono stereo) belongs_to :connection, :class_name => "JamRuby::Connection", :inverse_of => :tracks @@ -18,6 +20,14 @@ module JamRuby self.connection.user end + def musician + @musician + end + + def musician=(user) + @musician = user + end + def self.index(current_user, music_session_id) query = Track .joins( diff --git a/ruby/lib/jam_ruby/models/user.rb b/ruby/lib/jam_ruby/models/user.rb index 17c5cfc47..cb4c0c212 100644 --- a/ruby/lib/jam_ruby/models/user.rb +++ b/ruby/lib/jam_ruby/models/user.rb @@ -290,8 +290,15 @@ module JamRuby end def recent_history - recordings = ClaimedRecording.joins(:recording).where(:recordings => {:owner_id => "#{self.id}"}).limit(10) - msh = MusicSessionHistory.where(:user_id => self.id).limit(10) + recordings = ClaimedRecording.joins(:recording) + .where(:recordings => {:owner_id => "#{self.id}"}) + .order('created_at DESC') + .limit(10) + + msh = MusicSessionHistory.where(:user_id => self.id) + .order('created_at DESC') + .limit(10) + recordings.concat(msh) recordings.sort! {|a,b| b.created_at <=> a.created_at}.first(5) end diff --git a/web/app/assets/stylesheets/client/screen_common.css.scss b/web/app/assets/stylesheets/client/screen_common.css.scss index 0a986912d..fe9d3497b 100644 --- a/web/app/assets/stylesheets/client/screen_common.css.scss +++ b/web/app/assets/stylesheets/client/screen_common.css.scss @@ -150,64 +150,60 @@ textarea { /* Start of Jeff's common.css file */ body { - font-family: Raleway, Arial, Helvetica, sans-serif; - font-size: 14px; - font-weight: 300; - color: #FFF; - padding:3% 6%; - background-color: #262626; - position:relative; + font-family: Raleway, Arial, Helvetica, sans-serif; + font-size: 14px; + font-weight: 300; + color: #FFF; + padding:3% 6%; + background-color: #262626; + position:relative; } h1, h2, h3, h4, h5, h6, p, div, table, form, img, tr, td, th { - margin:0; - border:0; - padding:0; + margin:0; + border:0; + padding:0; } -a { - display:inline-block; -} +a {display:inline-block;} +a img {border:none;} +.clearall {clear:both;} +.clearleft {clear:left;} +small, .small {font-size:11px;} +.bold {font-weight:bold;} -small, .small { - font-size:11px; -} - -.bold { - font-weight:bold; -} .button-grey { - margin:0px 8px 0px 8px; - background-color:#666; - border: solid 1px #868686; - outline:solid 2px #666; - padding:3px 10px; - font-family:raleway; - font-size:12px; - font-weight:300; - cursor:pointer; - color:#ccc; - text-decoration:none; + margin:0px 8px 0px 8px; + background-color:#666; + border: solid 1px #868686; + outline:solid 2px #666; + padding:3px 10px; + font-family:raleway; + font-size:12px; + font-weight:300; + cursor:pointer; + color:#ccc; + text-decoration:none; } .button-grey:hover { - background-color:#999; - color:#FFF; + background-color:#999; + color:#FFF; text-decoration:none; } .button-orange { - margin:0px 8px 0px 8px; - background-color: #ED3618; - border: solid 1px #F27861; - outline: solid 2px #ED3618; - padding:3px 10px; - font-family:raleway; - font-size:12px; - font-weight:300; - cursor:pointer; - color:#FC9; - text-decoration:none; + margin:0px 8px 0px 8px; + background-color: #ED3618; + border: solid 1px #F27861; + outline: solid 2px #ED3618; + padding:3px 10px; + font-family:raleway; + font-size:12px; + font-weight:300; + cursor:pointer; + color:#FC9; + text-decoration:none; } .smallbutton { @@ -216,8 +212,8 @@ small, .small { } .button-orange:hover { - background-color:#f16750; - color:#FFF; + background-color:#f16750; + color:#FFF; text-decoration:none; } @@ -234,17 +230,6 @@ small, .small { background-color:#666; } -a img { - border:none; -} - -.clearall { - clear:both; -} -.clearleft { - clear:left; -} - .f8 {font-size:8px !important} .f9 {font-size:9px !important} .f10 {font-size:10px !important} @@ -337,29 +322,29 @@ a img { } .op50 { - opacity: .5; - -ms-filter: "alpha(opacity=50)"; + opacity: .5; + -ms-filter: "alpha(opacity=50)"; } .op30 { - opacity: .3; - -ms-filter: "alpha(opacity=30)"; + opacity: .3; + -ms-filter: "alpha(opacity=30)"; } .nowrap { - display:inline-block; - white-space:nowrap; + display:inline-block; + white-space:nowrap; } .overlay { display:none; - position:fixed; - width:100%; - height:100%; - top:0px; - left:0px; + position:fixed; + width:100%; + height:100%; + top:0px; + left:0px; z-index: 999; - background-image:url('/assets/shared/bkg_overlay.png'); + background-image:url('/assets/shared/bkg_overlay.png'); } .overlay-small { diff --git a/web/app/assets/stylesheets/web/main.css.scss b/web/app/assets/stylesheets/web/main.css.scss index 49df23e0f..44fcf4ddb 100644 --- a/web/app/assets/stylesheets/web/main.css.scss +++ b/web/app/assets/stylesheets/web/main.css.scss @@ -58,12 +58,19 @@ body.web { padding:25px; padding-top:0px; line-height:130%; - } + + h2 { + font-size:18px !important; + line-height:normal; + color:#fff; + } + a { + text-decoration: underline !important; + } - .landing-sidebar h2 { - font-size:18px !important; - line-height:normal; - color:#fff; + em { + font-style: italic !important; + } } .landing-band { diff --git a/web/app/assets/stylesheets/web/sessions.css.scss b/web/app/assets/stylesheets/web/sessions.css.scss index 139597f9c..1e790e03a 100644 --- a/web/app/assets/stylesheets/web/sessions.css.scss +++ b/web/app/assets/stylesheets/web/sessions.css.scss @@ -1,2 +1,19 @@ +/*.session-controls { + background-color:#471f18; +} +.session-controls.inprogress { + background-color:#4C742E; +} +.session-status-ended, .session-status { + float:left; + font-size:18px; +} + +.session-status-inprogress { + float:left; + font-size:15px; + color:#cccc00; + margin-left:20px; +}*/ \ No newline at end of file diff --git a/web/app/views/music_sessions/show.html.erb b/web/app/views/music_sessions/show.html.erb index 87a9146a6..1ba28d42f 100644 --- a/web/app/views/music_sessions/show.html.erb +++ b/web/app/views/music_sessions/show.html.erb @@ -12,39 +12,43 @@ <%= @music_session.band.name %> <% else %>
- <% unless @music_session.creator.photo_url.blank? %> - <%= image_tag "#{@music_session.creator.photo_url}", {:alt => ""} %> + <% unless @music_session.user.photo_url.blank? %> + <%= image_tag "#{@music_session.user.photo_url}", {:alt => ""} %> <% else %> <%= image_tag "shared/avatar_generic.png", {:alt => ""} %> <% end %>
- <%= @music_session.creator.name %> + <%= @music_session.user.name %> <% end %>
-
SESSION: Live Session in Progress
-
<%= @cmusic_session.created_at.strftime("%b %e %Y, %l:%M %p") %>
+
SESSION
+
<%= @music_session.created_at.strftime("%b %e %Y, %l:%M %p") %>


-

<%= @music_session.name %>

+
<%= @music_session.description %>

-
TODO: Which field is this in the database??

+
<%= image_tag "content/icon_playbutton.png", {:width => 20, :height => 20} %> -
LIVE SESSION IN PROGRESS
-
1:23
+ <% if @music_session.session_removed_at.blank? %> +
SESSION IN PROGRESS
+
1:23
+ <% else %> +
LIVE SESSION ENDED
+ <% end %>
-
<%= @music_session.genres.split('|').first.id.capitalize %>
+
<%= @music_session.genres.split('|').first.capitalize %>
<%= @music_session.comment_count %> - <%= image_tag "content/icon_comment.png", {:width => 13, :height => 12, :align => "absmiddle"} %>     + <%= image_tag "content/icon_comment.png", {:width => 13, :height => 12, :align => "absmiddle", :style => "vertical-align:middle"} %>     <%= @music_session.like_count %> - <%= image_tag "content/icon_like.png", {:width => 12, :height => 12, :align => "absmiddle"} %> + <%= image_tag "content/icon_like.png", {:width => 12, :height => 12, :align => "absmiddle", :style => "vertical-align:middle"} %>


diff --git a/web/app/views/recordings/show.html.erb b/web/app/views/recordings/show.html.erb index a78b3e4b4..60b11a6d7 100644 --- a/web/app/views/recordings/show.html.erb +++ b/web/app/views/recordings/show.html.erb @@ -31,7 +31,7 @@ <%= image_tag "content/icon_like.png", {:width => 12, :height => 12} %> LIKE    <%= image_tag "content/icon_share.png", {:width => 13, :height => 15} %> SHARE
-
TODO: Which field is this in the database??

+
<%= @claimed_recording.description %>

<%= image_tag "content/icon_playbutton.png", {:width => 20, :height => 20} %> diff --git a/web/app/views/shared/_landing_sidebar.html.erb b/web/app/views/shared/_landing_sidebar.html.erb index 36cb3abfb..93d786fdc 100644 --- a/web/app/views/shared/_landing_sidebar.html.erb +++ b/web/app/views/shared/_landing_sidebar.html.erb @@ -1,26 +1,43 @@ -

-

More by <%= user.name %>:


-
Now:
- -
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi commodo, ipsum sed pharetra gravida, orci magna rhoncus neque, id pulvinar odio lorem non turpis.
-

-
Yesterday:
-
RECORDING: You Hurt Me Bad
-
Nullam sit amet enim. Suspendisse id velit vitae ligula volutpat condimentum. Aliquam erat volutpat. Sed quis velit. Nulla facilisi.
-

-
Dec. 18th:
-
SESSION: Session Ended. Unavailable.
-
Nulla libero. Vivamus pharetra posuere sapien. Nam consectetuer. Sed aliquam, nunc eget euismod ullamcorper, lectus nunc ullamcorper orci, fermentum bibendum enim nibh eget ipsum.
-

-
Dec. 12th:
-
RECORDING: Bustin' My Chops
-
Donec porttitor ligula eu dolor. Maecenas vitae nulla consequat libero cursus venenatis. Nam magna enim, accumsan eu, blandit sed, blandit a, eros.
-

-
Dec. 10th:
-
SESSION: Session Ended. Unavailable.
-
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi commodo, ipsum sed pharetra gravida, orci magna rhoncus neque, id pulvinar odio lorem non turpis. Nullam sit amet enim.
-

-
Nov. 29th:
-
SESSION: Session Ended. Unavailable.
-
Nulla libero. Vivamus pharetra posuere sapien. Nam consectetuer.
+

+ +

More by <%= user.name %>:


+ + <% recent_history.each do |history_record| %> + + <% if history_record.instance_of? ClaimedRecording %> +
+ <%= history_record.created_at.strftime("%b #{history_record.created_at.day.ordinalize}") %>: +
+
+ RECORDING: + Test +
+ + <% elsif history_record.instance_of? MusicSessionHistory %> +
+ + <% if history_record.session_removed_at.blank? %> + Now: + <% else %> + <%= history_record.session_removed_at.strftime("%b #{history_record.session_removed_at.day.ordinalize}") %>: + <% end %> + +
+
+ SESSION:  + <% if history_record.session_removed_at.blank? %> + Live Session in Progress + <% else %> + Session Ended. Unavailable. + <% end %> +
+ <% end %> + +
<%= history_record.description %>
+ <% if history_record != recent_history.last %> +

+ <% end %> + + <% end %> +
\ No newline at end of file diff --git a/web/app/views/shared/_track_details.html.erb b/web/app/views/shared/_track_details.html.erb index 80bd42c68..50263187a 100644 --- a/web/app/views/shared/_track_details.html.erb +++ b/web/app/views/shared/_track_details.html.erb @@ -9,14 +9,14 @@
- <% unless track.user.photo_url.blank? %> - <%= image_tag "#{track.user.photo_url}", {:alt => ""} %> + <% unless track.musician.photo_url.blank? %> + <%= image_tag "#{track.musician.photo_url}", {:alt => ""} %> <% else %> <%= image_tag "shared/avatar_generic.png", {:alt => ""} %> <% end %>
-
<%= track.user.name %>
+
<%= track.musician.name %>
<%= image_tag "content/icon_instrument_#{track.instrument_id.tr(" ", "_")}45.png", {:width => 32, :alt => "", :title => "#{track.instrument_id}"} %> diff --git a/web/config/environments/development.rb b/web/config/environments/development.rb index aa26582a7..bd84734bb 100644 --- a/web/config/environments/development.rb +++ b/web/config/environments/development.rb @@ -48,7 +48,7 @@ SampleApp::Application.configure do config.assets.debug = false # Set the logging destination(s) - config.log_to = %w[stdout file] + # config.log_to = %w[stdout file] # Show the logging configuration on STDOUT config.show_log_configuration = true