socialforge/app/views/users/_user_activities.html.erb

105 lines
5.6 KiB
Plaintext

<% user_activities.each do |user_activity|
unless user_activities.nil? %>
<script>
//$(function(){if($("#contentmessage<%#=topic.id %>").height()>182){$("#project_show_<%#= topic.id%>").show();}});
//解决由于图片加载慢造成div高度不够 以至于展开按钮不显示的bug
$(function(){
function nh_show_btn(){
if($("#activity_message_<%= user_activity.id%>").is(':hidden')){
if($("#activity_description_<%= user_activity.id%>").height()>120){
$("#activity_description_<%= user_activity.id%>").toggleClass("activity_description_maxHeight");
$("#activity_message_<%= user_activity.id%>").show();
}
}
}
var div = $("#activity_description_<%= user_activity.id%>");
var imgs = $('img',div);
var lens = imgs.length;
function nh_load_img_end(){
nh_show_btn();
}
if(lens > 0){
$('img',div).load(function(){
nh_load_img_end();
});
}
nh_show_btn();
});
function show_more_reply(contentid, id2, id3) {
$(contentid).toggleClass("activity_description_maxHeight");
$(contentid).toggleClass("course_description_none");
var information = $(id2);
var arrow = $(id3);
var val = information.attr("value");
if (val == "show_more") {
$(id2).text("[收起]");
information.attr("value", "hide_more");
arrow.attr("src", "/images/jiantouup.jpg")
}
else {
$(id2).text("[展开]");
information.attr("value", "show_more");
arrow.attr("src", "/images/jiantou.jpg")
}
}
function expand_reply(container,btnid){
var target = $(container);
var btn = $(btnid);
//var jumpobj = $("#reply_div_<%#= activity.id %>");
if(btn.data('init')=='0'){
btn.data('init',1);
btn.html('收起回复('+btn.data('count')+')');
target.show();
}else{
btn.data('init',0);
btn.html('点击展开更多回复('+btn.data('count')+')');
target.hide();
target.eq(0).show();
target.eq(1).show();
}
}
</script>
<% act= user_activity.act unless user_activity.act_type == "ProjectCreateInfo" %>
<% case user_activity.container_type.to_s %>
<% when 'Course' %>
<% if act %>
<% case user_activity.act_type.to_s %>
<% when 'HomeworkCommon' %>
<%= render :partial => 'course_homework', :locals => {:activity => act,:user_activity =>user_activity} %>
<% when 'News' %>
<%= render :partial => 'course_news', :locals => {:activity => act,:user_activity =>user_activity} %>
<% when 'Message'%>
<%= render :partial => 'course_message', :locals => {:activity => act,:user_activity =>user_activity} %>
<%# when 'Course'%>
<%#= render :partial => 'course_create', :locals => {:activity => act,:user_activity =>user_activity} %>
<%# when 'Attachment' %>
<%#= render :partial => 'course_attachment', :locals => {:activity => act, :user_activity => user_activity} %>
<%# when 'JournalsForMessage' %>
<%#= render :partial => 'course_journalsformessage', :locals => {:activity => act, :user_activity => user_activity} %>
<% when 'Poll' %>
<%= render :partial => 'course_poll', :locals => {:activity => act, :user_activity => user_activity} %>
<% end %>
<% end %>
<% when 'Project' %>
<% if act %>
<% case user_activity.act_type.to_s %>
<% when 'Issue' %>
<%= render :partial => 'project_issue', :locals => {:activity => act,:user_activity =>user_activity} %>
<% when 'Message' %>
<%= render :partial => 'project_message', :locals => {:activity => act,:user_activity =>user_activity} %>
<%# when 'Journal' %>
<%#= render :partial => 'project_journal', :locals => {:activity => act,:user_activity =>user_activity} %>
<%# when 'News' %>
<%#= render :partial => 'project_news', :locals => {:activity => act,:user_activity =>user_activity} %>
<%# when 'Document' %>
<%#= render :partial => 'project_document', :locals => {:activity => act,:user_activity =>user_activity} %>
<%# when 'Attachment' %>
<%#= render :partial => 'project_attachment', :locals => {:activity => act,:user_activity =>user_activity} %>
<%# when 'ProjectCreateInfo' %>
<%#= render :partial => 'project_create', :locals => {:activity => act,:user_activity =>user_activity} %>
<% end %>
<% end %>
<% end %>
<% end %>
<% end %>
<input type="hidden" value="<%= page%>" id="show_more_activities" />