动态样式冲突问题

This commit is contained in:
huang 2016-10-27 11:16:51 +08:00
parent 3cc9899e5d
commit c4b32438ee
3 changed files with 110 additions and 3 deletions

View File

@ -3534,7 +3534,7 @@ class UsersController < ApplicationController
@type = 'OrgDocumentComment'
#comments = []
@journals = OrgDocumentComment.where("root_id = #{params[:id].to_i}").reorder("created_at desc")
when 'Message'
when 'Message','is_project_message'
#obj = Message.where('id = ?', params[:id].to_i).first
@type = 'Message'
@is_course = params[:is_course]
@ -3558,7 +3558,7 @@ class UsersController < ApplicationController
@journals = JournalsForMessage.where("root_id = #{params[:id].to_i}").reorder("created_on desc")
@type = 'JournalsForMessage'
@user_activity_id = params[:div_id].to_i if params[:div_id]
when 'Issue'
when 'Issue', 'is_project_issue'
obj = Issue.where('id = ?', params[:id].to_i).first
@journals = obj.journals.reorder("created_on desc")
@type = 'Issue'

View File

@ -0,0 +1,107 @@
<ul>
<% comments.each do |comment| %>
<script type="text/javascript">
$(function(){
showNormalImage('reply_content_<%= comment.id %>');
autoUrl('reply_content_<%= comment.id %>');
});
</script>
<li class="reply-container" nhname="reply_rec">
<div class="homepagePostReplyPortrait">
<%= link_to image_tag(url_to_avatar(comment.creator_user), :width => 33, :height => 33, :alt => "用户头像"), user_url_in_org(comment.creator_user.id) %>
</div>
<div class="reply-content ml10" onmouseover="$('#delete_reply_<%=activity_id %>_<%=comment.id %>').show();" onmouseout="$('#delete_reply_<%=activity_id %>_<%=comment.id %>').hide();">
<%= render :partial => 'users/news_contents', :locals => {:comment => comment}%>
<% if !comment.content_detail.blank? || comment.class == Journal %>
<div class="homepagePostReplyContent break_word list_style upload_img table_maxWidth" id="reply_content_<%= comment.id %>">
<% if comment.class == Journal %>
<% if comment.details.any? %>
<% details_to_strings(comment.details).each do |string| %>
<p><%= string %></p>
<% end %>
<% end %>
<P><%= comment.notes.html_safe %></P>
<% else %>
<%= comment.content_detail.html_safe %>
<% end %>
</div>
<div class="orig_reply mb10 mt-10">
<div class="reply">
<span class="reply-right">
<span id="reply_praise_count_<%= comment.id %>">
<%= render :partial => "praise_tread/praise", :locals => {:activity => comment, :user_activity_id => comment.id, :type => "reply"} %>
</span>
<% if type == 'HomeworkCommon' %>
<span style="position: relative" class="fr mr20">
<%= link_to(
l(:button_reply),
{:controller => 'users' ,:action => 'reply_to', :reply_id => comment.id, :type => 'HomeworkCommon', :hw_status => hw_status, :user_activity_id => user_activity_id},
:remote => true,
:method => 'get',
:title => l(:button_reply)) %>
<span id="reply_iconup_<%=comment.id %>" class="reply_iconup02" style="display: none"> ︿</span>
</span>
<% if User.current.admin? ||is_teacher || comment.user == User.current%>
<%= link_to('删除', {:controller => 'words', :action => 'destroy', :object_id => comment, :user_id => comment.user,:hw_status => hw_status, :user_activity_id => user_activity_id},
:id => "delete_reply_#{activity_id}_#{comment.id}",:remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "fr mr20 undis", :title => l(:button_delete)) %>
<% end %>
<% elsif type == 'News' %>
<span style="position: relative" class="fr mr20">
<%= link_to(
l(:button_reply),
{:controller => 'users', :action => 'reply_to', :reply_id => comment.id, :type => type, :user_activity_id => user_activity_id, :activity_id => activity_id},
:remote => true,
:method => 'get',
:title => l(:button_reply)) %>
<span id="reply_iconup_<%= comment.id %>" class="reply_iconup02" style="display: none"> ︿</span>
</span>
<% news = News.find(activity_id) %>
<%= link_to('删除', {:controller => 'comments', :action => 'destroy', :id => activity_id, :comment_id => comment, :user_activity_id => user_activity_id},
:id => "delete_reply_#{activity_id}_#{comment.id}",:remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "fr mr20 undis", :title => l(:button_delete)) if (User.current.allowed_to?(:manage_news, news.course) || User.current.allowed_to?(:manage_news, news.project)) %>
<% elsif type == 'Issue' %>
<span style="position: relative" class="fr mr20">
<%= link_to(
l(:button_reply),
{:controller => 'users', :action => 'reply_to', :reply_id => comment.id, :type => type, :user_activity_id => user_activity_id, :activity_id => activity_id},
:remote => true,
:method => 'get',
:title => l(:button_reply)) %>
<span id="reply_iconup_<%= comment.id %>" class="reply_iconup02" style="display: none"> ︿</span>
</span>
<%= link_to(
l(:button_delete),
{:controller => 'issues',:action => 'delete_journal', :id => activity_id,:journal_id=>comment.id, :user_activity_id => user_activity_id},
:method => 'get',
:confirm => l(:text_are_you_sure),
:remote=>true,
:id => "delete_reply_#{activity_id}_#{comment.id}",
:class => 'fr mr20 undis',
:title => l(:button_delete)
) if comment.user_id == User.current.id %>
<% elsif type == 'Syllabus' %>
<span style="position: relative" class="fr mr20">
<%= link_to(
l(:button_reply),
{:controller => 'users', :action => 'reply_to', :reply_id => comment.id, :type => type},
:remote => true,
:method => 'get',
:title => l(:button_reply)) %>
<span id="reply_iconup_<%= comment.id %>" class="reply_iconup02" style="display: none"> ︿</span>
</span>
<% if User.current.admin? || User.current == Syllabus.find(activity_id).user || comment.user == User.current%>
<%= link_to('删除', {:controller => 'words', :action => 'destroy', :object_id => comment, :user_id => comment.user},:id => "delete_reply_#{activity_id}_#{comment.id}",
:remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "fr mr20 undis", :title => l(:button_delete)) %>
<% end %>
<% end %>
</span>
<div class="cl"></div>
</div>
</div>
<p id="reply_message_<%= comment.id%>"></p>
<% end %>
</div>
<div class="cl"></div>
</li>
<% end %>
</ul>

