|
|
@ -2,8 +2,12 @@
|
|
|
|
praised = PraiseTread.praised(object)
|
|
|
|
praised = PraiseTread.praised(object)
|
|
|
|
praise_num = get_praise_num(object) || 0
|
|
|
|
praise_num = get_praise_num(object) || 0
|
|
|
|
%>
|
|
|
|
%>
|
|
|
|
|
|
|
|
<% if User.current.try(:logged?) %>
|
|
|
|
<p class="noteDetailPoints plus-praise-btn" data-tip-down="点赞" style="<%= praised ? 'display:block' : 'display:none' %>"><i class="iconfont icon-dianzan"></i><br><span class="praise-num"><%= praise_num %></span></p>
|
|
|
|
<p class="noteDetailPoints plus-praise-btn" data-tip-down="点赞" style="<%= praised ? 'display:block' : 'display:none' %>"><i class="iconfont icon-dianzan"></i><br><span class="praise-num"><%= praise_num %></span></p>
|
|
|
|
<p class="noteDetailPointsBCD1E3 minus-praise-btn" data-tip-down="取消点赞" style="<%= praised ? 'display:none' : 'display:block' %>"><span>已赞</span><br><span class="praise-num"><%= praise_num %></span></p>
|
|
|
|
<p class="noteDetailPointsBCD1E3 minus-praise-btn" data-tip-down="取消点赞" style="<%= praised ? 'display:none' : 'display:block' %>"><span>已赞</span><br><span class="praise-num"><%= praise_num %></span></p>
|
|
|
|
|
|
|
|
<% else %>
|
|
|
|
|
|
|
|
<p class="noteDetailPointsBCD1E3 minus-praise-btn unlogged"><i class="iconfont icon-dianzan"></i><br><span class="praise-num"><%= praise_num %></span></p>
|
|
|
|
|
|
|
|
<% end %>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
<script>
|
|
|
|
$(function(){
|
|
|
|
$(function(){
|
|
|
@ -26,6 +30,11 @@
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
$minusPraiseBtn.on('click', function(){
|
|
|
|
$minusPraiseBtn.on('click', function(){
|
|
|
|
|
|
|
|
if($(this).hasClass('unlogged')){
|
|
|
|
|
|
|
|
window.location.href = '<%= signin_path(back_url: request.original_url) %>';
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$.ajax({
|
|
|
|
$.ajax({
|
|
|
|
method: "get",
|
|
|
|
method: "get",
|
|
|
|
url: "<%= praise_tread_praise_minus_path(obj_id: object.id, obj_type: object.class) %>",
|
|
|
|
url: "<%= praise_tread_praise_minus_path(obj_id: object.id, obj_type: object.class) %>",
|
|
|
|