This commit is contained in:
sw 2015-08-28 17:28:31 +08:00
commit 7ec10d7b39
9 changed files with 336 additions and 207 deletions

View File

@ -2493,4 +2493,14 @@ int main(int argc, char** argv){
return 0; return 0;
}".html_safe }".html_safe
end end
#判断用户是否已经提交了问卷
def has_commit_poll?(poll_id,user_id)
pu = PollUser.find_by_poll_id_and_user_id(poll_id,user_id)
if pu.nil?
false
else
true
end
end
end end

View File

@ -37,16 +37,6 @@ module PollHelper
pv.vote_text pv.vote_text
end end
end end
#判断用户是否已经提交了问卷
def has_commit_poll?(poll_id,user_id)
pu = PollUser.find_by_poll_id_and_user_id(poll_id,user_id)
if pu.nil?
false
else
true
end
end
#统计答题百分比,统计结果保留两位小数 #统计答题百分比,统计结果保留两位小数
def statistics_result_percentage(e, t) def statistics_result_percentage(e, t)

View File

@ -4,16 +4,16 @@
<%= link_to image_tag(url_to_avatar(activity.user), :width => "90", :height => "90"), user_path(activity.user_id), :alt => "用户头像" %> <%= link_to image_tag(url_to_avatar(activity.user), :width => "90", :height => "90"), user_path(activity.user_id), :alt => "用户头像" %>
</div> </div>
<div class="homepagePostDes"> <div class="homepagePostDes">
<div class="homepagePostTo mb8" style="word-break:break-all;"> <div class="homepagePostTo" style="word-break:break-all;">
<% if activity.try(:user).try(:realname) == ' ' %> <% if activity.try(:user).try(:realname) == ' ' %>
<%= link_to activity.try(:user), user_path(activity.user_id), :class => "newsBlue mr15" %> <%= link_to activity.try(:user), user_path(activity.user_id), :class => "newsBlue mr15" %>
<% else %> <% else %>
<%= link_to activity.try(:user).try(:realname), user_path(activity.user_id), :class => "newsBlue mr15" %> <%= link_to activity.try(:user).try(:realname), user_path(activity.user_id), :class => "newsBlue mr15" %>
<% end %> TO <% end %> TO <!--+"(课程名称)" -->
<%= link_to activity.course.name.to_s+"(课程名称)", course_path(activity.course_id), :class => "newsBlue ml15", :style=>"word-break:break-all" %> <%= link_to activity.course.name.to_s+" | 课程作业", course_path(activity.course_id), :class => "newsBlue ml15", :style=>"word-break:break-all" %>
</div> </div>
<div class="homepagePostTitle mb8" style="word-break:break-all;"> <div class="homepagePostTitle" style="word-break:break-all;"> <!--+"(作业名称)"-->
<%= link_to activity.name.to_s+"(作业名称)", student_work_index_path(:homework => activity.id), :class => "postGrey", :style=>"word-break:break-all" %> <%= link_to activity.name.to_s, student_work_index_path(:homework => activity.id), :class => "postGrey", :style=>"word-break:break-all" %>
</div> </div>
<div class="homepagePostSubmitContainer"> <div class="homepagePostSubmitContainer">
<div class="homepagePostSubmit"> <div class="homepagePostSubmit">
@ -21,7 +21,16 @@
</div> </div>
<div class="homepagePostDeadline">截止时间:<%= format_date(activity.end_time) %></div> <div class="homepagePostDeadline">截止时间:<%= format_date(activity.end_time) %></div>
</div> </div>
<div class="homepagePostIntro" style="word-break:break-all">(作业描述)<%= activity.description.html_safe %></div> <div class="homepagePostIntro break_word" id="activity_description_<%= user_activity.id%>">
作业描述:<%= activity.description.html_safe %>
</div>
<!--<p style="display: none" id="activity_message_<%#= user_activity.id%>">
<a id="expend_more_information<%#= user_activity.id%>" href="javascript:void(0)" style="color: #0781b4;" onclick="show_more_reply('#activity_description_<%#=user_activity.id%>','#expend_more_information<%#= user_activity.id%>','#arrow<%#=user_activity.id%>');" value="show_more">[展开]</a>
<span class="g-arr-down">
<img id="arrow<%#=user_activity.id%>" src="/images/jiantou.jpg" width="12" height="6" />
</span>
</p>-->
<div class="homepagePostSetting" style="visibility: hidden" id="act-<%=user_activity.id %>"> <div class="homepagePostSetting" style="visibility: hidden" id="act-<%=user_activity.id %>">
<ul> <ul>
<li class="homepagePostSettingIcon"> <li class="homepagePostSettingIcon">

View File

