Merge remote-tracking branch 'origin/szzh' into szzh

This commit is contained in:
lizanle 2015-10-16 10:54:41 +08:00
commit 7a17186ca3
12 changed files with 71 additions and 62 deletions

View File

@ -71,7 +71,8 @@
$(function () { $(function () {
init_activity_KindEditor_data(<%= topic.id%>, null, "87%"); init_activity_KindEditor_data(<%= topic.id%>, null, "87%");
var description_images=$("div#activity_description_<%= topic.id %>").find("img"); showNormalImage('activity_description_<%= topic.id %>');
/*var description_images=$("div#activity_description_<%#= topic.id %>").find("img");
if (description_images.length>0) { if (description_images.length>0) {
for (var i=0; i<description_images.length; i++){ for (var i=0; i<description_images.length; i++){
var image=$(description_images[i]); var image=$(description_images[i]);
@ -79,17 +80,7 @@
image.wrap(element); image.wrap(element);
} }
} }
$('#activity_description_<%= topic.id %> a').colorbox({rel:'nofollow', close: "关闭", returnFocus: false}); $('#activity_description_<%#= topic.id %> a').colorbox({rel:'nofollow', close: "关闭", returnFocus: false});*/
var reply_images=$("div#reply_content_<%= topic.id %>").find("img");
if (reply_images.length>0) {
for (var i=0; i<reply_images.length; i++){
var image=$(reply_images[i]);
var element=$("<a></a>").attr("href",image.attr('src'));
image.wrap(element);
}
}
$('#reply_content_<%= topic.id %> a').colorbox({rel:'nofollow', close: "关闭", returnFocus: false});
}); });
</script> </script>
<% if topic %> <% if topic %>

View File

@ -74,25 +74,7 @@
$(function () { $(function () {
init_activity_KindEditor_data(<%= activity.id%>, null, "87%"); init_activity_KindEditor_data(<%= activity.id%>, null, "87%");
var description_images=$("div#activity_description_<%= activity.id %>").find("img"); showNormalImage('activity_description_<%= activity.id %>');
if (description_images.length>0) {
for (var i=0; i<description_images.length; i++){
var image=$(description_images[i]);
var element=$("<a></a>").attr("href",image.attr('src'));
image.wrap(element);
}
}
$('#activity_description_<%= activity.id %> a').colorbox({rel:'nofollow', close: "关闭", returnFocus: false});
var reply_images=$("div#reply_content_<%= activity.id %>").find("img");
if (reply_images.length>0) {
for (var i=0; i<reply_images.length; i++){
var image=$(reply_images[i]);
var element=$("<a></a>").attr("href",image.attr('src'));
image.wrap(element);
}
}
$('#reply_content_<%= activity.id %> a').colorbox({rel:'nofollow', close: "关闭", returnFocus: false});
}); });
</script> </script>
<% if activity && activity.course_act%> <% if activity && activity.course_act%>

View File

