Conflicts:
	app/views/users/_user_activities.html.erb
This commit is contained in:
cxt 2015-09-01 16:23:44 +08:00
commit 735c374f73
3 changed files with 26 additions and 83 deletions

View File

@ -1,51 +1,21 @@
<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg',"init_KindEditor" %>
<style type="text/css">
/*回复框*/
div.ke-toolbar{display:none;width:400px;border:none;background:none;padding:0px 0px;}
span.ke-toolbar-icon{line-height:26px;font-size:14px;padding-left:26px;}
span.ke-toolbar-icon-url{background-image:url( /images/public_icon.png )}
div.ke-toolbar .ke-outline{padding:0px 0px;line-height:26px;font-size:14px;}
span.ke-icon-emoticons{background-position:0px -671px;width:50px;height:26px;}
span.ke-icon-emoticons:hover{background-position:-79px -671px;width:50px;height:26px;}
div.ke-toolbar .ke-outline{border:none;}
.ke-inline-block{display: none;}
</style>
<% user_activities.each do |user_activity|
unless user_activities.nil? %>
if user_activities %>
<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')+')');
@ -58,6 +28,10 @@
target.eq(1).show();
}
}
$(function() {
init_KindEditor_data(<%= user_activity.id%>);
});
</script>
<% act= user_activity.act unless user_activity.act_type == "ProjectCreateInfo" %>
<% case user_activity.container_type.to_s %>
@ -65,41 +39,26 @@
<% if act %>
<% case user_activity.act_type.to_s %>
<% when 'HomeworkCommon' %>
<%= render :partial => 'course_homework', :locals => {:activity => act,:user_activity =>user_activity} %>
<%= render :partial => 'course_homework', :locals => {:activity => act,:user_activity_id =>user_activity.id} %>
<% when 'News' %>
<%= render :partial => 'course_news', :locals => {:activity => act,:user_activity =>user_activity} %>
<%= render :partial => 'course_news', :locals => {:activity => act,:user_activity_id =>user_activity.id} %>
<% 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} %>
<%= render :partial => 'course_message', :locals => {:activity => act,:user_activity_id =>user_activity.id} %>
<% when 'Poll' %>
<%= render :partial => 'course_poll', :locals => {:activity => act, :user_activity => user_activity} %>
<%= render :partial => 'course_poll', :locals => {:activity => act, :user_activity_id => user_activity.id} %>
<% 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} %>
<%= render :partial => 'project_issue', :locals => {:activity => act,:user_activity_id =>user_activity.id} %>
<% 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} %>
<%= render :partial => 'project_message', :locals => {:activity => act,:user_activity_id =>user_activity.id} %>
<% end %>
<% end %>
<% end %>
<% end %>
<% end %>
<input type="hidden" value="<%= page%>" id="show_more_activities" />
<input type="hidden" value="<%= page%>"/>
<%= link_to "加载更多",user_activities_path(@user.id),:id => "show_more_activities",:remote => "true"%>

View File

@ -1,19 +1,3 @@
<script type="text/javascript">
var scrollHandler = function () {
if ($(window).scrollTop() == $(document).height() - $(window).height()) {
$.get(
'<%= user_activities_path(@user.id)%>',
{ page: $("#show_more_activities").val(),
type: $("#user_activities_type").val()},
function (data) {
}
);
}
};
$(window).scroll(scrollHandler);
</script>
<input type="hidden" value="<%= @type%>" name="type" id="user_activities_type">
<div class="resources">
<div class="homepageRightBanner">

View File

@ -1,4 +1,4 @@
$("#show_more_activities").replaceWith("<%= escape_javascript( render :partial => 'users/user_activities',:locals => {:user_activities => @user_activities, :page => @page} )%>");
<% if @user_activities.count < 10%>
$(window).off("scroll", scrollHandler);
$("#show_more_activities").hide();
<% end%>