modify library show page praise style when user unlogged

dev_aliyun
p31729568 6 years ago
parent 25d4cac572
commit 02146f7dcb

@ -18,7 +18,7 @@
</ul>
<div class="edu-position fr mt12 mb10">
<%= hidden_field_tag(:type, params[:type]) %>
<input class="winput-300-35 panel-box-sizing" placeholder="输入教学案例标题、编号进行检索" type="text" id="search_name">
<input class="winput-300-35 panel-box-sizing" placeholder="输入教学案例标题、作者、单位进行检索" type="text" id="search_name">
<a href="javascript:void(0);" class="edu-btn-search font-16 color-grey" id="search"><i class="fa fa-search"></i></a>
</div>
</div>

@ -2,8 +2,12 @@
praised = PraiseTread.praised(object)
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="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>
$(function(){
@ -26,6 +30,11 @@
});
$minusPraiseBtn.on('click', function(){
if($(this).hasClass('unlogged')){
window.location.href = '<%= signin_path(back_url: request.original_url) %>';
return;
}
$.ajax({
method: "get",
url: "<%= praise_tread_praise_minus_path(obj_id: object.id, obj_type: object.class) %>",

Loading…
Cancel
Save