diff --git a/app/views/boards/_course_new.html.erb b/app/views/boards/_course_new.html.erb index fba80127b..a380ad67f 100644 --- a/app/views/boards/_course_new.html.erb +++ b/app/views/boards/_course_new.html.erb @@ -3,7 +3,7 @@ <%= render :partial => 'form_course', :locals => {:f => f, :topic => @message} %>
  • <%= l(:button_cancel) %> - <%= l(:button_submit)%> + <%= l(:button_submit)%>
  • <% end %> diff --git a/app/views/boards/_course_show.html.erb b/app/views/boards/_course_show.html.erb index 5dde6c460..19d0e6bc9 100644 --- a/app/views/boards/_course_show.html.erb +++ b/app/views/boards/_course_show.html.erb @@ -32,7 +32,7 @@

    讨论区共有<%= @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 + ":" %> diff --git a/app/views/boards/_edit.html.erb b/app/views/boards/_edit.html.erb index 15358c03a..a9acbf85f 100644 --- a/app/views/boards/_edit.html.erb +++ b/app/views/boards/_edit.html.erb @@ -12,7 +12,7 @@ } do |f| %> <%= render :partial => 'form_project', :locals => {:f => f, :replying => !topic.parent.nil?, :topic => topic} %> - <%= l(:button_submit)%> + <%= l(:button_submit)%> <%= l(:button_cancel) %> <%#= link_to l(:button_cancel), board_message_url(topic.board, topic.root, :r => (topic.parent_id && topic.id)), :class => "blue_btn grey_btn fl c_white" %> diff --git a/app/views/boards/_form_course.html.erb b/app/views/boards/_form_course.html.erb index 09ee1c3b4..945f58c22 100644 --- a/app/views/boards/_form_course.html.erb +++ b/app/views/boards/_form_course.html.erb @@ -8,16 +8,16 @@ <%= f.text_field :subject, { size: 60, id: "message_subject",:class=>"talk_input w585" }.merge(extra_option) %> -

    +

    <% else %>
  • - <%= f.text_field :subject, { size: 60, id: "message_subject", onkeyup: "regexSubject();",:class=>"talk_input w585" }.merge(extra_option) %> + <%= f.text_field :subject, { size: 60, id: "message_subject#{f.object.id}", onkeyup: "regexSubject('#{f.object.id}');",:class=>"talk_input w585" }.merge(extra_option) %> -

    +

  • <% end %>
  • @@ -40,12 +40,12 @@ <% end %> <%= text_area :quote,:quote,:style => 'display:none' %> <% if replying%> - <%= f.text_area :content, :class => 'talk_text fl', :id => 'message_content', :onkeyup => "regexContent();", :maxlength => 5000,:placeholder => "最多3000个汉字(或6000个英文字符)", :style=>"width: 575px;" %> + <%= f.text_area :content, :class => 'talk_text fl', :id => "message_content#{f.object.id}", :onkeyup => "regexContent('#{f.object.id}');", :maxlength => 5000,:placeholder => "最多3000个汉字(或6000个英文字符)", :style=>"width: 575px;" %> <% else %> - <%= f.text_area :content, :class => 'talk_text fl', :id => 'message_content', :onkeyup => "regexContent();", :maxlength => 5000,:placeholder => "最多3000个汉字(或6000个英文字符)" %> + <%= f.text_area :content, :class => 'talk_text fl', :id => "message_content#{f.object.id}", :onkeyup => "regexContent('#{f.object.id}');", :maxlength => 5000,:placeholder => "最多3000个汉字(或6000个英文字符)" %> <% end %>
    -

    +

  • diff --git a/app/views/boards/_form_project.html.erb b/app/views/boards/_form_project.html.erb index 3ecffa3e2..8288debe2 100644 --- a/app/views/boards/_form_project.html.erb +++ b/app/views/boards/_form_project.html.erb @@ -5,19 +5,19 @@
  • - <%= f.text_field :subject, { size: 60, id: "message_subject",:class=>"talk_input w585" }.merge(extra_option) %> + <%= f.text_field :subject, { size: 60, id: "message_subject#{f.object.id}",:class=>"talk_input w585" }.merge(extra_option) %> -

    +

  • <% else %>
  • - <%= f.text_field :subject, { size: 60, id: "message_subject", onkeyup: "regexSubject();",:class=>"talk_input w585" }.merge(extra_option) %> + <%= f.text_field :subject, { size: 60, id: "message_subject#{f.object.id}", onkeyup: "regexSubject('#{f.object.id}');",:class=>"talk_input w585" }.merge(extra_option) %> -

    +

  • <% end %>
  • @@ -36,16 +36,16 @@
  • <% unless replying %> - + <% end %> <%= text_area :quote,:quote,:style => 'display:none' %> <% if replying%> - <%= f.text_area :content, :class => 'talk_text fl', :id => 'message_content', :onkeyup => "regexContent();", :maxlength => 5000,:placeholder => "最多3000个汉字(或6000个英文字符)", :style=>"width: 575px;" %> + <%= f.text_area :content, :class => 'talk_text fl', :id => "message_content#{f.object.id}", :onkeyup => "regexContent('#{f.object.id}');", :maxlength => 5000,:placeholder => "最多3000个汉字(或6000个英文字符)", :style=>"width: 575px;" %> <% else %> - <%= f.text_area :content, :class => 'talk_text fl', :id => 'message_content', :onkeyup => "regexContent();", :maxlength => 5000,:placeholder => "最多3000个汉字(或6000个英文字符)" %> + <%= f.text_area :content, :class => 'talk_text fl', :id => "message_content#{f.object.id}", :onkeyup => "regexContent('#{f.object.id}');", :maxlength => 5000,:placeholder => "最多3000个汉字(或6000个英文字符)" %> <% end %>
    -

    +

  • diff --git a/app/views/boards/_project_show.html.erb b/app/views/boards/_project_show.html.erb index 8a9ffd990..63bb66a6a 100644 --- a/app/views/boards/_project_show.html.erb +++ b/app/views/boards/_project_show.html.erb @@ -33,7 +33,7 @@ <% 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 + ":" %> @@ -215,20 +215,5 @@ $("#message_form").submit(); } } - function regexContent() - { - var content = $.trim($("#message_content").val()); - if(content.length ==0) - { - $("#message_content_span").text("<%= l(:label_reply_empty) %>"); - $("#message_content_span").css('color','#ff0000'); - flag = false; - } - else - { - $("#message_content_span").text("<%= l(:label_field_correct) %>"); - $("#message_content_span").css('color','#008000'); - flag = true; - } - } + \ No newline at end of file diff --git a/app/views/boards/show.html.erb b/app/views/boards/show.html.erb index 2e736bdf7..c111aeaf0 100644 --- a/app/views/boards/show.html.erb +++ b/app/views/boards/show.html.erb @@ -25,14 +25,29 @@ <% if @project %> <%= render :partial => 'project_show', locals: {project: @project} %> diff --git a/app/views/courses/show.html.erb b/app/views/courses/show.html.erb index 2a818b892..29e7f1097 100644 --- a/app/views/courses/show.html.erb +++ b/app/views/courses/show.html.erb @@ -15,7 +15,7 @@   <%= l(:label_new_activity) %>: <%= link_to "#{eventToLanguageCourse(e.event_type, @course)} "<< format_activity_title(e.event_title), (e.event_type.eql?("attachment")&&e.container.kind_of?(Course)) ? course_files_path(e.container) : - (e.event_type.eql?("bid") ? homework_course_path(@course) : e.event_url),:class => "problem_tit c_dblue fl fb"%> + (e.event_type.eql?("bid") ? homework_course_path(@course) : (e.event_type.eql?("message") ? course_boards_path(@course,:topic_id => e.id) : e.event_url)),:class => "problem_tit c_dblue fl fb"%>

    <%= e.event_description.html_safe %>
    diff --git a/app/views/projects/show.html.erb b/app/views/projects/show.html.erb index 972606f31..f3c453019 100644 --- a/app/views/projects/show.html.erb +++ b/app/views/projects/show.html.erb @@ -66,9 +66,7 @@ <%= link_to h(e.user), user_path(e.user_id), :class => "problem_name c_orange fl" %> <%= l(:label_new_activity) %> : <%= link_to format_activity_title("#{act.board.name}: #{act.subject}"), - {:controller => 'messages', - :action => 'show', - :board_id => act.board_id}.merge(act.parent_id.nil? ? {:id => act.id} : {:id => act.parent_id, :r => act.id, :anchor => "message-#{act.id}"}), + project_boards_path(@project,:topic_id => act.id), :class => "problem_tit fl fb " %>

    <%= textAreailizable act,:content %>
    diff --git a/public/javascripts/course.js b/public/javascripts/course.js index f0b1338da..227048ef6 100644 --- a/public/javascripts/course.js +++ b/public/javascripts/course.js @@ -151,45 +151,48 @@ function submit_edit_course(id) /////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////课程讨论区 -function regexSubject() -{ - var content = $.trim($("#message_subject").val()); - if(content.length ==0) - { - $("#subject_span").text("主题不能为空"); - $("#subject_span").css('color','#ff0000'); +function regexSubject(id) { + var subjectid = "#message_subject" + id ; + var content = $.trim($(subjectid).val()); + var message = "#subject_span" + id; + if (content.length == 0) { + $(message).text("主题不能为空"); + $(message).css('color', '#ff0000'); return false; } - else - { - $("#subject_span").text("填写正确"); - $("#subject_span").css('color','#008000'); + else { + $(message).text("填写正确"); + $(message).css('color', '#008000'); return true; } return false; } -function regexContent() -{ - var content = message_content_editor.html(); - if(content.length ==0) - { - $("#message_content_span").text("描述不能为空"); - $("#message_content_span").css('color','#ff0000'); +function regexContent(id) { + var contentid = "#message_content" + id; + var message = "#message_content_span"+ id; + var content = $.trim($(contentid).val()); + if (content.length == 0) { + $(message).text("描述不能为空"); + $(message).css('color', '#ff0000'); return false; } - else - { - $("#message_content_span").text("填写正确"); - $("#message_content_span").css('color','#008000'); + else { + $(message).text("填写正确"); + $(message).css('color', '#008000'); return true; } return false; } -function submitCoursesBoard() -{ - message_content_editor.sync(); - if(regexSubject()&®exContent()){$("#message-form").submit();} + +// 项目讨论区编辑和提交 +function submitProjectsBoard(id) { + var formid = "#message-form" + id; + if (regexSubject(id) && regexContent(id)) { + $(formid).submit(); + } } + + /////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////// 课程通知 function regexTitle() diff --git a/public/javascripts/project.js b/public/javascripts/project.js index 0bc094b1d..c28a86f08 100644 --- a/public/javascripts/project.js +++ b/public/javascripts/project.js @@ -144,42 +144,49 @@ $(function(){ /////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////项目讨论区 -function regexSubject() { - var content = $.trim($("#message_subject").val()); +function regexSubject(id) { + var subjectid = "#message_subject" + id ; + var content = $.trim($(subjectid).val()); + var message = "#subject_span" + id; if (content.length == 0) { - $("#subject_span").text("主题不能为空"); - $("#subject_span").css('color', '#ff0000'); + $(message).text("主题不能为空"); + $(message).css('color', '#ff0000'); return false; } else { - $("#subject_span").text("填写正确"); - $("#subject_span").css('color', '#008000'); + $(message).text("填写正确"); + $(message).css('color', '#008000'); return true; } return false; } -function regexContent() { - var content = $.trim($("#message_content").val()); +function regexContent(id) { + + var contentid = "#message_content" + id; + var message = "#message_content_span"+ id; + var content = $.trim($(contentid).val()); if (content.length == 0) { - $("#message_content_span").text("描述不能为空"); - $("#message_content_span").css('color', '#ff0000'); + + $(message).text("描述不能为空"); + $(message).css('color', '#ff0000'); return false; } else { - $("#message_content_span").text("填写正确"); - $("#message_content_span").css('color', '#008000'); + + $(message).text("填写正确"); + $(message).css('color', '#008000'); return true; } return false; } // 项目讨论区编辑和提交 -function submitProjectsBoard() { - if (regexSubject() && regexContent()) { - $("#message-form").submit(); +function submitProjectsBoard(id) { + var formid = "#message-form" + id; + if (regexSubject(id) && regexContent(id)) { + $(formid).submit(); } } - // 提交新闻 function regexTitle() { var name = $("#news_title").val(); diff --git a/public/stylesheets/project.css b/public/stylesheets/project.css index 14a7a9a34..3b04e23bf 100644 --- a/public/stylesheets/project.css +++ b/public/stylesheets/project.css @@ -738,6 +738,6 @@ a:hover.Reply_pic{border:1px solid #64bdd9;} .Replybox{ float:left; width:495px; margin-left:5px;} .talk_nextpage{ border:none; width:410px; margin:0 auto;} .newtalk { margin-top:8px; margin-right:8px;} -.talk_new{ border-bottom:1px dashed #d9d9d9; padding-bottom:10px;} + #about_newtalk{ display:none;}