@ -25,6 +25,7 @@
} }
$(function() { $(function() {
init_activity_KindEditor_data(<%= @topic.id%>,null,"85%"); init_activity_KindEditor_data(<%= @topic.id%>,null,"85%");
showNormalImage('message_description_<%= @topic.id %>');
}); });
</script> </script>
<div class="postRightContainer ml10" onmouseover="$('#message_setting_<%= @topic.id%>').show();" onmouseout="$('#message_setting_<%= @topic.id%>').hide();"> <div class="postRightContainer ml10" onmouseover="$('#message_setting_<%= @topic.id%>').show();" onmouseout="$('#message_setting_<%= @topic.id%>').hide();">
@ -73,7 +74,7 @@
</div> </div>
<div class="postDetailDate mb5"><%= format_time( @topic.created_on)%></div> <div class="postDetailDate mb5"><%= format_time( @topic.created_on)%></div>
<div class="cl"></div> <div class="cl"></div>
<div class="memo-content upload_img break_word" style="word-break: break-all; word-wrap:break-word;margin-bottom: 0px !important;" > <div class="memo-content upload_img break_word" id="message_description_<%= @topic.id %>" style="word-break: break-all; word-wrap:break-word;margin-bottom: 0px !important;" >
<%= @topic.content.html_safe%> <%= @topic.content.html_safe%>
</div> </div>
<div class="cl"></div> <div class="cl"></div>
@ -97,6 +98,11 @@
</div> </div>
<div class="" id="reply_div_<%= @topic.id %>"> <div class="" id="reply_div_<%= @topic.id %>">
<% @replies.each_with_index do |reply,i| %> <% @replies.each_with_index do |reply,i| %>
<script type="text/javascript">
$(function(){
showNormalImage('reply_message_description_<%= reply.id %>');
});
</script>
<div class="homepagePostReplyContainer" onmouseover="$('#reply_edit_menu_<%= reply.id%>').show();" onmouseout="$('#reply_edit_menu_<%= reply.id%>').hide();"> <div class="homepagePostReplyContainer" onmouseover="$('#reply_edit_menu_<%= reply.id%>').show();" onmouseout="$('#reply_edit_menu_<%= reply.id%>').hide();">
<div class="homepagePostReplyPortrait"> <div class="homepagePostReplyPortrait">
<%= link_to image_tag(url_to_avatar(reply.author), :width => 33,:height => 33), user_path(reply.author) %> <%= link_to image_tag(url_to_avatar(reply.author), :width => 33,:height => 33), user_path(reply.author) %>
@ -109,7 +115,9 @@
<%= link_to reply.try(:author).try(:realname), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %> <%= link_to reply.try(:author).try(:realname), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %>
<% end %> <% end %>
</div> </div>
<div class="homepagePostReplyContent upload_img break_word"><%= reply.content.html_safe%></div> <div class="homepagePostReplyContent upload_img break_word" id="reply_message_description_<%= reply.id %>">
<%= reply.content.html_safe%>
</div>
<div style="margin-top: -7px; margin-bottom: 5px"> <div style="margin-top: -7px; margin-bottom: 5px">
<%= format_time(reply.created_on) %> <%= format_time(reply.created_on) %>
<div class="fr" id="reply_edit_menu_<%= reply.id%>" style="display: none"> <div class="fr" id="reply_edit_menu_<%= reply.id%>" style="display: none">

View File

@ -16,8 +16,8 @@
<div class="ReplyToMessageInputContainer mb10"> <div class="ReplyToMessageInputContainer mb10">
<div nhname='new_message_<%= reply.id%>'> <div nhname='new_message_<%= reply.id%>'>
<%= form_for @reply, :as => :reply, :url => {:action => 'reply', :id => @topic}, :html => {:multipart => true, :id => 'new_form'} do |f| %> <%= form_for @reply, :as => :reply, :url => {:action => 'reply', :id => @topic}, :html => {:multipart => true, :id => 'new_form'} do |f| %>
<input type="hidden" name="quote[quote]" value="<%= temp.content %>"> <input type="hidden" name="quote[quote]" id="quote_quote">
<input type="hidden" name="reply[subject]" value="<%= subject %>"> <input type="hidden" name="reply[subject]" id="reply_subject">
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= reply.id%>' name="reply[content]"></textarea> <textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= reply.id%>' name="reply[content]"></textarea>
<div nhname='toolbar_container_<%= reply.id%>' style="float:left; margin-left: 5px; padding-top:3px;"></div> <div nhname='toolbar_container_<%= reply.id%>' style="float:left; margin-left: 5px; padding-top:3px;"></div>
<a id="new_message_submit_btn_<%= reply.id%>" href="javascript:void(0)" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a> <a id="new_message_submit_btn_<%= reply.id%>" href="javascript:void(0)" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>

View File

