From 8f402fe0b72b243a1ea92322cebaccfdeb9f4a7f Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Tue, 14 Oct 2014 17:09:52 +0800 Subject: [PATCH] =?UTF-8?q?#562=E8=AF=BE=E7=A8=8B=E8=AE=A8=E8=AE=BA?= =?UTF-8?q?=E5=8C=BA=E5=9B=9E=E5=A4=8D=E5=A2=9E=E5=8A=A0js=E9=AA=8C?= =?UTF-8?q?=E8=AF=81=20=E5=8F=82=E8=B5=9B=E4=BD=9C=E5=93=81js=E9=AA=8C?= =?UTF-8?q?=E8=AF=81=E5=A2=9E=E5=8A=A0=E5=B7=A6=E5=8F=B3=E4=B8=A4=E7=AB=AF?= =?UTF-8?q?=E7=A9=BA=E6=A0=BC=E5=8E=BB=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../contests/_new_softapplication.html.erb | 8 ++--- app/views/messages/_course_show.html.erb | 31 +++++++++++++++---- app/views/messages/_form.html.erb | 1 + 3 files changed, 30 insertions(+), 10 deletions(-) diff --git a/app/views/contests/_new_softapplication.html.erb b/app/views/contests/_new_softapplication.html.erb index 3e4c0c9e0..fb16e9351 100644 --- a/app/views/contests/_new_softapplication.html.erb +++ b/app/views/contests/_new_softapplication.html.erb @@ -4,7 +4,7 @@ //验证作品名称 function regexName() { - var name = $("#softapplication_name").val(); + var name = $.trim($("#softapplication_name").val()); if(name.length == 0) { $("#spane_name_notice").text("<%= l(:label_no_softapplication_name) %>"); @@ -31,7 +31,7 @@ //验证作品简介 function regexDescription() { - var name = $("#softapplication_description").val(); + var name = $.trim($("#softapplication_description").val()); if(name.length ==0) { $("#span_sofapplication_description").text("<%= l(:label_no_softapplication_description) %>"); @@ -56,7 +56,7 @@ //验证运行平台 function regexWorkdescription() { - var workDescription = $("#softapplication_android_min_version_available").val(); + var workDescription = $.trim($("#softapplication_android_min_version_available").val()); if(workDescription.length ==0) { $("#spane_workdescription_notice").text("<%= l(:label_no_softapplication_platform) %>"); @@ -80,7 +80,7 @@ //验证开发人员 function regexDevelopers() { - var workDescription = $("#softapplication_application_developers").val(); + var workDescription = $.trim($("#softapplication_application_developers").val()); if(workDescription.length ==0) { $("#span_softapplication_application_developers").text("<%= l(:label_no_softapplication_developers) %>"); diff --git a/app/views/messages/_course_show.html.erb b/app/views/messages/_course_show.html.erb index 41f2e4736..51764341d 100644 --- a/app/views/messages/_course_show.html.erb +++ b/app/views/messages/_course_show.html.erb @@ -177,7 +177,8 @@ <%= form_for @reply, :as => :reply, :url => {:action => 'reply', :id => @topic}, :html => {:multipart => true, :id => 'message-form'} do |f| %> <%= render :partial => 'form', :locals => {:f => f, :replying => true} %> - <%= submit_tag l(:button_submit) %> + <%#= submit_tag l(:button_submit) %> + <%#= preview_link({:controller => 'messages', :action => 'preview', :board_id => @board}, 'message-form') %> <% end %>
@@ -190,9 +191,27 @@ jQuery(document).ready(function($) { transpotUrl('#content'); }); -// function regexContent() -// { -// var content = trim($("#message_content").val()); -// alert(content); -// } + function submit_message_replay() + { + if(regexContent()) + { + $("#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'); + return false; + } + else + { + $("#message_content_span").text("<%= l(:label_field_correct) %>"); + $("#message_content_span").css('color','#008000'); + return true; + } + } \ No newline at end of file diff --git a/app/views/messages/_form.html.erb b/app/views/messages/_form.html.erb index d906efea9..2cfeea80e 100644 --- a/app/views/messages/_form.html.erb +++ b/app/views/messages/_form.html.erb @@ -42,6 +42,7 @@<%= label_tag "message_content", l(:description_message_content), :class => "hidden-for-sighted" %> <%= f.text_area :content, :cols => 80, :rows => 13, :class => 'wiki-edit', :id => 'message_content', :onblur => "regexContent();" %> +