@ -11,19 +11,22 @@
<%= link_to activity.try(:author).try(:realname), user_path(activity.author_id), :class => "newsBlue mr15" %> <%= link_to activity.try(:author).try(:realname), user_path(activity.author_id), :class => "newsBlue mr15" %>
<% end %> <% end %>
TO TO
<%= link_to activity.course.name.to_s+"(课程讨论区)", course_path(activity.course), :class => "newsBlue ml15 mr5", :style=>"word-break:break-all"%> <%= link_to activity.course.name.to_s+" | 课程讨论区", course_path(activity.course), :class => "newsBlue ml15 mr5", :style=>"word-break:break-all"%>
<%#= link_to activity.course.name.to_s+"(课程讨论区)", course_path(activity.course), :class => "newsBlue ml15 mr5", :style=>"word-break:break-all"%>
</div> </div>
<div class="homepagePostTitle mb12" style="word-break:break-all;"> <div class="homepagePostTitle mb12" style="word-break:break-all;">
<% if activity.parent_id.nil? %> <% if activity.parent_id.nil? %> <!--+"(帖子标题)"-->
<%= link_to activity.subject.to_s.html_safe+"(帖子标题)", course_boards_path(activity.course,:parent_id =>activity.id, :topic_id => activity.id), :class=> "postGrey", :style=>"word-break:break-all" %> <%= link_to activity.subject.to_s.html_safe, course_boards_path(activity.course,:parent_id =>activity.id, :topic_id => activity.id), :class=> "postGrey", :style=>"word-break:break-all" %>
<% else %> <% else %>
<%= link_to activity.parent.subject.to_s.html_safe+"(帖子标题)", course_boards_path(activity.course,:parent_id =>activity.parent_id, :topic_id => activity.id), :class=> "postGrey", :style=>"word-break:break-all"%> <%= link_to activity.parent.subject.to_s.html_safe, course_boards_path(activity.course,:parent_id =>activity.parent_id, :topic_id => activity.id), :class=> "postGrey", :style=>"word-break:break-all"%>
<% end %> <% end %>
</div> </div>
<div class="homepagePostSubmitContainer"> <div class="homepagePostSubmitContainer">
<div class="homepagePostDeadline">时间:<%= format_date(activity.created_on) %></div> <div class="homepagePostDeadline">发帖时间:<%= format_date(activity.created_on) %></div>
</div> </div>
<div class="homepagePostIntro" style="word-break:break-all">(描述)
<div class="homepagePostIntro break_word" id="activity_description_<%= user_activity.id%>">帖子描述:
<% if activity.parent_id.nil? %> <% if activity.parent_id.nil? %>
<%= activity.content.to_s.html_safe%> <%= activity.content.to_s.html_safe%>
<% else %> <% else %>
@ -44,20 +47,26 @@
</div> </div>
<div class="cl"></div> <div class="cl"></div>
</div> </div>
<!--<div class="homepagePostReply"> <div class="homepagePostReply">
<div class="homepagePostReplyBanner"> <div class="homepagePostReplyBanner">
<div class="homepagePostReplyBannerCount">回复( <% count=0 %>
<%# if activity.parent_id.nil? %> <div class="homepagePostReplyBannerCount">回复(
<%#=activity.replies_count %> <% if activity.parent_id.nil? %>
<%# else %> <% count=activity.replies_count%>
<%#=activity.parent.replies_count %> <%=count %>
<%# end %> <% else %>
</div> <% count=activity.parent.replies_count%>
<%=count %>
<% end %>
)</div>
<div class="homepagePostReplyBannerTime"><%#=format_date(activity.updated_on)%></div> <div class="homepagePostReplyBannerTime"><%#=format_date(activity.updated_on)%></div>
<div class="homepagePostReplyBannerMore"><a href="javascript:void(0);" class="replyGrey">点击展开更多回复</a> <%if count>2 %>
</div> <div class="homepagePostReplyBannerMore"><a id="reply_btn_<%=user_activity.id%>" onclick="expand_reply('#reply_div_<%= user_activity.id %> li','#reply_btn_<%=user_activity.id%>')" data-count="<%= count %>" data-init="0" class=" replyGrey" href="javascript:void(0)" value="show_help" >点击展开更多回复(<%= count.to_s%>)</a></div>
<% end %>
<!--<div class="homepagePostReplyBannerMore"><a href="javascript:void(0);" nhname='reply_ex_btn' class="replyGrey">点击展开更多回复</a>
</div>-->
</div> </div>
<div class="homepagePostReplyInputContainer"> <!--<div class="homepagePostReplyInputContainer">
<textarea class="homepagePostReplyInput" placeholder="请输入回复"></textarea> <textarea class="homepagePostReplyInput" placeholder="请输入回复"></textarea>
</div> </div>
<div class="homepagePostReplyInputContainer"> <div class="homepagePostReplyInputContainer">
@ -67,36 +76,43 @@
<div class="homepagePostReplySubmit"><a href="javascript:void(0);" class="postReplySubmit">发送</a> <div class="homepagePostReplySubmit"><a href="javascript:void(0);" class="postReplySubmit">发送</a>
</div> </div>
<div class="cl"></div> <div class="cl"></div>
</div> </div>-->
<%# activity= activity.parent_id.nil? ? activity:activity.parent%> <% activity= activity.parent_id.nil? ? activity:activity.parent%>
<%# activity.children.reorder("created_on desc").each do |reply| unless activity.children.nil?%> <% replies_all_i = 0 %>
<div class="homepagePostReplyContainer"> <% unless activity.children.empty? %>
<div class="homepagePostReplyPortrait"> <div class="homepagePostReplyContainer" id="reply_div_<%= user_activity.id %>">
<%#= link_to image_tag(url_to_avatar(reply.author), :width => "45", :height => "45"), user_path(reply.author_id), :alt => "用户头像" %> <ul>
</div> <% activity.children.reorder("created_on desc").each do |reply|%>
<div class="homepagePostReplyDes"> <% replies_all_i=replies_all_i+1 %>
<div class="homepagePostReplyPublisher"> <li nhname="reply_rec" style="display:<%= replies_all_i>2 ? 'none' : '' %>">
<%# if reply.try(:author).try(:realname) == ' ' %> <div class="homepagePostReplyPortrait">
<%#= link_to reply.try(:author), user_path(reply.author_id), :class => "newsBlue mr10 f14" %> <%= link_to image_tag(url_to_avatar(reply.author), :width => "45", :height => "45"), user_path(reply.author_id), :alt => "用户头像" %>
<%# else %> </div>
<%#= link_to reply.try(:author).try(:realname), user_path(reply.author_id), :class => "newsBlue mr10 f14" %> <div class="homepagePostReplyDes">
<%# end %> <div class="homepagePostReplyPublisher">
<%#=format_date(reply.created_on)%> <% if reply.try(:author).try(:realname) == ' ' %>
<%#= link_to( <%= link_to reply.try(:author), user_path(reply.author_id), :class => "newsBlue mr10 f14" %>
l(:button_delete), <% else %>
{:controller => 'messages', :action => 'destroy', :id => reply.id, :board_id => reply.board_id, :is_board => 'false'}, <%= link_to reply.try(:author).try(:realname), user_path(reply.author_id), :class => "newsBlue mr10 f14" %>
:method => :post, <% end %>
:data => {:confirm => l(:text_are_you_sure)}, <%= format_date(reply.created_on) %>
:title => l(:button_delete), <%= link_to(
:class => 'replyGrey fr ml10' l(:button_delete),
) if reply.course_destroyable_by?(User.current) %> {:controller => 'messages', :action => 'destroy', :id => reply.id, :board_id => reply.board_id, :is_board => 'false'},
&lt;!&ndash;<a href="javascript:void(0);" class="replyGrey fr ml10">删除</a>&ndash;&gt; :method => :post,
:data => {:confirm => l(:text_are_you_sure)},
:title => l(:button_delete),
:class => 'replyGrey fr ml10'
) if reply.course_destroyable_by?(User.current) %>
<!--<a href="javascript:void(0);" class="replyGrey fr ml10">删除</a>-->
</div>
<div class="homepagePostReplyContent" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" title="<%= reply.content.html_safe %>"><%= reply.content.html_safe %></div>
</div>
<div class="cl"></div>
</li>
<% end %>
</ul>
</div> </div>
<div class="homepagePostReplyContent" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" title="<%#= reply.content.html_safe %>"><%#= reply.content.html_safe %></div> <% end %>
</div> </div>
<div class="cl"></div>
</div>
<%# end %>
<%# end %>
</div>-->
</div> </div>

