|
|
|
@ -1,3 +1,4 @@
|
|
|
|
|
<div nhname="container_board">
|
|
|
|
|
<div class="project_r_h" xmlns="http://www.w3.org/1999/html">
|
|
|
|
|
<h2 class="project_h2 fl">
|
|
|
|
|
<% if User.current.language == "zh"%>
|
|
|
|
@ -5,49 +6,41 @@
|
|
|
|
|
<% else %>
|
|
|
|
|
<%= l(:project_module_boards) %>
|
|
|
|
|
<% end %>
|
|
|
|
|
|
|
|
|
|
</h2>
|
|
|
|
|
<% if User.current.logged? %>
|
|
|
|
|
<a href="javascript:void(0)" class="green_btn fr newtalk " onclick="show_newtalk();"><%= l(:label_message_new) %></a>
|
|
|
|
|
<a href="javascript:void(0)" class="green_btn fr newtalk " nhname="showbtn"><%= l(:label_message_new) %></a>
|
|
|
|
|
<% end %>
|
|
|
|
|
<div class="cl"></div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!--display the board-->
|
|
|
|
|
<% if !User.current.logged? %>
|
|
|
|
|
<div class="c_grey f14">
|
|
|
|
|
<%= l(:label_user_login_project_board) %>
|
|
|
|
|
<%= link_to l(:label_user_login_new), signin_path, :class => "c_blue ml5" %>
|
|
|
|
|
</div>
|
|
|
|
|
<% end %>
|
|
|
|
|
|
|
|
|
|
<!-- 发布新帖部分 -->
|
|
|
|
|
<div class="cl"></div>
|
|
|
|
|
<div class=" talklist_box" >
|
|
|
|
|
<div class="talk_new ml15 mb10" name="container_board" id="about_newtalk" style="display:<%= !@flag.nil? && @flag=='true' ? 'block' : 'none' %>;">
|
|
|
|
|
<div class="talk_new ml15 mb10" nhname="about_talk" style="display:<%= !@flag.nil? && @flag=='true' ? 'block' : 'none' %>;">
|
|
|
|
|
<ul>
|
|
|
|
|
<%= render :partial => 'project_new_topic' %>
|
|
|
|
|
</ul>
|
|
|
|
|
</div><!--talknew end-->
|
|
|
|
|
|
|
|
|
|
<!-- 帖子内容显示 -->
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class=" talklist_box" >
|
|
|
|
|
<p class="c_dark mb5">讨论区共有<span class="c_orange"><%= @topic_count %></span>个帖子</p>
|
|
|
|
|
<% if @topics.any? %>
|
|
|
|
|
<% @topics.each do |topic| %>
|
|
|
|
|
|
|
|
|
|
<div nhname="container_board">
|
|
|
|
|
<div class="talkmain_box" id="topic<%= topic.id %>" style="border:none; margin-bottom:0; border-bottom: 1px dashed #d9d9d9;">
|
|
|
|
|
<%= 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">
|
|
|
|
|
<% author = topic.author.to_s + ":" %>
|
|
|
|
|
<%= link_to author, user_path(topic.author), :class =>"talkmain_name fl " %>
|
|
|
|
|
|
|
|
|
|
<p class="talkmain_tit fl fb break_word"> <%= h(topic.subject) %></p>
|
|
|
|
|
<% if topic.editable_by?(User.current) %>
|
|
|
|
|
|
|
|
|
|
<a href="javascript:void(0)" onclick="show_newtalk1('#about_newtalk<%= topic.id%>');" style="color: #426e9a;float: right;
|
|
|
|
|
margin-right: 10px;"><%= l(:button_edit) %></a>
|
|
|
|
|
<a href="javascript:void(0)" nhname="showbtn" style="color: #426e9a;float: right;margin-right: 10px;"><%= l(:button_edit) %></a>
|
|
|
|
|
<% end %>
|
|
|
|
|
|
|
|
|
|
<%= link_to(
|
|
|
|
|
l(:button_delete),
|
|
|
|
|
{:controller =>'messages',:action => 'destroy', :id => topic.id, :board_id => topic.board_id, :is_board=>'true'},
|
|
|
|
@ -56,225 +49,134 @@
|
|
|
|
|
: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>
|
|
|
|
|
<script>
|
|
|
|
|
$(function(){if($("#contentmessage<%=topic.id %>").height()>182){$("#project_show_<%= topic.id%>").show();}});
|
|
|
|
|
</script>
|
|
|
|
|
<div class="project_board_content break_word" id="content_<%=topic.id%>">
|
|
|
|
|
<div id="contentmessage<%=topic.id %>" class="upload_img">
|
|
|
|
|
<%= topic.content.html_safe %>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<p style="display: none" id="project_show_<%= topic.id%>">
|
|
|
|
|
<a id="expend_more_information<%= topic.id%>" style="color: #0781b4;" href="javascript:void(0)" onclick="show_more_reply('#content_<%=topic.id%>','#expend_more_information<%= topic.id%>','#arrow<%=topic.id%>');" value="show_more">[展开]</a>
|
|
|
|
|
<span class="g-arr-down">
|
|
|
|
|
<img id="arrow<%=topic.id%>" src="/images/jiantou.jpg" width="12" height="6" />
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
</p>
|
|
|
|
|
|
|
|
|
|
<%= link_to_attachments_course topic, :author => false %>
|
|
|
|
|
|
|
|
|
|
<%= l(:label_activity_time)%>: <%= format_time topic.created_on %>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
<% if User.current.logged? %>
|
|
|
|
|
<%= toggle_link l(:button_reply), "reply" + topic.id.to_s, :focus => "about_newtalk#{topic.id}",:class => ' c_dblue fr' %>
|
|
|
|
|
<% end %>
|
|
|
|
|
<div class="cl"></div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</div><!--讨论主类容 end-->
|
|
|
|
|
|
|
|
|
|
<div class="talk_new ml15 mb10" id="about_newtalk<%=topic.id%>" style="display: none">
|
|
|
|
|
</div>
|
|
|
|
|
<div class="talk_new ml15 mb10" nhname='about_talk' id="about_newtalk<%=topic.id%>" style="display: none">
|
|
|
|
|
<ul>
|
|
|
|
|
<%= render :partial => 'edit',locals: {:topic => topic} %>
|
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="cl"></div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="talkWrapBox">
|
|
|
|
|
<% reply = Message.new(:subject => "RE: #{@message.subject}")%>
|
|
|
|
|
<% if !topic.locked? && authorize_for('messages', 'reply') %>
|
|
|
|
|
<em class="talkWrapArrow"></em>
|
|
|
|
|
<div class="cl"></div>
|
|
|
|
|
<div class="talkConIpt ml15 mb10" style="display: none" name="container_board" id="reply<%= topic.id %>">
|
|
|
|
|
<%= form_for reply, :as => :reply, :url => {:controller=>'messages',:action => 'reply', :id => topic.id, :board_id => topic.board_id, :is_board => 'true'}, :html => {:multipart => true, :id => 'message_form' + topic.id.to_s, :name=>'message-form'} do |f| %>
|
|
|
|
|
|
|
|
|
|
<div class="talkConIpt ml15 mb10" style="display:none;" nhname="about_talk_reply" id="reply<%= topic.id %>">
|
|
|
|
|
<%= 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} %>
|
|
|
|
|
<%= toggle_link l(:button_cancel), "reply" + topic.id.to_s, :focus => 'message_content',:class => 'grey_btn fr ml10' %>
|
|
|
|
|
<a href="javascript:void(0)" name="submitbtn" class="blue_btn fr " style=""><%= l(:label_memo_create)%></a>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<a href="javascript:void(0)" nhname="cancelbtn" class="blue_btn fr ml10" style=""><%= l(:button_cancel)%></a>
|
|
|
|
|
<a href="javascript:void(0)" nhname="submitbtn" class="blue_btn fr " style=""><%= l(:label_memo_create)%></a>
|
|
|
|
|
<% end %>
|
|
|
|
|
<div class="cl"></div>
|
|
|
|
|
</div>
|
|
|
|
|
<% end %>
|
|
|
|
|
<% replies_all = topic.children.
|
|
|
|
|
includes(:author, :attachments, {:board => :project}).
|
|
|
|
|
reorder("#{Message.table_name}.id asc").offset(2).
|
|
|
|
|
all %>
|
|
|
|
|
<% replies_show = topic.children.
|
|
|
|
|
includes(:author, :attachments, {:board => :project}).
|
|
|
|
|
reorder("#{Message.table_name}.id asc").limit(2).
|
|
|
|
|
all %>
|
|
|
|
|
<% unless replies_show.empty? %>
|
|
|
|
|
<% reply_count = 0 %>
|
|
|
|
|
<div class="talkWrapMsg">
|
|
|
|
|
<ul>
|
|
|
|
|
<% replies_show.each do |message| %>
|
|
|
|
|
|
|
|
|
|
<li>
|
|
|
|
|
<%= 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/>
|
|
|
|
|
<p class="fl break_word"><%= textAreailizable message,:content,:attachments => message.attachments %></p>
|
|
|
|
|
|
|
|
|
|
<br/>
|
|
|
|
|
<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),
|
|
|
|
|
{:controller => 'messages', :action => 'quote', :id => message.id, :board_id => message.board_id, :is_board => 'true'},
|
|
|
|
|
:class => ' c_dblue fr',
|
|
|
|
|
:style => 'margin-right: 10px;',
|
|
|
|
|
:remote => true,
|
|
|
|
|
:method => 'get',
|
|
|
|
|
:onclick => "$('#reply#{topic.id}').slideToggle(); return false;",
|
|
|
|
|
:focus => "about_newtalk#{topic.id}",
|
|
|
|
|
:title => l(:button_quote)) if !topic.locked? && authorize_for('messages', 'reply') %>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="cl"></div>
|
|
|
|
|
|
|
|
|
|
</li><!---留言内容-->
|
|
|
|
|
<% end %>
|
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="talkWrapMsg" id="talkWrapMsg<%= topic.id %>" style="display: none">
|
|
|
|
|
<ul>
|
|
|
|
|
<% replies_all.each do |message| %>
|
|
|
|
|
|
|
|
|
|
<li>
|
|
|
|
|
<%= 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/>
|
|
|
|
|
<p class="fl break_word"><%= textAreailizable message,:content,:attachments => message.attachments %></p>
|
|
|
|
|
|
|
|
|
|
<br/>
|
|
|
|
|
<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),
|
|
|
|
|
{:controller => 'messages', :action => 'quote', :id => message.id, :board_id => message.board_id, :is_board => 'true'},
|
|
|
|
|
:remote => true,
|
|
|
|
|
:method => 'get',
|
|
|
|
|
:focus => "about_newtalk#{topic.id}",
|
|
|
|
|
:class => ' c_dblue fr',
|
|
|
|
|
:style => 'margin-right: 10px;',
|
|
|
|
|
:title => l(:button_quote)) if !topic.locked? && authorize_for('messages', 'reply') %>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="cl"></div>
|
|
|
|
|
|
|
|
|
|
</li><!---留言内容-->
|
|
|
|
|
<% end %>
|
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
|
|
|
|
<%if replies_all.first %>
|
|
|
|
|
<div class="talkWrapMsg"><a class=" c_blue ml258" href="javascript:void(0)" style="color: #0781b4;" id="showgithelp<%= topic.id%>" value="show_help" onclick ="showhelpAndScrollToMessage('talkWrapMsg<%= topic.id %>','#showgithelp<%= topic.id%>','<%=topic.replies_count%>'); " class="c_dblue lh23">展开回复(<%= topic.replies_count.to_s%>)</a></div>
|
|
|
|
|
<% end %>
|
|
|
|
|
<% end %>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<% end %>
|
|
|
|
|
<% else %>
|
|
|
|
|
<p class="nodata"><%= l(:label_no_data) %></p>
|
|
|
|
|
<% end %>
|
|
|
|
|
<ul class="wlist">
|
|
|
|
|
<%= pagination_links_full @topic_pages, @topic_count, :per_page_links => false, :remote => false, :flag => true %>
|
|
|
|
|
</ul>
|
|
|
|
|
<!--讨论主类容 end-->
|
|
|
|
|
|
|
|
|
|
<%# other_formats_links do |f| %>
|
|
|
|
|
<%#= f.link_to 'Atom', :url => {:key => User.current.rss_key} %>
|
|
|
|
|
<%# end %>
|
|
|
|
|
|
|
|
|
|
<% html_title @board.name %>
|
|
|
|
|
|
|
|
|
|
<% content_for :header_tags do %>
|
|
|
|
|
<%= auto_discovery_link_tag(:atom, {:format => 'atom', :key => User.current.rss_key}, :title => "#{@project}: #{@board}") %>
|
|
|
|
|
<% end %>
|
|
|
|
|
</div>
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
|
// var flag = false;
|
|
|
|
|
// jQuery(document).ready(function($) {
|
|
|
|
|
// transpotUrl('#content');
|
|
|
|
|
// });
|
|
|
|
|
function submit_message_replay()
|
|
|
|
|
{
|
|
|
|
|
if(flag)
|
|
|
|
|
{
|
|
|
|
|
$("#message_form").submit();
|
|
|
|
|
function nh_check_field(params){
|
|
|
|
|
var result=true;
|
|
|
|
|
|
|
|
|
|
if($.trim(params.subject.val()) == ""){
|
|
|
|
|
params.subjectmsg.html('主题不能为空');
|
|
|
|
|
params.subjectmsg.css({color:'#ff0000'});
|
|
|
|
|
result=false;
|
|
|
|
|
}else{
|
|
|
|
|
params.subjectmsg.html('填写正确');
|
|
|
|
|
params.subjectmsg.css({color:'#008000'});
|
|
|
|
|
}
|
|
|
|
|
params.subjectmsg.show();
|
|
|
|
|
|
|
|
|
|
if($.trim(params.content.html()) == ""){
|
|
|
|
|
params.contentmsg.html('内容不能为空');
|
|
|
|
|
params.contentmsg.css({color:'#ff0000'});
|
|
|
|
|
result=false;
|
|
|
|
|
}else{
|
|
|
|
|
params.contentmsg.html('填写正确');
|
|
|
|
|
params.contentmsg.css({color:'#008000'});
|
|
|
|
|
}
|
|
|
|
|
params.contentmsg.show();
|
|
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
|
//submitProjectsBoard()
|
|
|
|
|
KindEditor.ready(function(K){
|
|
|
|
|
$("div[name='container_board']").each(function(){
|
|
|
|
|
var container=$(this);
|
|
|
|
|
var form =$("form", container);
|
|
|
|
|
var messege = $("p[aa='message_show']",container);
|
|
|
|
|
var textarea= $("textarea[aa='content']",container);
|
|
|
|
|
var editor = K.create(textarea, {
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
function nh_init_board(params){
|
|
|
|
|
params.showbtn.click(function(){//发帖/编辑/回复按钮的click
|
|
|
|
|
if(params.textarea.data('init') == undefined){
|
|
|
|
|
var editor = params.kindutil.create(params.textarea, {//初始化编辑器
|
|
|
|
|
resizeType : 1,
|
|
|
|
|
allowPreviewEmoticons : false,
|
|
|
|
|
allowImageUpload : false,
|
|
|
|
|
width:"89%",
|
|
|
|
|
minWidth:"1px",
|
|
|
|
|
width:"565px",
|
|
|
|
|
items : []
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$("a[name='submitbtn']",container).click(function(){
|
|
|
|
|
textarea[0].value = editor.html();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (editor.html() == "") {
|
|
|
|
|
|
|
|
|
|
messege.html("回复内容不能为空") ;
|
|
|
|
|
messege.css('color', '#ff0000');
|
|
|
|
|
messege.show();
|
|
|
|
|
params.submitbtn.click(function(){//提交按钮click
|
|
|
|
|
var is_checked = nh_check_field({
|
|
|
|
|
subject:params.inputsubject,
|
|
|
|
|
subjectmsg:params.subjectmsg,
|
|
|
|
|
content:editor,
|
|
|
|
|
contentmsg:params.contentmsg,
|
|
|
|
|
});
|
|
|
|
|
if(is_checked){
|
|
|
|
|
alert('submit');
|
|
|
|
|
params.textarea.html(editor.html());
|
|
|
|
|
// params.form.submit();
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
messege.html("填写正确");
|
|
|
|
|
messege.css('color', '#008000');
|
|
|
|
|
messege.show();
|
|
|
|
|
form.submit();
|
|
|
|
|
});
|
|
|
|
|
params.cancelbtn.click(function(){//取消按钮click
|
|
|
|
|
params.about_talk.toggle();//显示/隐藏编辑区
|
|
|
|
|
params.inputsubject.focus();
|
|
|
|
|
});
|
|
|
|
|
params.textarea.data('init','1')
|
|
|
|
|
}
|
|
|
|
|
params.cancelbtn.click();//显示/隐藏编辑区
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
$(function(){
|
|
|
|
|
KindEditor.ready(function(K){
|
|
|
|
|
$("div[nhname='container_board']").each(function(){
|
|
|
|
|
var container = $(this);
|
|
|
|
|
nh_init_board({
|
|
|
|
|
kindutil:K,
|
|
|
|
|
showbtn:$("a[nhname='showbtn']",container),
|
|
|
|
|
about_talk:$("div[nhname='about_talk']",container),
|
|
|
|
|
inputsubject:$("input[nhname='inputsubject']",container),
|
|
|
|
|
subjectmsg:$("p[nhname='subjectmsg']",container),
|
|
|
|
|
textarea:$("textarea[nhname='textarea']",container),
|
|
|
|
|
contentmsg:$("p[nhname='contentmsg']",container),
|
|
|
|
|
submitbtn:$("a[nhname='submitbtn']",container),
|
|
|
|
|
cancelbtn:$("a[nhname='cancelbtn']",container),
|
|
|
|
|
form:$("form[nhname='form']",container)
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
</script>
|