@ -9,6 +9,8 @@ $("img").removeAttr("align");*/
if($("#reply_message_<%= @message.id%>").length > 0) { if($("#reply_message_<%= @message.id%>").length > 0) {
$("#reply_message_<%= @message.id%>").replaceWith("<%= escape_javascript(render :partial => 'reply_message', :locals => {:reply => @message,:temp =>@temp,:subject =>@subject}) %>"); $("#reply_message_<%= @message.id%>").replaceWith("<%= escape_javascript(render :partial => 'reply_message', :locals => {:reply => @message,:temp =>@temp,:subject =>@subject}) %>");
$(function(){ $(function(){
$('#reply_subject').val("<%= raw escape_javascript(@subject) %>");
$('#quote_quote').val("<%= raw escape_javascript(@temp.content.html_safe) %>");
init_activity_KindEditor_data(<%= @message.id%>,null,"85%"); init_activity_KindEditor_data(<%= @message.id%>,null,"85%");
}); });
}else if($("#reply_to_message_<%= @message.id%>").length >0) { }else if($("#reply_to_message_<%= @message.id%>").length >0) {

View File

@ -48,6 +48,11 @@
<div class="" id="reply_div_<%= user_activity_id %>"> <div class="" id="reply_div_<%= user_activity_id %>">
<ul> <ul>
<% course.journals_for_messages.where('m_parent_id IS NULL').reorder("created_on desc").each do |comment| %> <% course.journals_for_messages.where('m_parent_id IS NULL').reorder("created_on desc").each do |comment| %>
<script type="text/javascript">
$(function(){
showNormalImage('reply_content_<%= comment.id %>');
});
</script>
<% replies_all_i = replies_all_i + 1 %> <% replies_all_i = replies_all_i + 1 %>
<li class="homepagePostReplyContainer" nhname="reply_rec" style="display:<%= replies_all_i > 3 ? 'none' : '' %>"> <li class="homepagePostReplyContainer" nhname="reply_rec" style="display:<%= replies_all_i > 3 ? 'none' : '' %>">
<div class="homepagePostReplyPortrait"> <div class="homepagePostReplyPortrait">
@ -62,9 +67,14 @@
<% end %> <% end %>
<%= format_time(comment.created_on) %> <%= format_time(comment.created_on) %>
</div> </div>
<div class="homepagePostReplyContent break_word list_style upload_img" id="reply_content_<%= user_activity_id %>"> <div class="homepagePostReplyContent break_word list_style upload_img" id="reply_content_<%= comment.id %>">
<%= comment.notes.html_safe %></div> <%= comment.notes.html_safe %></div>
<% fetch_user_leaveWord_reply(comment).each do |reply| unless fetch_user_leaveWord_reply(comment).nil? %> <% fetch_user_leaveWord_reply(comment).each do |reply| unless fetch_user_leaveWord_reply(comment).nil? %>
<script type="text/javascript">
$(function(){
showNormalImage('reply_to_content_<%= reply.id %>');
});
</script>
<div class="recall"> <div class="recall">
<div class="homepagePostReplyPortrait"> <div class="homepagePostReplyPortrait">
<%= link_to image_tag(url_to_avatar(reply.user), :width => "33", :height => "33", :class =>"mt8"), user_path(reply.user_id), :alt => "用户头像" %> <%= link_to image_tag(url_to_avatar(reply.user), :width => "33", :height => "33", :class =>"mt8"), user_path(reply.user_id), :alt => "用户头像" %>
@ -84,7 +94,7 @@
<% end %> <% end %>
<%= format_time reply.created_on %> <%= format_time reply.created_on %>
</div> </div>
<div class="homepagePostReplyContent break_word list_style upload_img" style="max-width: 580px;" id="reply_content_<%= user_activity_id %>"> <div class="homepagePostReplyContent break_word list_style upload_img" style="max-width: 580px;" id="reply_to_content_<%= reply.id %>">
<%= reply.notes.html_safe %></div> <%= reply.notes.html_safe %></div>
<div class="cl"></div> <div class="cl"></div>
</div> </div>

View File

@ -77,6 +77,11 @@
<div class="" id="reply_div_<%= user_activity_id %>"> <div class="" id="reply_div_<%= user_activity_id %>">
<ul> <ul>
<% activity.children.reorder("created_on desc").each do |reply|%> <% activity.children.reorder("created_on desc").each do |reply|%>
<script type="text/javascript">
$(function(){
showNormalImage('reply_content_<%= reply.id %>');
});
</script>
<% replies_all_i=replies_all_i+1 %> <% replies_all_i=replies_all_i+1 %>
<li class="homepagePostReplyContainer" nhname="reply_rec" style="display:<%= replies_all_i>3 ? 'none' : '' %>"> <li class="homepagePostReplyContainer" nhname="reply_rec" style="display:<%= replies_all_i>3 ? 'none' : '' %>">
<div class="homepagePostReplyPortrait"> <div class="homepagePostReplyPortrait">
@ -91,7 +96,7 @@
<% end %> <% end %>
<%= format_time(reply.created_on) %> <%= format_time(reply.created_on) %>
</div> </div>
<div class="homepagePostReplyContent break_word list_style upload_img" id="reply_content_<%= user_activity_id %>"> <div class="homepagePostReplyContent break_word list_style upload_img" id="reply_content_<%= reply.id %>">
<%= reply.content.html_safe %> <%= reply.content.html_safe %>
</div> </div>
</div> </div>
@ -102,6 +107,7 @@
</div> </div>
<% end %> <% end %>
<% if !activity.locked? && authorize_for_course('messages', 'reply') %>
<div class="homepagePostReplyContainer borderBottomNone minHeight48"> <div class="homepagePostReplyContainer borderBottomNone minHeight48">
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= user_activity_id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %></div> <div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= user_activity_id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %></div>
<div class="homepagePostReplyInputContainer mb10"> <div class="homepagePostReplyInputContainer mb10">
@ -121,5 +127,6 @@
</div> </div>
<div class="cl"></div> <div class="cl"></div>
</div> </div>
<% end %>
</div> </div>
</div> </div>

View File

@ -46,6 +46,11 @@
<div class="" id="reply_div_<%= user_activity_id %>"> <div class="" id="reply_div_<%= user_activity_id %>">
<ul> <ul>
<% activity.comments.reorder("created_on desc").each do |comment| %> <% activity.comments.reorder("created_on desc").each do |comment| %>
<script type="text/javascript">
$(function(){
showNormalImage('reply_content_<%= comment.id %>');
});
</script>
<% replies_all_i = replies_all_i + 1 %> <% replies_all_i = replies_all_i + 1 %>
<li class="homepagePostReplyContainer" nhname="reply_rec" style="display:<%= replies_all_i > 3 ? 'none' : '' %>"> <li class="homepagePostReplyContainer" nhname="reply_rec" style="display:<%= replies_all_i > 3 ? 'none' : '' %>">
<div class="homepagePostReplyPortrait"> <div class="homepagePostReplyPortrait">
@ -60,7 +65,7 @@
<% end %> <% end %>
<%= format_time(comment.created_on) %> <%= format_time(comment.created_on) %>
</div> </div>
<div class="homepagePostReplyContent break_word list_style upload_img" id="reply_content_<%= user_activity_id %>"> <div class="homepagePostReplyContent break_word list_style upload_img" id="reply_content_<%= comment.id %>">
<%= comment.comments.html_safe %></div> <%= comment.comments.html_safe %></div>
</div> </div>
<div class="cl"></div> <div class="cl"></div>

View File

@ -83,6 +83,11 @@
<div class="" id="reply_div_<%= user_activity_id %>"> <div class="" id="reply_div_<%= user_activity_id %>">
<ul> <ul>
<% activity.journals.reorder("created_on desc").each do |reply| %> <% activity.journals.reorder("created_on desc").each do |reply| %>
<script type="text/javascript">
$(function(){
showNormalImage('reply_content_<%= reply.id %>');
});
</script>
<% replies_all_i=replies_all_i + 1 %> <% replies_all_i=replies_all_i + 1 %>
<li class="homepagePostReplyContainer" nhname="reply_rec" style="display:<%= replies_all_i>3 ? 'none' : '' %>"> <li class="homepagePostReplyContainer" nhname="reply_rec" style="display:<%= replies_all_i>3 ? 'none' : '' %>">
<div class="homepagePostReplyPortrait"> <div class="homepagePostReplyPortrait">
@ -97,7 +102,7 @@
<% end %> <% end %>
<%= format_time(reply.created_on) %> <%= format_time(reply.created_on) %>
</div> </div>
<div class="homepagePostReplyContent break_word list_style upload_img" id="reply_content_<%= user_activity_id %>"> <div class="homepagePostReplyContent break_word list_style upload_img" id="reply_content_<%= reply.id %>">
<% if reply.details.any? %> <% if reply.details.any? %>
<% details_to_strings(reply.details).each do |string| %> <% details_to_strings(reply.details).each do |string| %>
<p><%= string %></p> <p><%= string %></p>

View File

@ -60,6 +60,11 @@
<div class="" id="reply_div_<%= user_activity_id %>"> <div class="" id="reply_div_<%= user_activity_id %>">
<ul> <ul>
<% activity.children.reorder("created_on desc").each do |reply| %> <% activity.children.reorder("created_on desc").each do |reply| %>
<script type="text/javascript">
$(function(){
showNormalImage('reply_content_<%= reply.id %>');
});
</script>
<% replies_all_i=replies_all_i+1 %> <% replies_all_i=replies_all_i+1 %>
<li class="homepagePostReplyContainer" nhname="reply_rec" style="display:<%= replies_all_i>3 ? 'none' : '' %>"> <li class="homepagePostReplyContainer" nhname="reply_rec" style="display:<%= replies_all_i>3 ? 'none' : '' %>">
<div class="homepagePostReplyPortrait"> <div class="homepagePostReplyPortrait">
@ -74,7 +79,7 @@
<% end %> <% end %>
<%= format_time(reply.created_on) %> <%= format_time(reply.created_on) %>
</div> </div>
<div class="homepagePostReplyContent break_word list_style upload_img" id="reply_content_<%= user_activity_id %>"> <div class="homepagePostReplyContent break_word list_style upload_img" id="reply_content_<%= reply.id %>">
<%= reply.content.html_safe %></div> <%= reply.content.html_safe %></div>
</div> </div>
<div class="cl"></div> <div class="cl"></div>

View File

@ -37,27 +37,8 @@
} }
$(function() { $(function() {
init_activity_KindEditor_data(<%= user_activity.id%>,null,"87%"); init_activity_KindEditor_data(<%= user_activity.id%>, null, "87%");
var description_images=$("div#activity_description_<%= user_activity.id %>").find("img"); showNormalImage('activity_description_<%= user_activity.id %>');
if (description_images.length>0) {
for (var i=0; i<description_images.length; i++){
var image=$(description_images[i]);
var element=$("<a></a>").attr("href",image.attr('src'));
image.wrap(element);
}
}
$('#activity_description_<%= user_activity.id %> a').colorbox({rel:'nofollow', close: "关闭", returnFocus: false});
var reply_images=$("div#reply_content_<%= user_activity.id %>").find("img");
if (reply_images.length>0) {
for (var i=0; i<reply_images.length; i++){
var image=$(reply_images[i]);
var element=$("<a></a>").attr("href",image.attr('src'));
image.wrap(element);
}
}
$('#reply_content_<%= user_activity.id %> a').colorbox({rel:'nofollow', close: "关闭", returnFocus: false});
}); });
</script> </script>
<% act= user_activity.act unless user_activity.act_type == "ProjectCreateInfo" %> <% act= user_activity.act unless user_activity.act_type == "ProjectCreateInfo" %>

View File

@ -952,3 +952,16 @@ $(document).ready(function () {
$("pre").addClass("break_word"); $("pre").addClass("break_word");
} }
}); });
//点击图片即显示大图
function showNormalImage(id) {
var description_images=$('div#'+id).find("img");
if (description_images.length>0) {
for (var i=0; i<description_images.length; i++){
var image=$(description_images[i]);
var element=$("<a></a>").attr("href",image.attr('src'));
image.wrap(element);
}
}
$('#'+id+' a').colorbox({rel:'nofollow', close: "关闭", returnFocus: false});
}