From edd192135ab71dd746c0ff50adecf24bda379e6d Mon Sep 17 00:00:00 2001 From: yafeilee Date: Sun, 5 Apr 2015 09:10:10 +0800 Subject: [PATCH] fix repeat click like button when page refreshing --- .ackrc | 3 +++ app/assets/javascripts/angularjs/likes.js.coffee | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 .ackrc diff --git a/.ackrc b/.ackrc new file mode 100644 index 0000000..5308c89 --- /dev/null +++ b/.ackrc @@ -0,0 +1,3 @@ +--ignore-file=ext:log +--ignore-dir=public +--ignore-dir=tmp diff --git a/app/assets/javascripts/angularjs/likes.js.coffee b/app/assets/javascripts/angularjs/likes.js.coffee index 834cfe1..d79010c 100644 --- a/app/assets/javascripts/angularjs/likes.js.coffee +++ b/app/assets/javascripts/angularjs/likes.js.coffee @@ -4,7 +4,7 @@ $http.get url .success (res)-> $scope.count = res.count - + $scope.like = $cookies.like if $scope.like @@ -12,7 +12,7 @@ url: window.location.pathname + "/likes/#{$scope.like}/is_liked" method: 'GET' .success (res)-> - if res == 'true' + if res == true $scope.is_liked = true else $scope.is_liked = false