From 6e81f2966de8b63fc57dbd173e7f4356b7a09d97 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Wed, 1 Jan 2020 09:24:47 +1300 Subject: [PATCH] fixed colouring of likes button --- app/views/likes/_count.haml | 2 +- app/views/photos/_likes.html.haml | 6 +++--- app/views/posts/_likes.html.haml | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/views/likes/_count.haml b/app/views/likes/_count.haml index 79fece151..61920e259 100644 --- a/app/views/likes/_count.haml +++ b/app/views/likes/_count.haml @@ -1,4 +1,4 @@ -%span.badge.like-badge{class: (likeable.liked_by?(current_member)) ? 'liked' : ''} +%span.badge.like-badge{class: liked ? 'liked' : ''} = like_icon   %span.like-count= likeable.likes_count diff --git a/app/views/photos/_likes.html.haml b/app/views/photos/_likes.html.haml index d7d2aaf48..93aaede82 100644 --- a/app/views/photos/_likes.html.haml +++ b/app/views/photos/_likes.html.haml @@ -2,11 +2,11 @@ - if member_signed_in? && can?(:new, Like) - if !photo.liked_by_members_names.include?(current_member.login_name) = link_to likes_path(type: 'Photo', id: photo.id, format: :json), - method: :post, remote: true, class: 'photo-like like-btn' do - = render 'likes/count', likeable: photo + method: :post, remote: true, class: 'photo-like like-btn ' do + = render 'likes/count', likeable: photo, liked: false - else = link_to likes_path(type: 'Photo', id: photo.id, format: :json), method: :delete, remote: true, class: 'photo-like like-btn' do - = render 'likes/count', likeable: photo + = render 'likes/count', likeable: photo, liked: true - else = render 'likes/count', likeable: photo diff --git a/app/views/posts/_likes.html.haml b/app/views/posts/_likes.html.haml index 95c2a8cd1..fe0d0c790 100644 --- a/app/views/posts/_likes.html.haml +++ b/app/views/posts/_likes.html.haml @@ -7,4 +7,4 @@ = link_to 'Unlike', likes_path(type: 'Post', id: post.id, format: :json), method: :delete, remote: true, class: 'post-like btn like-btn' -= render 'likes/count', likeable: post += render 'likes/count', likeable: post, liked: post.liked_by?(current_member)