memcached_alan
yutao 10 years ago
parent fe404f8cb1
commit 69affa8a2e

@ -81,7 +81,11 @@
<% end %> <% end %>
</div> </div>
<div class="cl"></div> <div class="cl"></div>
<p nhname="contentmsg" class="ml55"></p> <% if replying%>
<p nhname="contentmsg"></p>
<% else %>
<p nhname="contentmsg" class="ml55"></p>
<%end %>
</li> </li>
<div class="cl"></div> <div class="cl"></div>
<li> <li>

@ -1,4 +1,4 @@
<%= form_for @message, :url =>{:controller=>'messages',:action => 'new', :board_id => @board.id, :is_board => 'true'},:nhname=>'form', :html => {:multipart => true, :id => 'message-form', :name=>'message-form'} do |f| %> <%= form_for @message, :url =>{:controller=>'messages',:action => 'new', :board_id => @board.id, :is_board => 'true'},:html => {:nhname=>'form', :multipart => true, :id => 'message-form', :name=>'message-form'} do |f| %>
<%= render :partial => 'form_project', :locals => {:f => f, :topic => @message} %> <%= render :partial => 'form_project', :locals => {:f => f, :topic => @message} %>
<li> <li>

@ -31,72 +31,73 @@
<p class="c_dark mb5">讨论区共有<span class="c_orange"><%= @topic_count %></span>个帖子</p> <p class="c_dark mb5">讨论区共有<span class="c_orange"><%= @topic_count %></span>个帖子</p>
<% if @topics.any? %> <% if @topics.any? %>
<% @topics.each do |topic| %> <% @topics.each do |topic| %>
<div nhname="container_board" ecname="container_board_reply"> <div class="talkmain_box" id="topic<%= topic.id %>" nhname="container_board" mhname="container_board_reply" style="border:none; margin-bottom:0; border-bottom: 1px dashed #d9d9d9;">
<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' %>
<%= 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">
<div class="talkmain_txt fl mt5"> <% author = topic.author.to_s + "" %>
<% author = topic.author.to_s + "" %> <%= link_to author, user_path(topic.author), :class =>"talkmain_name fl " %>
<%= link_to author, user_path(topic.author), :class =>"talkmain_name fl " %> <p class="talkmain_tit fl fb break_word" style="width:auto;">&nbsp;&nbsp;<%= h(topic.subject) %></p>
<p class="talkmain_tit fl fb break_word">&nbsp;&nbsp;<%= h(topic.subject) %></p> <div style="float:right;max-width:110px;">
<% if topic.editable_by?(User.current) %> <% if topic.editable_by?(User.current) %>
<a href="javascript:void(0)" nhname="showbtn_reply" 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 %> <% end %>
<%= link_to( <%= link_to(
l(:button_delete), l(:button_delete),
{:controller =>'messages',:action => 'destroy', :id => topic.id, :board_id => topic.board_id, :is_board=>'true'}, {:controller =>'messages',:action => 'destroy', :id => topic.id, :board_id => topic.board_id, :is_board=>'true'},
:method => :post, :method => :post,
:data => {:confirm => l(:text_are_you_sure)}, :data => {:confirm => l(:text_are_you_sure)},
:class => 'talk_edit fr', :class => 'talk_edit fr',
:style => ' margin-right: 10px;' :style => ' margin-right: 10px;'
) if topic.destroyable_by?(User.current) %> ) if topic.destroyable_by?(User.current) %>
<% if topic.sticky? %> <% if topic.sticky? %>
<a href="javascript:void(0)" class="talk_up fr c_red" style="margin-right: 10px;"><%= l(:label_board_sticky)%></a> <a href="javascript:void(0)" class="talk_up fr c_red" style="margin-right: 10px;"><%= l(:label_board_sticky)%></a>
<% end %> <% end %>
<div class="cl"></div> </div>
<div class="project_board_content break_word" id="content_<%=topic.id%>"> <div class="cl"></div>
<div id="contentmessage<%=topic.id %>" class="upload_img"> <div class="project_board_content break_word" id="content_<%=topic.id%>">
<%= topic.content.html_safe %> <div id="contentmessage<%=topic.id %>" class="upload_img">
</div> <%= topic.content.html_safe %>
</div> </div>
<p style="display: none" id="project_show_<%= topic.id%>"> </div>
<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> <p style="display: none" id="project_show_<%= topic.id%>">
<span class="g-arr-down"> <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>
<img id="arrow<%=topic.id%>" src="/images/jiantou.jpg" width="12" height="6" /> <span class="g-arr-down">
</span> <img id="arrow<%=topic.id%>" src="/images/jiantou.jpg" width="12" height="6" />
</p> </span>
<%= link_to_attachments_course topic, :author => false %> </p>
<%= l(:label_activity_time)%>&nbsp;&nbsp;<%= format_time topic.created_on %> <%= link_to_attachments_course topic, :author => false %>
</div> <%= l(:label_activity_time)%>&nbsp;&nbsp;<%= format_time topic.created_on %>
<% if User.current.logged? %> </div>
<%= toggle_link l(:button_reply), "reply" + topic.id.to_s, :focus => "about_newtalk#{topic.id}",:class => ' c_dblue fr' %> <% if User.current.logged? %>
<% end %> <a href="javascript:void(0)" nhname="showbtn_reply" class="c_dblue fr" style="margin-right:10px;"><%= l(:button_reply) %></a>
<div class="cl"></div> <% end %>
</div> <div class="cl"></div>
<div class="talk_new ml15 mb10" nhname='about_talk' id="about_newtalk<%=topic.id%>" style="display: none"> <div class="talk_new ml15 mb10" nhname='about_talk' id="about_newtalk<%=topic.id%>" style="display: none">
<ul> <ul>
<%= render :partial => 'edit',locals: {:topic => topic} %> <%= render :partial => 'edit',locals: {:topic => topic} %>
</ul> </ul>
</div> </div>
<div class="cl"></div> <div class="cl"></div>
</div> <div class="talkWrapBox">
<% reply = Message.new(:subject => "RE: #{@message.subject}")%>
<div class="talkWrapBox"> <% if !topic.locked? && authorize_for('messages', 'reply') %>
<% reply = Message.new(:subject => "RE: #{@message.subject}")%> <em class="talkWrapArrow"></em>
<% if !topic.locked? && authorize_for('messages', 'reply') %> <div class="cl"></div>
<em class="talkWrapArrow"></em> <div class="talkConIpt ml15 mb10" style="display:none;margin-left:40px;" nhname="about_talk_reply" id="reply<%= topic.id %>">
<div class="cl"></div> <%= form_for reply, :as => :reply, :url => {:controller=>'messages',:action => 'reply', :id => topic.id, :board_id => topic.board_id, :is_board => 'true'},
<div class="talkConIpt ml15 mb10" style="display:none;" nhname="about_talk_reply" id="reply<%= topic.id %>"> :html => {:nhname=>"form",:multipart => true, :id => 'message_form' + topic.id.to_s, :name=>'message-form'} do |f| %>
<%= form_for reply, :as => :reply, :url => {:controller=>'messages',:action => 'reply', :id => topic.id, :board_id => topic.board_id, :is_board => 'true'}, <%= render :partial => 'form_project', :locals => {:f => f, :replying => true} %>
:html => {:nhname=>"form",:multipart => true, :id => 'message_form' + topic.id.to_s, :name=>'message-form'} do |f| %> <div style="padding-top:5px;" class="fr">
<%= render :partial => 'form_project', :locals => {:f => f, :replying => true} %> <a href="javascript:void(0)" nhname="cancelbtn" class="blue_btn fr ml10" style=""><%= l(:button_cancel)%></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>
<a href="javascript:void(0)" nhname="submitbtn" class="blue_btn fr " style=""><%= l(:label_memo_create)%></a> </div>
<% end %> <% end %>
<div class="cl"></div> <div class="cl"></div>
</div> </div>
<% end %> <% end %>
</div> </div>
<div class="cl"></div>
</div>
<% end %> <% end %>
<% end %> <% end %>
</div> </div>
@ -130,7 +131,8 @@
function nh_init_board(params){ function nh_init_board(params){
params.showbtn.click(function(){//发帖/编辑/回复按钮的click params.showbtn.click(function(){//发帖/编辑/回复按钮的click
if(params.textarea.data('init') == undefined){ if(params.textarea.data('init') == undefined){
var editor = params.kindutil.create(params.textarea, {//初始化编辑器 //初始化编辑器
var editor = params.kindutil.create(params.textarea, {
resizeType : 1, resizeType : 1,
allowPreviewEmoticons : false, allowPreviewEmoticons : false,
allowImageUpload : false, allowImageUpload : false,
@ -138,7 +140,8 @@
width:"565px", width:"565px",
items : [] items : []
}); });
params.submitbtn.click(function(){//提交按钮click //表单提交
params.form.submit(function(){
var is_checked = nh_check_field({ var is_checked = nh_check_field({
subject:params.inputsubject, subject:params.inputsubject,
subjectmsg:params.subjectmsg, subjectmsg:params.subjectmsg,
@ -148,14 +151,29 @@
if(is_checked){ if(is_checked){
alert('submit'); alert('submit');
params.textarea.html(editor.html()); params.textarea.html(editor.html());
// params.form.submit(); return false;
// return true;
} }
return false;
}); });
params.cancelbtn.click(function(){//取消按钮click //提交按钮click
params.submitbtn.click(function(){
params.form.submit();
});
//取消按钮click
params.cancelbtn.click(function(){
params.about_talk.toggle();//显示/隐藏编辑区 params.about_talk.toggle();//显示/隐藏编辑区
params.inputsubject.focus(); if(params.about_talk.is(':hidden')){//隐藏时reset表单数据
params.form[0].reset();
editor.html(params.textarea.html());
params.subjectmsg.hide();
params.contentmsg.hide();
}else{
if(params.type=='reply'){editor.focus();}//有bug 页面不跟着跳
else params.inputsubject.focus();
}
}); });
params.textarea.data('init','1') params.textarea.data('init','1');//标记为已经初始化
} }
params.cancelbtn.click();//显示/隐藏编辑区 params.cancelbtn.click();//显示/隐藏编辑区
}); });
@ -178,10 +196,11 @@
form:$("form[nhname='form']",about_talk) form:$("form[nhname='form']",about_talk)
}); });
}); });
$("div[ecname='container_board_reply']").each(function(){ $("div[mhname='container_board_reply']").each(function(){
var container = $(this); var container = $(this);
var about_talk = $("div[nhname='about_talk_reply']",container); var about_talk = $("div[nhname='about_talk_reply']",container);
nh_init_board({ nh_init_board({
type:'reply',
kindutil:K, kindutil:K,
showbtn:$("a[nhname='showbtn_reply']",container), showbtn:$("a[nhname='showbtn_reply']",container),
about_talk:about_talk, about_talk:about_talk,

Loading…
Cancel
Save