Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Refactered view code and fixed bugs relying on nil

  • Loading branch information...
commit c06ce6a740e50ba5e27fea8b6bfc268115628ec6 1 parent 09e1a09
@michaelparenteau michaelparenteau authored
View
6 app/views/player/show.html.haml
@@ -2,16 +2,16 @@
.shot_meta
=image_tag @player.avatar_url
- - if @player.name == nil
+ - if @player.name.present?
%h2
- = @player.username
+ = @player.name
%span
= @player.location
%br
%a{:href => @player.website_url , :target => '_blank'}=@player.website_url
- else
%h2
- = @player.name
+ = @player.username
%span
= @player.location
%br
View
5 app/views/shots/_comments.html.haml
@@ -4,7 +4,10 @@
- comments.each do |comment|
%li
%img{:src => comment.player.avatar_url}
- %a.comment_player_name{:href => player_path(comment.player.username)}= comment.player.name
+ -if comment.player.name.present?
+ %a.comment_player_name{:href => player_path(comment.player.username)}= comment.player.name
+ -else
+ %a.comment_player_name{:href => player_path(comment.player.username)}= comment.player.username
%span.comment_body= raw comment.body
- if @page == 1 && @comments.pages > 1
View
15 app/views/shots/show.html.haml
@@ -5,10 +5,10 @@
= @shot.title
%span
%strong By:
- %a{:href => player_path(@shot.player.id)}
- = @shot.player.name
- - if @shot.player.name == nil
- %a{:href => player_path(@shot.player.username)}
+ %a{:href => player_path(@shot.player.username)}
+ - if @shot.player.name.present?
+ = @shot.player.name
+ - else
= @shot.player.username
= image_tag @shot.image_url
.stats-container
@@ -21,6 +21,9 @@
= @shot.comments_count
%li.likes.no-view
= @shot.likes_count
+
%a.big-pink{:href => "http://twitter.com/share?text=Found%20on%20@dribbble:&url="+@shot.url+"&via=hooppps" , :target => "_blank"} Share this shot on twitter
- #comments
- = render 'comments', :comments => @comments, :shot => @shot
+
+ - if @comments.present?
+ #comments
+ = render 'comments', :comments => @comments, :shot => @shot
Please sign in to comment.
Something went wrong with that request. Please try again.