From 69affa8a2ecdc914e32a215f362e67f3f8bb0541 Mon Sep 17 00:00:00 2001 From: yutao <283765470@qq.com> Date: Mon, 25 May 2015 15:19:42 +0800 Subject: [PATCH] ... --- app/views/boards/_form_project.html.erb | 6 +- app/views/boards/_project_new_topic.html.erb | 2 +- app/views/boards/_project_show.html.erb | 169 +++++++++++-------- 3 files changed, 100 insertions(+), 77 deletions(-) diff --git a/app/views/boards/_form_project.html.erb b/app/views/boards/_form_project.html.erb index 5cf20a993..58bb5501c 100644 --- a/app/views/boards/_form_project.html.erb +++ b/app/views/boards/_form_project.html.erb @@ -81,7 +81,11 @@ <% end %>
-

+ <% if replying%> +

+ <% else %> +

+ <%end %>
  • diff --git a/app/views/boards/_project_new_topic.html.erb b/app/views/boards/_project_new_topic.html.erb index 05304e978..d7c8972fc 100644 --- a/app/views/boards/_project_new_topic.html.erb +++ b/app/views/boards/_project_new_topic.html.erb @@ -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} %>
  • diff --git a/app/views/boards/_project_show.html.erb b/app/views/boards/_project_show.html.erb index ae8dd5ed2..dc1cff634 100644 --- a/app/views/boards/_project_show.html.erb +++ b/app/views/boards/_project_show.html.erb @@ -31,72 +31,73 @@

    讨论区共有<%= @topic_count %>个帖子

    <% if @topics.any? %> <% @topics.each do |topic| %> -
    -
    - <%= link_to image_tag(url_to_avatar(topic.author), :width=>"42",:height=>"42"), user_path(topic.author),:class =>'talkmain_pic fl' %> -
    - <% author = topic.author.to_s + ":" %> - <%= link_to author, user_path(topic.author), :class =>"talkmain_name fl " %> -

      <%= h(topic.subject) %>

    - <% if topic.editable_by?(User.current) %> - <%= l(:button_edit) %> - <% end %> - <%= 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? %> - <%= l(:label_board_sticky)%> - <% end %> -
    -
    -
    - <%= topic.content.html_safe %> -
    -
    - - <%= link_to_attachments_course topic, :author => false %> - <%= l(:label_activity_time)%>:  <%= format_time topic.created_on %> -
    - <% if User.current.logged? %> - <%= toggle_link l(:button_reply), "reply" + topic.id.to_s, :focus => "about_newtalk#{topic.id}",:class => ' c_dblue fr' %> - <% end %> -
    -
    - -
    -
    - -
    - <% reply = Message.new(:subject => "RE: #{@message.subject}")%> - <% if !topic.locked? && authorize_for('messages', 'reply') %> - -
    - - <% end %> -
    - +
    + <%= link_to image_tag(url_to_avatar(topic.author), :width=>"42",:height=>"42"), user_path(topic.author),:class =>'talkmain_pic fl' %> +
    + <% author = topic.author.to_s + ":" %> + <%= link_to author, user_path(topic.author), :class =>"talkmain_name fl " %> +

      <%= h(topic.subject) %>

    +
    + <% if topic.editable_by?(User.current) %> + <%= l(:button_edit) %> + <% end %> + <%= 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? %> + <%= l(:label_board_sticky)%> + <% end %> +
    +
    +
    +
    + <%= topic.content.html_safe %> +
    +
    + + <%= link_to_attachments_course topic, :author => false %> + <%= l(:label_activity_time)%>:  <%= format_time topic.created_on %> +
    + <% if User.current.logged? %> + <%= l(:button_reply) %> + <% end %> +
    + +
    +
    + <% reply = Message.new(:subject => "RE: #{@message.subject}")%> + <% if !topic.locked? && authorize_for('messages', 'reply') %> + +
    + + <% end %> +
    +
    +
    <% end %> <% end %> @@ -130,7 +131,8 @@ function nh_init_board(params){ params.showbtn.click(function(){//发帖/编辑/回复按钮的click if(params.textarea.data('init') == undefined){ - var editor = params.kindutil.create(params.textarea, {//初始化编辑器 + //初始化编辑器 + var editor = params.kindutil.create(params.textarea, { resizeType : 1, allowPreviewEmoticons : false, allowImageUpload : false, @@ -138,7 +140,8 @@ width:"565px", items : [] }); - params.submitbtn.click(function(){//提交按钮click + //表单提交 + params.form.submit(function(){ var is_checked = nh_check_field({ subject:params.inputsubject, subjectmsg:params.subjectmsg, @@ -148,14 +151,29 @@ if(is_checked){ alert('submit'); params.textarea.html(editor.html()); -// params.form.submit(); + return false; +// return true; + } + return false; + }); + //提交按钮click + params.submitbtn.click(function(){ + params.form.submit(); + }); + //取消按钮click + params.cancelbtn.click(function(){ + params.about_talk.toggle();//显示/隐藏编辑区 + 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.cancelbtn.click(function(){//取消按钮click - params.about_talk.toggle();//显示/隐藏编辑区 - params.inputsubject.focus(); - }); - params.textarea.data('init','1') + params.textarea.data('init','1');//标记为已经初始化 } params.cancelbtn.click();//显示/隐藏编辑区 }); @@ -178,10 +196,11 @@ form:$("form[nhname='form']",about_talk) }); }); - $("div[ecname='container_board_reply']").each(function(){ + $("div[mhname='container_board_reply']").each(function(){ var container = $(this); var about_talk = $("div[nhname='about_talk_reply']",container); nh_init_board({ + type:'reply', kindutil:K, showbtn:$("a[nhname='showbtn_reply']",container), about_talk:about_talk,