2015-05-27 14:42:36 +08:00
|
|
|
|
<div nhname="container_board">
|
|
|
|
|
<div class="project_r_h">
|
|
|
|
|
<h2 class="project_h2 fl">
|
|
|
|
|
<% if User.current.language == "zh"%>
|
|
|
|
|
<%= h @board.name %>
|
|
|
|
|
<% else %>
|
|
|
|
|
<%= l(:project_module_boards) %>
|
|
|
|
|
<% end %>
|
|
|
|
|
|
|
|
|
|
</h2>
|
2015-05-27 15:50:31 +08:00
|
|
|
|
<% if User.current.logged? %>
|
|
|
|
|
<a href="javascript:void(0)" class="green_btn fr newtalk " id="new_topic_btn" nhname="showbtn"><%= l(:label_message_new) %></a>
|
|
|
|
|
<% end %>
|
2015-05-27 14:42:36 +08:00
|
|
|
|
<div class="cl"></div>
|
|
|
|
|
</div>
|
2015-05-07 16:10:07 +08:00
|
|
|
|
<div class="cl"></div>
|
2015-05-27 14:42:36 +08:00
|
|
|
|
<div class=" talklist_box" >
|
2015-05-27 15:50:31 +08:00
|
|
|
|
<div class="talk_new ml15 mb10" nhname="about_talk" id="about_newtalk" style="display:none;" >
|
2015-05-27 14:42:36 +08:00
|
|
|
|
<ul>
|
|
|
|
|
<%= render :partial => 'course_new' %>
|
|
|
|
|
</ul>
|
|
|
|
|
</div><!--talknew end-->
|
|
|
|
|
</div>
|
2015-05-07 16:10:07 +08:00
|
|
|
|
</div>
|
|
|
|
|
<!-- 发布新帖部分 -->
|
|
|
|
|
<div class=" talklist_box" >
|
2015-03-24 17:12:51 +08:00
|
|
|
|
|
2014-06-12 10:03:01 +08:00
|
|
|
|
<% if !User.current.logged?%>
|
|
|
|
|
<div style="font-size: 14px;margin:20px;">
|
|
|
|
|
<%= l(:label_user_login_course_board) %>
|
|
|
|
|
<%= link_to l(:label_user_login_new), signin_path %>
|
|
|
|
|
<hr/>
|
|
|
|
|
</div>
|
|
|
|
|
<% end %>
|
2015-05-22 13:57:07 +08:00
|
|
|
|
<p class="c_dark mb5">讨论区共有<span class="c_orange"><%= @topic_count %></span>个帖子</p>
|
|
|
|
|
<% if @topics.any? %>
|
|
|
|
|
<% @topics.each do |topic| %>
|
2015-05-27 14:42:36 +08:00
|
|
|
|
<div class="talkmain_box" style="border:none; margin-bottom:0; border-bottom: 1px dashed #d9d9d9;" id="topic<%= topic.id %>" nhname="container_board" mhname="container_board_reply">
|
2015-05-22 13:57:07 +08:00
|
|
|
|
<%= link_to image_tag(url_to_avatar(topic.author), :width=>"42",:height=>"42"), user_path(topic.author),:class =>'talkmain_pic fl' %>
|
|
|
|
|
<div class="talkmain_txt fl mt5">
|
2015-05-28 09:18:02 +08:00
|
|
|
|
<% author = topic.author.to_s %>
|
|
|
|
|
<div style="max-width:60px;white-space:nowrap;overflow:hidden;float:left;text-overflow:ellipsis;">
|
|
|
|
|
<%= link_to author, user_path(topic.author), :class =>"talkmain_name fl ",:title=>author,
|
|
|
|
|
:style=>'max-width:60px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;' %>
|
|
|
|
|
</div>
|
|
|
|
|
<p style="float:left;color:#ff5722;"> :</p>
|
2015-05-22 13:57:07 +08:00
|
|
|
|
|
2015-05-28 09:18:02 +08:00
|
|
|
|
<p class="talkmain_tit fl fb break_word" title="<%= h(topic.subject) %>" style="width:auto;float:left;max-width:415px;white-space:nowrap;overflow:hidden;float:left;text-overflow:ellipsis;"> <%= h(topic.subject) %></p>
|
2015-05-22 13:57:07 +08:00
|
|
|
|
<% if topic.course_editable_by?(User.current) %>
|
2015-05-27 14:42:36 +08:00
|
|
|
|
<a href="javascript:void(0)" nhname="showbtn" style="color: #426e9a;float: right;
|
2015-05-22 13:57:07 +08:00
|
|
|
|
margin-right: 10px;"><%= l(:button_edit) %></a>
|
|
|
|
|
<% end %>
|
2015-05-14 15:42:20 +08:00
|
|
|
|
|
2015-05-22 13:57:07 +08:00
|
|
|
|
<%= link_to(
|
|
|
|
|
l(:button_delete),
|
|
|
|
|
{:controller =>'messages',:action => 'destroy', :id => topic.id, :board_id => topic.board_id, :is_board=>'true'},
|
|
|
|
|
:method => :post,
|
|
|
|
|
:data => {:confirm => l(:text_are_you_sure)},
|
|
|
|
|
:class => 'talk_edit fr',
|
|
|
|
|
:style => ' margin-right: 10px;'
|
|
|
|
|
) if topic.destroyable_by?(User.current) %>
|
|
|
|
|
|
|
|
|
|
<% if topic.sticky? %>
|
|
|
|
|
<a href="javascript:void(0)" class="talk_up fr c_red" style="margin-right: 10px;"><%= l(:label_board_sticky)%></a>
|
|
|
|
|
<% end %>
|
|
|
|
|
<div class="cl"></div>
|
2015-05-11 17:23:53 +08:00
|
|
|
|
|
2015-05-22 13:57:07 +08:00
|
|
|
|
<script>
|
2015-06-16 11:13:57 +08:00
|
|
|
|
//$(function(){if($("#contentmessage<%#=topic.id %>").height()>182){$("#project_show_<%#= topic.id%>").show();}});
|
|
|
|
|
//解决由于图片加载慢造成div高度不够 以至于展开按钮不显示的bug
|
|
|
|
|
$(function(){
|
|
|
|
|
function nh_show_btn(){
|
|
|
|
|
if($("#contentmessage<%=topic.id %>").height()>182){
|
|
|
|
|
$("#project_show_<%= topic.id%>").show();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
var div = $("#contentmessage<%=topic.id %>");
|
|
|
|
|
var imgs = $('img',div);
|
|
|
|
|
var lens = imgs.length;
|
|
|
|
|
function nh_load_img_end(){
|
|
|
|
|
lens--;
|
|
|
|
|
if(lens <= 0){
|
|
|
|
|
nh_show_btn();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(lens <= 0){
|
|
|
|
|
nh_show_btn();
|
|
|
|
|
}else{
|
|
|
|
|
$('img',div).load(function(){
|
|
|
|
|
nh_load_img_end();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
2015-05-22 13:57:07 +08:00
|
|
|
|
</script>
|
|
|
|
|
<div class="project_board_content break_word" id="content_<%=topic.id%>">
|
|
|
|
|
<div id="contentmessage<%=topic.id %>" class="upload_img">
|
|
|
|
|
<%= topic.content.html_safe %>
|
2015-05-13 17:25:31 +08:00
|
|
|
|
</div>
|
2015-05-22 13:57:07 +08:00
|
|
|
|
</div>
|
2015-05-13 17:25:31 +08:00
|
|
|
|
|
|
|
|
|
|
2015-05-15 10:07:52 +08:00
|
|
|
|
|
2015-05-22 13:57:07 +08:00
|
|
|
|
<p style="display: none" id="project_show_<%= topic.id%>">
|
|
|
|
|
<a id="expend_more_information<%= topic.id%>" href="javascript:void(0)" style="color: #0781b4;" onclick="show_more_reply('#content_<%=topic.id%>','#expend_more_information<%= topic.id%>','#arrow<%=topic.id%>');" value="show_more">[展开]</a>
|
2015-05-07 17:38:08 +08:00
|
|
|
|
<span class="g-arr-down">
|
|
|
|
|
<img id="arrow<%=topic.id%>" src="/images/jiantou.jpg" width="12" height="6" />
|
|
|
|
|
</span>
|
2015-05-11 17:23:53 +08:00
|
|
|
|
|
2015-05-22 13:57:07 +08:00
|
|
|
|
</p>
|
|
|
|
|
<%= link_to_attachments_course topic, :author => false %>
|
2015-05-11 17:23:53 +08:00
|
|
|
|
|
2015-05-22 13:57:07 +08:00
|
|
|
|
<%= l(:label_activity_time)%>: <%= format_time topic.created_on %>
|
2015-05-11 17:23:53 +08:00
|
|
|
|
|
2015-05-22 13:57:07 +08:00
|
|
|
|
</div>
|
2015-05-27 14:42:36 +08:00
|
|
|
|
<a href="javascript:void(0)" nhname="showbtn_reply" class="c_dblue fr" style="margin-right:10px;"><%= l(:button_reply) %></a>
|
2015-05-07 16:10:07 +08:00
|
|
|
|
|
2015-05-22 13:57:07 +08:00
|
|
|
|
<div class="cl"></div>
|
2015-05-11 17:23:53 +08:00
|
|
|
|
|
2015-06-15 14:52:55 +08:00
|
|
|
|
<div class="talk_new ml15 mb10" nhname='about_talk' id="about_newtalk<%=topic.id%>" style="display: none;border-top: 1px dashed #d9d9d9;padding-top:5px;margin-left:0px;padding-left:15px;">
|
2015-05-27 14:42:36 +08:00
|
|
|
|
<ul>
|
|
|
|
|
<%= render :partial => 'edit',locals: {:topic => topic} %>
|
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="cl"></div>
|
|
|
|
|
<div class="talkWrapBox">
|
2015-05-29 10:15:05 +08:00
|
|
|
|
<% reply = Message.new(:subject => "RE: #{topic.subject}")%>
|
2015-05-27 14:42:36 +08:00
|
|
|
|
<% if !topic.locked? && authorize_for('messages', 'reply') %>
|
2015-05-27 17:26:11 +08:00
|
|
|
|
<div class="talkWrapMsg" nhname="about_talk_reply" style="display: none;">
|
2015-05-27 14:42:36 +08:00
|
|
|
|
<em class="talkWrapArrow"></em>
|
2015-05-22 13:57:07 +08:00
|
|
|
|
<div class="cl"></div>
|
2015-05-27 17:26:11 +08:00
|
|
|
|
<div class="talkConIpt ml15 mb10" style="margin-left:30px;" id="reply<%= topic.id %>">
|
2015-05-27 14:42:36 +08:00
|
|
|
|
<%= form_for reply, :as => :reply, :url => {:controller=>'messages',:action => 'reply', :id => topic.id, :board_id => topic.board_id, :is_board => 'true'},
|
|
|
|
|
:html => {:nhname=>"form",:multipart => true, :id => 'message_form' + topic.id.to_s, :name=>'message-form'} do |f| %>
|
|
|
|
|
|
|
|
|
|
<%= render :partial => 'form_project', :locals => {:f => f, :replying => true} %>
|
2015-06-04 15:55:41 +08:00
|
|
|
|
<input name="parent_topic" type="hidden" value=""/>
|
2015-05-27 14:42:36 +08:00
|
|
|
|
<div class="fl" style="padding-top:5px;" nhname="toolbar_container"></div>
|
|
|
|
|
<div style="padding-top:5px;" class="fr">
|
|
|
|
|
<a href="javascript:void(0)" nhname="cancelbtn" class="grey_btn fr ml10" style=""><%= l(:button_cancel)%></a>
|
|
|
|
|
<a href="javascript:void(0)" nhname="submitbtn" class="blue_btn fr " style=""><%= l(:button_submit)%></a>
|
|
|
|
|
</div>
|
2015-05-22 13:57:07 +08:00
|
|
|
|
<% end %>
|
2015-05-27 14:42:36 +08:00
|
|
|
|
<div class="cl"></div>
|
|
|
|
|
</div>
|
2015-05-27 17:26:11 +08:00
|
|
|
|
</div>
|
2015-05-27 14:42:36 +08:00
|
|
|
|
<% end %>
|
2015-05-27 15:50:31 +08:00
|
|
|
|
<% replies_all = topic.children.includes(:author, :attachments, {:board => :project}).
|
|
|
|
|
reorder("#{Message.table_name}.created_on DESC").all %>
|
|
|
|
|
<% unless replies_all.empty? %>
|
|
|
|
|
<% replies_all_i = 0 %>
|
|
|
|
|
<div class="talkWrapMsg" nhname="nh_reply_div" id="nh_reply_div_<%= topic.id %>">
|
2015-05-27 14:42:36 +08:00
|
|
|
|
<ul>
|
2015-05-27 15:50:31 +08:00
|
|
|
|
<% replies_all.each do |message| %>
|
|
|
|
|
<% replies_all_i=replies_all_i+1 %>
|
2015-06-04 15:55:41 +08:00
|
|
|
|
<li nhname="reply_rec" style="display:<%= replies_all_i>2?'none':'' %>" id="topic<%=message.id%>">
|
2015-05-27 14:42:36 +08:00
|
|
|
|
<%= link_to image_tag(url_to_avatar(message.author), :width => '34',:height => '34'), user_path(message.author), :class =>'Msg_pic' %>
|
|
|
|
|
<div class="Msg_txt">
|
|
|
|
|
<%= link_to_user_header message.author,false,:class => 'fl c_orange ' %>
|
|
|
|
|
<br/>
|
2015-05-28 15:48:52 +08:00
|
|
|
|
<div class="fl break_word"><%= textAreailizable message,:content,:attachments => message.attachments %></div>
|
|
|
|
|
<input nhname="nh_content_val" value="<%= message.content %>" type="hidden"/>
|
2015-05-29 10:50:55 +08:00
|
|
|
|
<br/><div class="cl"></div>
|
2015-05-27 14:42:36 +08:00
|
|
|
|
<span class=" c_grey fl"><%= format_time(message.created_on) %></span>
|
|
|
|
|
<%= link_to(
|
|
|
|
|
|
|
|
|
|
l(:button_delete),
|
|
|
|
|
{:controller => 'messages', :action => 'destroy', :id => message.id, :board_id => message.board_id, :is_board => 'true'},
|
|
|
|
|
:method => :post,
|
|
|
|
|
:data => {:confirm => l(:text_are_you_sure)},
|
|
|
|
|
:title => l(:button_delete),
|
|
|
|
|
:class => ' c_dblue fr'
|
|
|
|
|
) if message.course_destroyable_by?(User.current) %>
|
|
|
|
|
<%= link_to(
|
|
|
|
|
l(:button_reply),
|
|
|
|
|
'javascript:;',
|
|
|
|
|
:nhname =>'showbtn_child_reply',
|
|
|
|
|
:class => ' c_dblue fr',
|
|
|
|
|
:style => 'margin-right: 10px;',
|
2015-06-04 15:55:41 +08:00
|
|
|
|
'data-topic-id' =>message.id,
|
2015-05-27 14:42:36 +08:00
|
|
|
|
:title => l(:button_reply)) if !topic.locked? && authorize_for('messages', 'reply') %>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="cl"></div>
|
|
|
|
|
|
|
|
|
|
</li><!---留言内容-->
|
|
|
|
|
<% end %>
|
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
2015-05-27 15:50:31 +08:00
|
|
|
|
<%if topic.replies_count>2 %>
|
|
|
|
|
<div class="talkWrapMsg"><a nhname="reply_ex_btn" data-count="<%= topic.replies_count %>" data-init="0" class=" ml258" href="javascript:void(0)" id="showgithelp<%= topic.id%>" value="show_help" class="c_dblue lh23" style="color: #0781b4;" >展开回复(<%= topic.replies_count.to_s%>)</a></div>
|
2015-05-27 14:42:36 +08:00
|
|
|
|
<% end %>
|
|
|
|
|
<% end %>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="cl"></div>
|
|
|
|
|
</div><!--讨论主类容 end-->
|
|
|
|
|
|
2015-05-22 13:57:07 +08:00
|
|
|
|
<% end %>
|
|
|
|
|
<% else %>
|
|
|
|
|
<p class="nodata"><%= l(:label_no_data) %></p>
|
|
|
|
|
<% end %>
|
2015-03-24 17:12:51 +08:00
|
|
|
|
<ul class="wlist">
|
2015-06-04 15:55:41 +08:00
|
|
|
|
<%#= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
|
|
|
|
|
<%= pagination_links_full @topic_pages, @topic_count, :per_page_links => false, :remote => false, :flag => true %>
|
2015-03-24 17:12:51 +08:00
|
|
|
|
</ul>
|
2015-03-27 16:59:52 +08:00
|
|
|
|
<%# other_formats_links do |f| %>
|
2015-05-22 13:57:07 +08:00
|
|
|
|
<%#= f.link_to 'Atom', :url => {:key => User.current.rss_key} %>
|
2015-03-27 16:59:52 +08:00
|
|
|
|
<%# end %>
|
2014-06-12 10:03:01 +08:00
|
|
|
|
|
|
|
|
|
<% html_title @board.name %>
|
|
|
|
|
|
|
|
|
|
<% content_for :header_tags do %>
|
|
|
|
|
<%= auto_discovery_link_tag(:atom, {:format => 'atom', :key => User.current.rss_key}, :title => "#{@course}: #{@board}") %>
|
|
|
|
|
<% end %>
|
2015-05-22 11:09:43 +08:00
|
|
|
|
</div>
|
2015-05-27 14:42:36 +08:00
|
|
|
|
<div style="display:none;"><a href="#" id="nhjump"></a></div>
|
2015-05-21 16:35:53 +08:00
|
|
|
|
<script type="text/javascript">
|
2015-05-27 14:42:36 +08:00
|
|
|
|
$(function(){
|
|
|
|
|
$(".talkmain_box").each(function(){
|
|
|
|
|
var target = $("li[nhname='reply_rec']",$(this));
|
|
|
|
|
var btn = $("a[nhname='reply_ex_btn']",$(this));
|
|
|
|
|
var jumpobj = $("div[nhname='nh_reply_div']",$(this));
|
|
|
|
|
btn.click(function(){
|
|
|
|
|
if($(this).data('init')=='0'){
|
|
|
|
|
$(this).data('init',1);
|
|
|
|
|
$(this).html('收起回复('+$(this).data('count')+')');
|
|
|
|
|
target.show();
|
|
|
|
|
}else{
|
|
|
|
|
$(this).data('init',0);
|
|
|
|
|
$(this).html('展开回复('+$(this).data('count')+')');
|
|
|
|
|
target.hide();
|
|
|
|
|
target.eq(0).show();
|
|
|
|
|
target.eq(1).show();
|
|
|
|
|
$("#nhjump").attr('href','#'+jumpobj.attr('id'));
|
|
|
|
|
$("#nhjump")[0].click();
|
2015-05-21 16:35:53 +08:00
|
|
|
|
}
|
2015-05-27 14:42:36 +08:00
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
KindEditor.ready(function(K){
|
|
|
|
|
$("div[nhname='container_board']").each(function(){
|
|
|
|
|
var container = $(this);
|
|
|
|
|
var about_talk = $("div[nhname='about_talk']",container);
|
|
|
|
|
var params = ({
|
|
|
|
|
kindutil:K,
|
|
|
|
|
showbtn:$("a[nhname='showbtn']",container),
|
|
|
|
|
about_talk:about_talk,
|
|
|
|
|
inputsubject:$("input[nhname='inputsubject']",about_talk),
|
|
|
|
|
subjectmsg:$("p[nhname='subjectmsg']",about_talk),
|
|
|
|
|
textarea:$("textarea[nhname='textarea']",about_talk),
|
|
|
|
|
contentmsg:$("p[nhname='contentmsg']",about_talk),
|
|
|
|
|
submitbtn:$("a[nhname='submitbtn']",about_talk),
|
|
|
|
|
cancelbtn:$("a[nhname='cancelbtn']",about_talk),
|
|
|
|
|
form:$("form[nhname='form']",about_talk),
|
|
|
|
|
toolbar_container:$("div[nhname='toolbar_container']",about_talk),
|
|
|
|
|
init_content_val:$("input[nhname='init_content_val']",about_talk)
|
|
|
|
|
});
|
|
|
|
|
nh_init_board(params);
|
|
|
|
|
});
|
|
|
|
|
$("div[mhname='container_board_reply']").each(function(){
|
|
|
|
|
var container = $(this);
|
|
|
|
|
var about_talk = $("div[nhname='about_talk_reply']",container);
|
|
|
|
|
var params = {
|
|
|
|
|
type:'reply',
|
|
|
|
|
kindutil:K,
|
|
|
|
|
showbtn:$("a[nhname='showbtn_reply']",container),
|
|
|
|
|
showbtn_child:$("a[nhname='showbtn_child_reply']",container),
|
|
|
|
|
about_talk:about_talk,
|
|
|
|
|
inputsubject:$("input[nhname='inputsubject']",about_talk),
|
|
|
|
|
subjectmsg:$("p[nhname='subjectmsg']",about_talk),
|
|
|
|
|
textarea:$("textarea[nhname='textarea']",about_talk),
|
|
|
|
|
contentmsg:$("p[nhname='contentmsg']",about_talk),
|
|
|
|
|
submitbtn:$("a[nhname='submitbtn']",about_talk),
|
|
|
|
|
cancelbtn:$("a[nhname='cancelbtn']",about_talk),
|
|
|
|
|
form:$("form[nhname='form']",about_talk),
|
|
|
|
|
quote_show:$("div[nhname='quote_show']",about_talk),
|
|
|
|
|
quote_input:$("textarea[nhname='quote_input']",about_talk),
|
|
|
|
|
toolbar_container:$("div[nhname='toolbar_container']",about_talk),
|
|
|
|
|
jumphref:$("#nhjump")
|
|
|
|
|
};
|
|
|
|
|
params.get_ref_str_call=function(btn){
|
|
|
|
|
var div = btn.parent('div');
|
2015-06-12 10:09:47 +08:00
|
|
|
|
var str = '<blockquote>'+$('a',div).filter(':first').html()+' 写到: <br/>'+$("input[nhname='nh_content_val']",div).val()+'<div class="cl"></div></blockquote>';
|
2015-05-27 14:42:36 +08:00
|
|
|
|
return str;
|
2015-05-22 11:09:43 +08:00
|
|
|
|
}
|
2015-05-27 14:42:36 +08:00
|
|
|
|
nh_init_board(params);
|
2015-05-22 13:57:07 +08:00
|
|
|
|
});
|
2015-06-04 15:55:41 +08:00
|
|
|
|
|
|
|
|
|
<% if( @params[:topic_id]!=nil && @params[:topic_id]!='' && @params[:page]==nil ) %>
|
|
|
|
|
var nh_dw_html = $("#topic<%=@params[:topic_id]%>");
|
|
|
|
|
if(nh_dw_html!=undefined && nh_dw_html.length!=0){
|
|
|
|
|
if(nh_dw_html.is(':hidden')){
|
|
|
|
|
$("a[nhname='reply_ex_btn']",nh_dw_html.parent('ul').parent('div').parent('div')).click();
|
|
|
|
|
}
|
|
|
|
|
$("#nhjump").attr('href','#'+nh_dw_html.attr('id'));
|
|
|
|
|
$("#nhjump")[0].click();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
<% end %>
|
2015-05-27 14:42:36 +08:00
|
|
|
|
<% if(!@flag.nil? && @flag=='true') %>
|
|
|
|
|
if($("#new_topic_btn")!=undefined)$("#new_topic_btn").click();
|
|
|
|
|
<% end %>
|
2015-05-21 16:35:53 +08:00
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
</script>
|