个人动态首页只显示第一个动态的回复框,其它的需点击才显示

This commit is contained in:
cxt 2015-09-16 15:40:05 +08:00
parent a714b10860
commit a184ab4b69
5 changed files with 19 additions and 14 deletions

View File

@ -49,7 +49,7 @@
<div class="homepagePostReply"> <div class="homepagePostReply">
<div class="homepagePostReplyBanner"> <div class="homepagePostReplyBanner">
<% count=0 %> <% count=0 %>
<div class="homepagePostReplyBannerCount">回复( <div class="homepagePostReplyBannerCount" onclick="expand_reply_input('#reply_input_<%= user_activity_id %>');">回复(
<% if activity.parent %> <% if activity.parent %>
<% count=activity.parent.children.count%> <% count=activity.parent.children.count%>
<% else %> <% else %>
@ -67,7 +67,7 @@
<% end %> <% end %>
</div> </div>
<div class="homepagePostReplyInputContainer"> <div class="homepagePostReplyInputContainer" id="reply_input_<%= user_activity_id %>" style="display: <%= (page==0 && first_user_activity == user_activity_id) ? '' : 'none'%>">
<div nhname='new_message_<%= user_activity_id%>' style="display:none;"> <div nhname='new_message_<%= user_activity_id%>' style="display:none;">
<%= form_for('new_form',:url => {:controller=>'messages',:action => 'reply', :id => activity.id, :board_id => activity.board_id, :is_board => 'true'},:method => "post", :remote => true) do |f|%> <%= form_for('new_form',:url => {:controller=>'messages',:action => 'reply', :id => activity.id, :board_id => activity.board_id, :is_board => 'true'},:method => "post", :remote => true) do |f|%>
<input type="hidden" name="quote[quote]" value=""> <input type="hidden" name="quote[quote]" value="">

View File

@ -27,7 +27,7 @@
<div class="homepagePostReply"> <div class="homepagePostReply">
<div class="homepagePostReplyBanner"> <div class="homepagePostReplyBanner">
<% count=activity.comments.count %> <% count=activity.comments.count %>
<div class="homepagePostReplyBannerCount"> <div class="homepagePostReplyBannerCount" onclick="expand_reply_input('#reply_input_<%= user_activity_id %>');">
回复(<%= count %> 回复(<%= count %>
</div> </div>
<div class="homepagePostReplyBannerTime"><%#= format_date(activity.updated_on) %></div> <div class="homepagePostReplyBannerTime"><%#= format_date(activity.updated_on) %></div>
@ -40,7 +40,7 @@
<% end %> <% end %>
</div> </div>
<div class="homepagePostReplyInputContainer"> <div class="homepagePostReplyInputContainer" id="reply_input_<%= user_activity_id %>" style="display: <%= (page==0 && first_user_activity == user_activity_id) ? '' : 'none'%>">
<div nhname='new_message_<%= user_activity_id%>' style="display:none;"> <div nhname='new_message_<%= user_activity_id%>' style="display:none;">
<%= form_for('new_form',:url => {:controller => 'comments', :action => 'create', :id => activity},:method => "post", :remote => true) do |f|%> <%= form_for('new_form',:url => {:controller => 'comments', :action => 'create', :id => activity},:method => "post", :remote => true) do |f|%>
<input type="hidden" name="user_activity_id" value="<%=user_activity_id%>"> <input type="hidden" name="user_activity_id" value="<%=user_activity_id%>">

View File

@ -67,7 +67,7 @@
<div class="homepagePostReplyBanner"> <div class="homepagePostReplyBanner">
<% count = activity.journals.count %> <% count = activity.journals.count %>
<div class="homepagePostReplyBannerCount">回复(<%= count %></div> <div class="homepagePostReplyBannerCount" onclick="expand_reply_input('#reply_input_<%= user_activity_id %>');">回复(<%= count %></div>
<div class="homepagePostReplyBannerTime"><%#= format_date(activity.updated_on) %></div> <div class="homepagePostReplyBannerTime"><%#= format_date(activity.updated_on) %></div>
<% if count > 2 %> <% if count > 2 %>
<div class="homepagePostReplyBannerMore"> <div class="homepagePostReplyBannerMore">
@ -78,7 +78,7 @@
<% end %> <% end %>
</div> </div>
<div class="homepagePostReplyInputContainer"> <div class="homepagePostReplyInputContainer" id="reply_input_<%= user_activity_id %>" style="display: <%= (page==0 && first_user_activity == user_activity_id) ? '' : 'none'%>">
<div nhname='new_message_<%= user_activity_id%>' style="display:none;"> <div nhname='new_message_<%= user_activity_id%>' style="display:none;">
<%= form_for('new_form',:url => add_journal_issue_path(activity.id),:method => "post", :remote => true) do |f|%> <%= form_for('new_form',:url => add_journal_issue_path(activity.id),:method => "post", :remote => true) do |f|%>
<input type="hidden" name="user_activity_id" value="<%=user_activity_id%>"> <input type="hidden" name="user_activity_id" value="<%=user_activity_id%>">

View File

@ -39,7 +39,7 @@
<div class="homepagePostReply"> <div class="homepagePostReply">
<div class="homepagePostReplyBanner"> <div class="homepagePostReplyBanner">
<% count = 0 %> <% count = 0 %>
<div class="homepagePostReplyBannerCount">回复( <div class="homepagePostReplyBannerCount" onclick="expand_reply_input('#reply_input_<%= user_activity_id %>');">回复(
<% if activity.parent %> <% if activity.parent %>
<% count=activity.parent.children.count%> <% count=activity.parent.children.count%>
<% else %> <% else %>
@ -53,7 +53,7 @@
<% end %> <% end %>
</div> </div>
<div class="homepagePostReplyInputContainer"> <div class="homepagePostReplyInputContainer" id="reply_input_<%= user_activity_id %>" style="display: <%= (page==0 && first_user_activity == user_activity_id) ? '' : 'none'%>">
<div nhname='new_message_<%= user_activity_id%>' style="display:none;"> <div nhname='new_message_<%= user_activity_id%>' style="display:none;">
<%= form_for('new_form',:url => {:controller=>'messages',:action => 'reply', :id => activity.id, :board_id => activity.board_id, :is_board => 'true'},:method => "post", :remote => true) do |f|%> <%= form_for('new_form',:url => {:controller=>'messages',:action => 'reply', :id => activity.id, :board_id => activity.board_id, :is_board => 'true'},:method => "post", :remote => true) do |f|%>
<input type="hidden" name="quote[quote]" value=""> <input type="hidden" name="quote[quote]" value="">

View File

@ -10,6 +10,7 @@
div.ke-toolbar .ke-outline{border:none;} div.ke-toolbar .ke-outline{border:none;}
.ke-inline-block{display: none;} .ke-inline-block{display: none;}
</style> </style>
<% first_user_activity = user_activities.first.id %>
<% user_activities.each do |user_activity| <% user_activities.each do |user_activity|
if user_activities %> if user_activities %>
<script> <script>
@ -29,6 +30,10 @@
} }
} }
function expand_reply_input(id) {
$(id).toggle();
}
$(function() { $(function() {
init_KindEditor_data(<%= user_activity.id%>); init_KindEditor_data(<%= user_activity.id%>);
}); });
@ -39,22 +44,22 @@
<% if act %> <% if act %>
<% case user_activity.act_type.to_s %> <% case user_activity.act_type.to_s %>
<% when 'HomeworkCommon' %> <% when 'HomeworkCommon' %>
<%= render :partial => 'course_homework', :locals => {:activity => act,:user_activity_id =>user_activity.id} %> <%= render :partial => 'course_homework', :locals => {:activity => act,:user_activity_id =>user_activity.id,:first_user_activity =>first_user_activity,:page => page} %>
<% when 'News' %> <% when 'News' %>
<%= render :partial => 'course_news', :locals => {:activity => act,:user_activity_id =>user_activity.id} %> <%= render :partial => 'course_news', :locals => {:activity => act,:user_activity_id =>user_activity.id,:first_user_activity =>first_user_activity,:page => page} %>
<% when 'Message'%> <% when 'Message'%>
<%= render :partial => 'course_message', :locals => {:activity => act,:user_activity_id =>user_activity.id} %> <%= render :partial => 'course_message', :locals => {:activity => act,:user_activity_id =>user_activity.id,:first_user_activity =>first_user_activity,:page => page} %>
<% when 'Poll' %> <% when 'Poll' %>
<%= render :partial => 'course_poll', :locals => {:activity => act, :user_activity_id => user_activity.id} %> <%= render :partial => 'course_poll', :locals => {:activity => act, :user_activity_id => user_activity.id,:first_user_activity =>first_user_activity,:page => page} %>
<% end %> <% end %>
<% end %> <% end %>
<% when 'Project' %> <% when 'Project' %>
<% if act %> <% if act %>
<% case user_activity.act_type.to_s %> <% case user_activity.act_type.to_s %>
<% when 'Issue' %> <% when 'Issue' %>
<%= render :partial => 'project_issue', :locals => {:activity => act,:user_activity_id =>user_activity.id} %> <%= render :partial => 'project_issue', :locals => {:activity => act,:user_activity_id =>user_activity.id,:first_user_activity =>first_user_activity,:page => page} %>
<% when 'Message' %> <% when 'Message' %>
<%= render :partial => 'project_message', :locals => {:activity => act,:user_activity_id =>user_activity.id} %> <%= render :partial => 'project_message', :locals => {:activity => act,:user_activity_id =>user_activity.id,:first_user_activity =>first_user_activity,:page => page} %>
<% end %> <% end %>
<% end %> <% end %>
<% end %> <% end %>