View File

@ -11,7 +11,7 @@ $('#reply_div_<%= params[:div_id].to_i %>').html('<%=escape_javascript(render :p
<% elsif params[:type] == 'News' || params[:type] == 'Issue' || params[:type] == 'Syllabus' %>
$('#reply_div_<%= params[:div_id].to_i %>').html('<%=escape_javascript(render :partial => 'users/news_replies', :locals => {:comments => @journals, :user_activity_id => @user_activity_id, :type => @type, :activity_id => params[:id].to_i}) %>');
<% elsif params[:type] == 'is_project_issue' %>
$('#reply_div_<%= params[:div_id].to_i %>').html('<%=escape_javascript(render :partial => 'projects/project_issue_reply', :locals => {:comments => @journals, :user_activity_id => @user_activity_id, :type => @type, :activity_id => params[:id].to_i}) %>');
$('#reply_div_<%= params[:div_id].to_i %>').html('<%=escape_javascript(render :partial => 'projects/project_news_replies', :locals => {:comments => @journals, :user_activity_id => @user_activity_id, :type => @type, :activity_id => params[:id].to_i}) %>');
<% elsif params[:type] == 'is_project_message' %>
$('#reply_div_<%= params[:div_id].to_i %>').html('<%=escape_javascript(render :partial => 'projects/project_message_replies', :locals => {:comments => @journals,:user_activity_id => @user_activity_id, :type => @type, :activity_id => params[:id].to_i,:is_course => @is_course, :is_board => @is_board}) %>');
<% end %>