Skip to content

Commit

Permalink
better vote info and add jukebox link
Browse files Browse the repository at this point in the history
  • Loading branch information
whomwah committed Jan 8, 2014
1 parent 049f70e commit 714e1e1
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 11 deletions.
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
GIT
remote: [email protected]:kyan/kyan_jukebox_websocket_lib.git
revision: 092ab4ee680b0c382919d41ede1d9b9731fdb470
revision: f702e1268351d140d8c7ee7ba6b587ade0cfeaa3
specs:
kyan_jukebox (0.1.7)
kyan_jukebox (0.1.9)

GEM
remote: https://rubygems.org/
Expand Down
2 changes: 0 additions & 2 deletions app/_buttons/vote_button.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,8 @@ def initWithVote vote

if vote
button.cell.setImage(NSImage.imageNamed(NSImageNameAddTemplate))
button.setToolTip(" Vote Up ")
else
button.cell.setImage(NSImage.imageNamed(NSImageNameRemoveTemplate))
button.setToolTip(" Vote Down ")
end
end
end
Expand Down
21 changes: 16 additions & 5 deletions app/_views/nowplaying_view.rb
Original file line number Diff line number Diff line change
Expand Up @@ -228,12 +228,23 @@ def update_image
end

def update_votes
puts "Changed: #{@jukebox.whats_changed}"

score = if valid_jb_data?(:rating)
rating.rating unless rating.nil?
elsif valid_jb_data?(:track)
score = if valid_jb_data?(:track)
track.rating unless track.nil?
elsif valid_jb_data?(:rating)
rating.rating unless rating.nil?
end

if superview
uvote_button = superview.viewWithTag(U_VOTE_BUTTON)
dvote_button = superview.viewWithTag(D_VOTE_BUTTON)

if !uvote_button.nil?
uvote_button.setToolTip(rating.p_ratings)
end

if !dvote_button.nil?
dvote_button.setToolTip(rating.n_ratings)
end
end

@image.handle_vote(score, rating)
Expand Down
6 changes: 6 additions & 0 deletions app/_views/vote_buttons_view.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
class VoteButtonsView < NSView

attr_reader :up_vote_button, :down_vote_button

def init
super.tap do |v|
v.translatesAutoresizingMaskIntoConstraints = false
Expand Down Expand Up @@ -51,10 +53,14 @@ def init

def up_vote_button
@up_vote_button ||= VoteButton.alloc.initWithVote(true)
@up_vote_button.tag = U_VOTE_BUTTON
@up_vote_button
end

def down_vote_button
@down_vote_button ||= VoteButton.alloc.initWithVote(false)
@down_vote_button.tag = D_VOTE_BUTTON
@down_vote_button
end

end
1 change: 0 additions & 1 deletion app/_views/vote_view.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ def do_vote(score, rating)
'NSColor' => fg_col
})
@label.setAttributedStringValue(txt)
@label.setToolTip(rating.description) unless rating.nil?
@bg_color = bg_col
end

Expand Down
3 changes: 3 additions & 0 deletions app/config/constants.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
VOTE_VIEW_H=19
VOTE_VIEW_W=21

U_VOTE_BUTTON=32
D_VOTE_BUTTON=33

MENU_NOWPLAYING=111
MENU_CONSOLE_BUTT=222

Expand Down
3 changes: 2 additions & 1 deletion app/menu.rb
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,8 @@ def links
["Pivotal" , "https://www.pivotaltracker.com/google_domain_openid/redirect_for_auth?domain=kyanmedia.com"],
["Support" , "https://kyan.sirportly.com"],
["Holiday" , "https://appogee-leave.appspot.com/login?domain=kyanmedia.com"],
["Campfire" , "https://kyanmedia.campfirenow.com"]
["Campfire" , "https://kyanmedia.campfirenow.com"],
["Jukebox" , "http://jukebox.local"]
]
end

Expand Down
Binary file added resources/jukebox.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

3 comments on commit 714e1e1

@Gav
Copy link
Member

@Gav Gav commented on 714e1e1 Jan 9, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New feature is great, can we permanently see votes rather than hiding them? Would be nice to see w'out having to hover ...
You could always flash red or green bg when a negative/positive vote comes in.

@whomwah
Copy link
Member Author

@whomwah whomwah commented on 714e1e1 Jan 9, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about having it as an option in preferences "Always show votes?"

@Gav
Copy link
Member

@Gav Gav commented on 714e1e1 Jan 9, 2014 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.