View File

@ -1,5 +1,5 @@
<div class="resources mt10"> <div class="resources mt10">
<div class="homepagePostBrief mt10" > <div class="homepagePostBrief mt10">
<div class="homepagePostPortrait"> <div class="homepagePostPortrait">
<%= link_to image_tag(url_to_avatar(activity.author), :width => "90", :height => "90"), user_path(activity.author_id), :alt => "用户头像" %> <%= link_to image_tag(url_to_avatar(activity.author), :width => "90", :height => "90"), user_path(activity.author_id), :alt => "用户头像" %>
</div> </div>
@ -9,17 +9,18 @@
<%= link_to activity.try(:author), user_path(activity.author_id), :class => "newsBlue mr15" %> <%= link_to activity.try(:author), user_path(activity.author_id), :class => "newsBlue mr15" %>
<% else %> <% else %>
<%= link_to activity.try(:author).try(:realname), user_path(activity.author_id), :class => "newsBlue mr15" %> <%= link_to activity.try(:author).try(:realname), user_path(activity.author_id), :class => "newsBlue mr15" %>
<% end %> TO <% end %> TO <!--+"(课程名称)"-->
<%= link_to activity.course.name.to_s+"(课程名称)", course_path(activity.course), :class => "newsBlue ml15", :style=>"word-break:break-all" %> <%= link_to activity.course.name.to_s+" | 课程通知", course_path(activity.course), :class => "newsBlue ml15", :style => "word-break:break-all" %>
</div> </div>
<div class="homepagePostTitle mb12" style="word-break:break-all;"> <div class="homepagePostTitle mb12" style="word-break:break-all;"> <!--+"(通知标题)"-->
<%=link_to activity.title.to_s+"(通知标题)", news_path(activity), :class=> "postGrey", :style=>"word-break:break-all" %> <%= link_to activity.title.to_s, news_path(activity), :class => "postGrey", :style => "word-break:break-all" %>
</div> </div>
<div class="homepagePostSubmitContainer"> <div class="homepagePostSubmitContainer">
<div class="homepagePostDeadline">发布时间:<%= format_date(activity.created_on) %></div> <div class="homepagePostDeadline">发布时间:<%= format_date(activity.created_on) %></div>
</div> </div>
<div class="homepagePostIntro" style="word-break:break-all">(通知描述)<%= activity.description.html_safe %></div> <div class="homepagePostIntro break_word" id="activity_description_<%= user_activity.id %>">通知描述:<%= activity.description.html_safe %></div>
<div class="homepagePostSetting" id="act-<%=user_activity.id %>" style="visibility: hidden">
<div class="homepagePostSetting" id="act-<%= user_activity.id %>" style="visibility: hidden">
<ul> <ul>
<li class="homepagePostSettingIcon"> <li class="homepagePostSettingIcon">
<ul class="homepagePostSettiongText"> <ul class="homepagePostSettiongText">
@ -33,49 +34,62 @@
</div> </div>
<div class="cl"></div> <div class="cl"></div>
</div> </div>
<!--<div class="homepagePostReply"> <div class="homepagePostReply">
<div class="homepagePostReplyBanner"> <div class="homepagePostReplyBanner">
<div class="homepagePostReplyBannerCount">回复(<%#=activity.comments_count %></div> <% count=activity.comments_count %>
<div class="homepagePostReplyBannerTime"><%#=format_date(activity.updated_on)%></div> <div class="homepagePostReplyBannerCount">回复(<%= count %></div>
<div class="homepagePostReplyBannerTime"><%= format_date(activity.updated_on) %></div>
<%if count>2 %>
<div class="homepagePostReplyBannerMore"><a id="reply_btn_<%=user_activity.id%>" onclick="expand_reply('#reply_div_<%= user_activity.id %> li','#reply_btn_<%=user_activity.id%>')" data-count="<%= count %>" data-init="0" class=" replyGrey" href="javascript:void(0)" value="show_help" >点击展开更多回复(<%= count.to_s%>)</a></div>
<% end %>
<!--
<div class="homepagePostReplyBannerMore"><a href="javascript:void(0);" class="replyGrey">点击展开更多回复</a> <div class="homepagePostReplyBannerMore"><a href="javascript:void(0);" class="replyGrey">点击展开更多回复</a>
</div> </div>-->
</div> </div>
<%#= render :partial => 'course_news_reply',:locals => { :contest => @contest, :journals => @jour, :state => false}%> <%#= render :partial => 'course_news_reply',:locals => { :contest => @contest, :journals => @jour, :state => false}%>
<div class="homepagePostReplyInputContainer"> <!--<div class="homepagePostReplyInputContainer">
<%#= form_tag({:controller => 'comments', :action => 'create', :id => activity}, :id => "add_reply_form") do %> <%= form_tag({:controller => 'comments', :action => 'create', :id => activity}, :id => "add_reply_form") do %>
<textarea id="new_reply" class="homepagePostReplyInput" placeholder="请输入回复"></textarea> <textarea id="new_reply" class="homepagePostReplyInput" placeholder="请输入回复"></textarea>
<div class="homepagePostReplyCancel">
<a href="javascript:void(0);" class="postReplyCancel" onclick="$('#new_reply').value('');">取消</a> <div class="homepagePostReplyCancel">
<a href="javascript:void(0);" class="postReplyCancel" onclick="$('#new_reply').value('');">取消</a>
</div>
<div class="homepagePostReplySubmit">
<a href="javascript:void(0);" class="postReplySubmit" onclick="$('#add_reply_form').submit();">发送</a>
</div>
<div class="cl"></div>
<% end %>
</div>-->
<% replies_all_i = 0 %>
<% unless activity.comments.empty? %>
<div class="homepagePostReplyContainer" id="reply_div_<%= user_activity.id %>">
<ul>
<% activity.comments.reorder("created_on desc").each do |comment| %>
<% replies_all_i=replies_all_i+1 %>
<li nhname="reply_rec" style="display:<%= replies_all_i>2 ? 'none' : '' %>">
<div class="homepagePostReplyPortrait">
<%= link_to image_tag(url_to_avatar(comment.author), :width => "45", :height => "45"), user_path(comment.author_id), :alt => "用户头像" %>
</div>
<div class="homepagePostReplyDes">
<div class="homepagePostReplyPublisher">
<% if comment.try(:author).try(:realname) == ' ' %>
<%= link_to comment.try(:author), user_path(comment.author_id), :class => "newsBlue mr10 f14" %>
<% else %>
<%= link_to comment.try(:author).try(:realname), user_path(comment.author_id), :class => "newsBlue mr10 f14" %>
<% end %>
<%= format_date(comment.created_on) %>
<%= link_to_if_authorized_course l(:button_delete), {:controller => 'comments', :action => 'destroy', :id => activity, :comment_id => comment},
:data => {:confirm => l(:text_are_you_sure)}, :method => :delete, :title => l(:button_delete) %>
<!--<a href="javascript:void(0);" class="replyGrey fr ml10">删除</a>-->
</div>
<div class="homepagePostReplyContent" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" title="<%= comment.comments.html_safe %>"><%= comment.comments.html_safe %></div>
</div>
<div class="cl"></div>
</li>
<% end %>
</ul>
</div> </div>
<div class="homepagePostReplySubmit"> <% end %>
<a href="javascript:void(0);" class="postReplySubmit" onclick="$('#add_reply_form').submit();">发送</a>
</div>
<div class="cl"></div>
<%# end %>
</div> </div>
<%# activity.comments.reorder("created_on desc").each do |comment| unless activity.comments.nil?%>
<div class="homepagePostReplyContainer">
<div class="homepagePostReplyPortrait">
<%#= link_to image_tag(url_to_avatar(comment.author), :width => "45", :height => "45"), user_path(comment.author_id), :alt => "用户头像" %>
</div>
<div class="homepagePostReplyDes">
<div class="homepagePostReplyPublisher">
<%# if comment.try(:author).try(:realname) == ' ' %>
<%#= link_to comment.try(:author), user_path(comment.author_id), :class => "newsBlue mr10 f14" %>
<%# else %>
<%#= link_to comment.try(:author).try(:realname), user_path(comment.author_id), :class => "newsBlue mr10 f14" %>
<%# end %>
<%#=format_date(comment.created_on)%>
<%#= link_to_if_authorized_course l(:button_delete), {:controller => 'comments', :action => 'destroy', :id => activity, :comment_id => comment},
:data => {:confirm => l(:text_are_you_sure)}, :method => :delete, :title => l(:button_delete) %>
&lt;!&ndash;<a href="javascript:void(0);" class="replyGrey fr ml10">删除</a>&ndash;&gt;
</div>
<div class="homepagePostReplyContent" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" title="<%#= comment.comments.html_safe %>"><%#= comment.comments.html_safe %></div>
</div>
<div class="cl"></div>
</div>
<%# end %>
<%# end %>
</div>-->
</div> </div>

View File

@ -1,4 +1,4 @@
<%# has_commit = has_commit_poll?(activity.id ,User.current)%> <% has_commit = has_commit_poll?(activity.id ,User.current)%>
<% poll_name = activity.polls_name.empty? ? l(:label_poll_new) : activity.polls_name%> <% poll_name = activity.polls_name.empty? ? l(:label_poll_new) : activity.polls_name%>
<div class="resources mt10"> <div class="resources mt10">
<div class="homepagePostBrief mt10"> <div class="homepagePostBrief mt10">
@ -14,21 +14,21 @@
<%= link_to activity.try(:user).try(:realname), user_path(activity.user_id), :class => "newsBlue mr15" %> <%= link_to activity.try(:user).try(:realname), user_path(activity.user_id), :class => "newsBlue mr15" %>
<% end %> <% end %>
TO TO
<%= link_to Course.find(activity.polls_group_id).name.to_s+"(课程名称)", course_path(activity.polls_group_id), :class => "newsBlue ml15", :style=>"word-break:break-all" %> <%= link_to Course.find(activity.polls_group_id).name.to_s+" | 问卷", course_path(activity.polls_group_id), :class => "newsBlue ml15", :style=>"word-break:break-all" %>
<!--<a href="javascript:void(0);" class="newsBlue ml15">分布式计算环境(课程名称)</a>--> <!--<a href="javascript:void(0);" class="newsBlue ml15">分布式计算环境(课程名称)</a>-->
</div> </div>
<div class="homepagePostTitle" style="word-break:break-all;"> <div class="homepagePostTitle" style="word-break:break-all;">
<%#= link_to activity.polls_name.to_s+"(问卷名称)", %> <%#= link_to activity.polls_name.to_s/*+"(问卷名称)"*/, %>
<%# if has_commit %> <% if has_commit %>
<%#= link_to poll_name, poll_result_poll_path(activity.id), :class => "polls_title polls_title_w fl c_dblue"%> <%= link_to poll_name, poll_result_poll_path(activity.id), :class => "postGrey"%>
<%# else %> <% else %>
<%= link_to poll_name+"(问卷名称)", poll_path(activity.id), :class => "postGrey"%> <%= link_to poll_name, poll_path(activity.id), :class => "postGrey"%>
<%# end %> <% end %>
</div> </div>
<div class="homepagePostSubmitContainer"> <div class="homepagePostSubmitContainer">
<div class="homepagePostDeadline">时间:<%= format_date(activity.created_at) %></div> <div class="homepagePostDeadline">发布时间:<%= format_date(activity.published_at) %></div>
</div> </div>
<div class="homepagePostIntro" style="word-break:break-all;">(问卷描述)<%=activity.polls_description.to_s%></div> <div class="homepagePostIntro break_word" id="activity_description_<%= user_activity.id%>">问卷描述:<%=activity.polls_description.to_s%></div>
<div class="homepagePostSetting" id="act-<%= user_activity.id %>" style="visibility: hidden"> <div class="homepagePostSetting" id="act-<%= user_activity.id %>" style="visibility: hidden">
<ul> <ul>
<li class="homepagePostSettingIcon"> <li class="homepagePostSettingIcon">

View File

@ -10,11 +10,11 @@
<% else %> <% else %>
<%= link_to activity.try(:author).try(:realname), user_path(activity.author_id), :class => "newsBlue mr15" %> <%= link_to activity.try(:author).try(:realname), user_path(activity.author_id), :class => "newsBlue mr15" %>
<% end %> TO <% end %> TO
<%= link_to activity.project.name.to_s+"(项目名称)", project_path(activity.project), :class => "newsBlue ml15", :style=>"word-break:break-all" %> <%= link_to activity.project.name.to_s+" | 项目缺陷", project_path(activity.project), :class => "newsBlue ml15", :style=>"word-break:break-all" %>
</div> </div>
<div class="homepagePostTitle mb12" style="word-break:break-all;"> <div class="homepagePostTitle mb12" style="word-break:break-all;">
<%= link_to activity.subject.to_s+"(缺陷标题)", issue_path(activity), :class => "postGrey", :style=>"word-break:break-all" %> <%= link_to activity.subject.to_s, issue_path(activity), :class => "postGrey", :style=>"word-break:break-all" %>
<span class="homepagePostProjectState"><%=activity.status.name %></span> <span class='<%= get_issue_priority(activity.priority_id)[0] %>'><%= get_issue_priority(activity.priority_id)[1] %></span>
</div> </div>
<div class="homepagePostSubmitContainer"> <div class="homepagePostSubmitContainer">
<div class="homepagePostAssignTo">指派给&nbsp;&nbsp; <div class="homepagePostAssignTo">指派给&nbsp;&nbsp;
@ -28,7 +28,7 @@
</div> </div>
<div class="homepagePostDeadline">时间:<%=format_date(activity.created_on) %></div> <div class="homepagePostDeadline">时间:<%=format_date(activity.created_on) %></div>
</div> </div>
<div class="homepagePostIntro" style="word-break:break-all;">(缺陷描述)<%=activity.description.html_safe %></div> <div class="homepagePostIntro" id="activity_description_<%= user_activity.id %>">缺陷描述:<%= activity.description.html_safe %></div>
<div class="mt10" style="font-weight:normal;"> <div class="mt10" style="font-weight:normal;">
<% if activity.attachments.any? %> <% if activity.attachments.any? %>
<% activity.attachments.each do |attachment| %> <% activity.attachments.each do |attachment| %>
@ -70,15 +70,21 @@
</div> </div>
<div class="cl"></div> <div class="cl"></div>
</div> </div>
<!--<div class="homepagePostReply"> <div class="homepagePostReply">
<div class="homepagePostReplyBanner"> <div class="homepagePostReplyBanner">
<div class="homepagePostReplyBannerCount">回复(<%#=activity.journals.count %></div> <% count=activity.journals.count %>
<div class="homepagePostReplyBannerTime"><%#=format_date(activity.updated_on)%></div> <div class="homepagePostReplyBannerCount">回复(<%= count %></div>
<div class="homepagePostReplyBannerMore"><a href="javascript:void(0);" class="replyGrey">点击展开更多回复</a> <div class="homepagePostReplyBannerTime"><%= format_date(activity.updated_on) %></div>
</div> <% if count>2 %>
<div class="homepagePostReplyBannerMore">
<a id="reply_btn_<%= user_activity.id %>" onclick="expand_reply('#reply_div_<%= user_activity.id %> li','#reply_btn_<%=user_activity.id%>')" data-count="<%= count %>" data-init="0" class=" replyGrey" href="javascript:void(0)" value="show_help">点击展开更多回复(<%= count.to_s %>
)</a></div>
<% end %>
<!--<div class="homepagePostReplyBannerMore"><a href="javascript:void(0);" class="replyGrey">点击展开更多回复</a>
</div>-->
</div> </div>
<div class="homepagePostReplyInputContainer"> <!--<div class="homepagePostReplyInputContainer">
<textarea class="homepagePostReplyInput" placeholder="请输入回复"></textarea> <textarea class="homepagePostReplyInput" placeholder="请输入回复"></textarea>
</div> </div>
<div class="homepagePostReplyInputContainer"> <div class="homepagePostReplyInputContainer">
@ -86,35 +92,41 @@
<div class="homepagePostReplyCancel"><a href="javascript:void(0);" class="postReplyCancel">取消</a></div> <div class="homepagePostReplyCancel"><a href="javascript:void(0);" class="postReplyCancel">取消</a></div>
<div class="homepagePostReplySubmit"><a href="javascript:void(0);" class="postReplySubmit">发送</a></div> <div class="homepagePostReplySubmit"><a href="javascript:void(0);" class="postReplySubmit">发送</a></div>
<div class="cl"></div> <div class="cl"></div>
</div> </div>-->
<% replies_all_i = 0 %>
<% unless activity.journals.empty? %>
<div class="homepagePostReplyContainer" id="reply_div_<%= user_activity.id %>">
<ul>
<% activity.journals.reorder("created_on desc").each do |reply| %>
<% replies_all_i=replies_all_i+1 %>
<li nhname="reply_rec" style="display:<%= replies_all_i>2 ? 'none' : '' %>">
<div class="homepagePostReplyPortrait">
<%= link_to image_tag(url_to_avatar(reply.user), :width => "45", :height => "45"), user_path(reply.user_id), :alt => "用户头像" %>
</div>
<div class="homepagePostReplyDes">
<div class="homepagePostReplyPublisher">
<% if reply.try(:user).try(:realname) == ' ' %>
<%= link_to reply.try(:user), user_path(reply.user_id), :class => "newsBlue mr10 f14" %>
<%# else %>
<%#= link_to reply.try(:user).try(:realname), user_path(reply.user_id), :class => "newsBlue mr10 f14" %>
<% end %>
<%= format_date(reply.created_on) %>
<%# activity.journals.reorder("created_on desc").each do |reply| unless activity.journals.nil?%> <!--<a href="javascript:void(0);" class="replyGrey fr ml10">删除</a>-->
<div class="homepagePostReplyContainer"> </div>
<div class="homepagePostReplyPortrait"> <% if reply.details.any? %>
<%#= link_to image_tag(url_to_avatar(reply.user), :width => "45", :height => "45"), user_path(reply.user_id), :alt => "用户头像" %> <% details_to_strings(reply.details).each do |string| %>
</div> <div class="homepagePostReplyContent" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;"><%= string %></div>
<div class="homepagePostReplyDes"> <% end %>
<div class="homepagePostReplyPublisher"> <% else %>
<%# if reply.try(:user).try(:realname) == ' ' %> <div class="homepagePostReplyContent" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;"><%= reply.notes.html_safe %></div>
<%#= link_to reply.try(:user), user_path(reply.user_id), :class => "newsBlue mr10 f14" %> <% end %>
<%# else %> </div>
<%#= link_to reply.try(:user).try(:realname), user_path(reply.user_id), :class => "newsBlue mr10 f14" %> <div class="cl"></div>
<%# end %> </li>
<%#= format_date(reply.created_on) %> <% end %>
</ul>
#&lt;!&ndash;<a href="javascript:void(0);" class="replyGrey fr ml10">删除</a>&ndash;&gt; </div>
</div> <% end %>
<%# if reply.details.any? %> </div>
<%# details_to_strings(reply.details).each do |string| %>
<div class="homepagePostReplyContent" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;"><%#=string %></div>
<%# end %>
<%# else %>
<div class="homepagePostReplyContent" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;"><%#=reply.notes.html_safe %></div>
<%# end %>
</div>
<div class="cl"></div>
</div>
<%# end %>
<%# end %>
</div>-->
</div> </div>

View File

@ -11,20 +11,26 @@
<%= link_to activity.try(:author).try(:realname), user_path(activity.author_id), :class => "newsBlue mr15" %> <%= link_to activity.try(:author).try(:realname), user_path(activity.author_id), :class => "newsBlue mr15" %>
<% end %> <% end %>
TO TO
<%= link_to activity.project.name.to_s+"(项目讨论区)", project_path(activity.project), :class => "newsBlue ml15 mr5", :style=>"word-break:break-all"%> <%= link_to activity.project.name.to_s+" | 项目讨论区",project_path(activity.project), :class => "newsBlue ml15 mr5", :style=>"word-break:break-all"%>
<!--<a href="javascript:void(0);" class="newsBlue ml15 mr5"><%= activity.project.name %>(项目讨论区)</a>--> <!--<a href="javascript:void(0);" class="newsBlue ml15 mr5"><%= activity.project.name %>(项目讨论区)</a>-->
</div> </div>
<div class="homepagePostTitle mb12" style="word-break:break-all;"> <div class="homepagePostTitle mb12" style="word-break:break-all;">
<% if activity.parent_id.nil? %> <% if activity.parent_id.nil? %>
<%= link_to activity.subject.to_s.html_safe+"(帖子标题)", project_boards_path(activity.project,:parent_id =>activity.id, :topic_id => activity.id), :class=> "postGrey", :style=>"word-break:break-all" %> <%= link_to activity.subject.to_s.html_safe, project_boards_path(activity.project,:parent_id =>activity.id, :topic_id => activity.id), :class=> "postGrey", :style=>"word-break:break-all" %>
<% else %> <% else %>
<%= link_to activity.parent.subject.to_s.html_safe+"(帖子标题)", project_boards_path(activity.project,:parent_id =>activity.parent_id, :topic_id => activity.id), :class=> "postGrey", :style=>"word-break:break-all"%> <%= link_to activity.parent.subject.to_s.html_safe, project_boards_path(activity.project,:parent_id =>activity.parent_id, :topic_id => activity.id), :class=> "postGrey", :style=>"word-break:break-all"%>
<% end %> <% end %>
</div> </div>
<div class="homepagePostSubmitContainer"> <div class="homepagePostSubmitContainer">
<div class="homepagePostDeadline">时间:<%= format_date(activity.created_on) %></div> <div class="homepagePostDeadline">时间:<%= format_date(activity.created_on) %></div>
</div> </div>
<div class="homepagePostIntro" style="word-break:break-all">(描述)<%= activity.content.html_safe %></div> <div class="homepagePostIntro" id="activity_description_<%= user_activity.id%>">帖子描述:
<% if activity.parent_id.nil? %>
<%= activity.content.to_s.html_safe%>
<% else %>
<%= activity.parent.content.to_s.html_safe%>
<% end %>
</div>
<div class="homepagePostSetting" id="act-<%= user_activity.id %>" style="visibility: hidden"> <div class="homepagePostSetting" id="act-<%= user_activity.id %>" style="visibility: hidden">
<ul> <ul>
<li class="homepagePostSettingIcon"> <li class="homepagePostSettingIcon">
@ -39,19 +45,25 @@
</div> </div>
<div class="cl"></div> <div class="cl"></div>
</div> </div>
<!--<div class="homepagePostReply"> <div class="homepagePostReply">
<div class="homepagePostReplyBanner"> <div class="homepagePostReplyBanner"><% count=0 %>
<div class="homepagePostReplyBannerCount">回复( <div class="homepagePostReplyBannerCount">回复(
<%# if activity.parent_id.nil? %> <% if activity.parent_id.nil? %>
<%#=activity.replies_count %> <% count=activity.replies_count%>
<%# else %> <%=count %>
<%#=activity.parent.replies_count %> <% else %>
<%# end %></div> <% count=activity.parent.replies_count%>
<div class="homepagePostReplyBannerTime"><%#=format_date(activity.updated_on)%></div> <%=count %>
<div class="homepagePostReplyBannerMore"><a href="javascript:void(0);" class="replyGrey">点击展开更多回复</a> <% end %>
</div> )</div>
<div class="homepagePostReplyBannerTime"><%=format_date(activity.updated_on)%></div>
<%if count>2 %>
<div class="homepagePostReplyBannerMore"><a id="reply_btn_<%=user_activity.id%>" onclick="expand_reply('#reply_div_<%= user_activity.id %> li','#reply_btn_<%=user_activity.id%>')" data-count="<%= count %>" data-init="0" class=" replyGrey" href="javascript:void(0)" value="show_help" >点击展开更多回复(<%= count.to_s%>)</a></div>
<% end %>
<!--<div class="homepagePostReplyBannerMore"><a href="javascript:void(0);" nhname='reply_ex_btn' class="replyGrey">点击展开更多回复</a>
</div>-->
</div> </div>
<div class="homepagePostReplyInputContainer"> <!--<div class="homepagePostReplyInputContainer">
<textarea class="homepagePostReplyInput" placeholder="请输入回复"></textarea> <textarea class="homepagePostReplyInput" placeholder="请输入回复"></textarea>
</div> </div>
<div class="homepagePostReplyInputContainer"> <div class="homepagePostReplyInputContainer">
@ -61,36 +73,43 @@
<div class="homepagePostReplySubmit"><a href="javascript:void(0);" class="postReplySubmit">发送</a> <div class="homepagePostReplySubmit"><a href="javascript:void(0);" class="postReplySubmit">发送</a>
</div> </div>
<div class="cl"></div> <div class="cl"></div>
</div> </div>-->
<%# activity= activity.parent_id.nil? ? activity:activity.parent%> <% activity= activity.parent_id.nil? ? activity : activity.parent %>
<%# activity.children.reorder("created_on desc").each do |reply| unless activity.children.nil?%> <% replies_all_i = 0 %>
<div class="homepagePostReplyContainer"> <% unless activity.children.empty? %>
<div class="homepagePostReplyPortrait"> <div class="homepagePostReplyContainer" id="reply_div_<%= user_activity.id %>">
<%#= link_to image_tag(url_to_avatar(reply.author), :width => "45", :height => "45"), user_path(reply.author_id), :alt => "用户头像" %> <ul>
<% activity.children.reorder("created_on desc").each do |reply| %>
<% replies_all_i=replies_all_i+1 %>
<li nhname="reply_rec" style="display:<%= replies_all_i>2 ? 'none' : '' %>">
<div class="homepagePostReplyPortrait">
<%= link_to image_tag(url_to_avatar(reply.author), :width => "45", :height => "45"), user_path(reply.author_id), :alt => "用户头像" %>
</div>
<div class="homepagePostReplyDes">
<div class="homepagePostReplyPublisher">
<% if reply.try(:author).try(:realname) == ' ' %>
<%= link_to reply.try(:author), user_path(reply.author_id), :class => "newsBlue mr10 f14" %>
<% else %>
<%= link_to reply.try(:author).try(:realname), user_path(reply.author_id), :class => "newsBlue mr10 f14" %>
<% end %>
<%= format_date(reply.created_on) %>
<%= link_to(
l(:button_delete),
{:controller => 'messages', :action => 'destroy', :id => reply.id, :board_id => reply.board_id, :is_board => 'false'},
:method => :post,
:data => {:confirm => l(:text_are_you_sure)},
:title => l(:button_delete),
:class => 'replyGrey fr ml10'
) if reply.course_destroyable_by?(User.current) %>
<!--<a href="javascript:void(0);" class="replyGrey fr ml10">删除</a>-->
</div>
<div class="homepagePostReplyContent" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" title="<%= reply.content.html_safe %>"><%= reply.content.html_safe %></div>
</div>
<div class="cl"></div>
</li>
<% end %>
</ul>
</div> </div>
<div class="homepagePostReplyDes"> <% end %>
<div class="homepagePostReplyPublisher"> </div>
<%# if reply.try(:author).try(:realname) == ' ' %> </div>
<%#= link_to reply.try(:author), user_path(reply.author_id), :class => "newsBlue mr10 f14" %>
<%# else %>
<%#= link_to reply.try(:author).try(:realname), user_path(reply.author_id), :class => "newsBlue mr10 f14" %>
<%# end %>
<%#= format_date(reply.created_on) %>
<%#= link_to(
l(:button_delete),
{:controller => 'messages', :action => 'destroy', :id => reply.id, :board_id => reply.board_id, :is_board => 'false'},
:method => :post,
:data => {:confirm => l(:text_are_you_sure)},
:title => l(:button_delete),
:class => 'replyGrey fr ml10'
) if reply.course_destroyable_by?(User.current) %>
# &lt;!&ndash;<a href="javascript:void(0);" class="replyGrey fr ml10">删除</a>&ndash;&gt;
</div>
<div class="homepagePostReplyContent" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" title="<%#= reply.content.html_safe %>"><%#= reply.content.html_safe %></div>
</div>
<div class="cl"></div>
</div>
<%# end %>
<%# end %>
</div>-->
</div>

View File

@ -1,5 +1,64 @@
<% user_activities.each do |user_activity| <% user_activities.each do |user_activity|
unless user_activities.nil? %> 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" %> <% act= user_activity.act unless user_activity.act_type == "ProjectCreateInfo" %>
<% case user_activity.container_type.to_s %> <% case user_activity.container_type.to_s %>
<% when 'Course' %> <% when 'Course' %>