实现点赞功能
This commit is contained in:
parent
8a7757f3c2
commit
ac59bc8623
|
@ -128,9 +128,6 @@ class HomeworkAttachController < ApplicationController
|
|||
pt.praise_tread_object_id = @homework.id
|
||||
pt.praise_tread_object_type = "HomeworkAttach"
|
||||
pt.praise_or_tread = 1
|
||||
@is_my_homework = params[:is_my_homework]
|
||||
@is_student_batch_homework = params[:is_student_batch_homework]
|
||||
@is_teacher = params[:is_teacher]
|
||||
if pt.save
|
||||
respond_to do |format|
|
||||
format.js
|
||||
|
|
|
@ -59,23 +59,8 @@
|
|||
</li>
|
||||
<% else %>
|
||||
<!-- 学生众评列表,显示为点赞 -->
|
||||
<% if is_praise_homework User.current.id,homework.id %>
|
||||
<li class="wzan" title="点赞">
|
||||
<%= link_to "",praise_homework_homework_attach_path(homework,:is_my_homework => is_my_homework,
|
||||
:is_student_batch_homework => is_student_batch_homework,
|
||||
:is_teacher => is_teacher),
|
||||
:class => "wzan_img wzan_visited", :remote => true%>
|
||||
<a>
|
||||
<%= praise_homework_count homework.id %>
|
||||
</a>
|
||||
</li>
|
||||
<% else %>
|
||||
<li class="wzan" title="您已经赞过该作业">
|
||||
<a href="#" target="_blank" class="wzan_img"></a>
|
||||
<a>
|
||||
<%= praise_homework_count homework.id %>
|
||||
</a>
|
||||
</li>
|
||||
<% end %>
|
||||
<li class="wzan" id="homeworl_praise_li_<%= homework.id%>">
|
||||
<%= render :partial => "homework_attach/homework_praise", locals: {:homework => homework} %>
|
||||
</li>
|
||||
<% end %>
|
||||
<% end %>
|
|
@ -0,0 +1,9 @@
|
|||
<% if is_praise_homework User.current.id,homework.id %>
|
||||
<%= link_to "",praise_homework_homework_attach_path(homework),
|
||||
:class => "wzan_img", :remote => true, :title => "点赞"%>
|
||||
<% else %>
|
||||
<a class="wzan_img wzan_visited" title="您已经赞过该作业"></a>
|
||||
<% end %>
|
||||
<a>
|
||||
<%= praise_homework_count homework.id %>
|
||||
</a>
|
|
@ -1,4 +1,3 @@
|
|||
$('#homework_li_<%= @homework.id%>').
|
||||
html('<%= escape_javascript(render :partial => 'homework_attach/homework',
|
||||
:locals => {:homework => @homework, :is_student_batch_homework => @is_student_batch_homework,
|
||||
:is_my_homework => @is_my_homework, :is_teacher => @is_teacher})%>');
|
||||
$('#homeworl_praise_li_<%= @homework.id%>').
|
||||
html('<%= escape_javascript(render :partial => 'homework_attach/homework_praise',
|
||||
:locals => {:homework => @homework})%>');
|
|
@ -60,7 +60,7 @@ ul.wlist{ float:right; border-bottom:none; height:30px; margin-top:20px; }
|
|||
.dis ul li.wmine{ margin:12px 0 0 10px;}
|
||||
.dis ul li.wmine a{ color:#3d7ec2; text-align:center; width:50px; font-weight: bold;}
|
||||
.wzan{ margin:15px 0 0 25px; width:32px; height:44px;}
|
||||
.wzan a{ display: block;}
|
||||
.wzan a{ display: block;text-align: center;}
|
||||
a.wzan_img{background:url(images/pic_zan.png) 0 -59px no-repeat; display:block; height:31px; width:30px; color:#fff;}
|
||||
a.wzan_visited{background:url(images/pic_zan.png) 0 0 no-repeat;}
|
||||
|
||||
|
|
Loading…
Reference in New Issue