Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop
commit
84f77edead
@ -0,0 +1,42 @@
|
||||
<%
|
||||
praised = PraiseTread.praised(object)
|
||||
praise_num = get_praise_num(object) || 0
|
||||
%>
|
||||
<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>
|
||||
|
||||
<script>
|
||||
$(function(){
|
||||
var $plusPraiseBtn = $('.plus-praise-btn');
|
||||
var $minusPraiseBtn = $('.minus-praise-btn');
|
||||
var praiseNum = parseInt(<%= praise_num %>);
|
||||
|
||||
$plusPraiseBtn.on('click', function(){
|
||||
$.ajax({
|
||||
method: "get",
|
||||
url: "<%= praise_tread_praise_plus_path(obj_id: object.id, obj_type: object.class) %>",
|
||||
dataType: 'json',
|
||||
success: function(){
|
||||
$plusPraiseBtn.hide();
|
||||
praiseNum += 1;
|
||||
$minusPraiseBtn.find('.praise-num').html(praiseNum);
|
||||
$minusPraiseBtn.show();
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
$minusPraiseBtn.on('click', function(){
|
||||
$.ajax({
|
||||
method: "get",
|
||||
url: "<%= praise_tread_praise_minus_path(obj_id: object.id, obj_type: object.class) %>",
|
||||
dataType: 'json',
|
||||
success: function(){
|
||||
$minusPraiseBtn.hide();
|
||||
praiseNum -= 1;
|
||||
$plusPraiseBtn.find('.praise-num').html(praiseNum);
|
||||
$plusPraiseBtn.show();
|
||||
}
|
||||
})
|
||||
});
|
||||
})
|
||||
</script>
|
@ -0,0 +1,7 @@
|
||||
class AddColumnsToLibraries < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :libraries, :author_name, :string
|
||||
add_column :libraries, :author_school_name, :string
|
||||
add_column :libraries, :cover_id, :integer
|
||||
end
|
||||
end
|
After Width: | Height: | Size: 18 KiB |
After Width: | Height: | Size: 169 B |
Loading…
Reference in new issue