From c68349803e108b2a100bdf831ee65004d746d457 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 27 Mar 2015 13:42:15 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E8=AF=BE=E7=A8=8B=E8=AE=A8=E8=AE=BA?= =?UTF-8?q?=E5=8C=BA=E3=80=81=E9=80=9A=E7=9F=A5=E6=8F=90=E7=A4=BA=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E6=A0=B7=E5=BC=8F=202=E3=80=81=E6=95=B4=E7=90=86js?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/messages/_form_course.html.erb | 44 +---------- app/views/news/_course_form.html.erb | 61 +-------------- public/javascripts/course.js | 97 ++++++++++++++++++++++++ public/stylesheets/public.css | 1 + 4 files changed, 102 insertions(+), 101 deletions(-) diff --git a/app/views/messages/_form_course.html.erb b/app/views/messages/_form_course.html.erb index cc788004c..7b5d47c71 100644 --- a/app/views/messages/_form_course.html.erb +++ b/app/views/messages/_form_course.html.erb @@ -1,43 +1,3 @@ - <%= error_messages_for 'message' %> <% replying ||= false %> <% extra_option = replying ? { readonly: true} : { maxlength: 200 } %> @@ -49,7 +9,7 @@ <% else %> <%= f.text_field :subject, { size: 60, id: "message_subject", onkeyup: "regexSubject();",:class=>"talk_input w585" }.merge(extra_option) %> <% end %> - +
  • <% unless replying %> @@ -70,7 +30,7 @@ <%= text_area :quote,:quote,:style => 'display:none' %> <%= f.text_area :content, :class => 'talk_text fl', :id => 'message_content', :onkeyup => "regexContent();", :maxlength => 5000,:placeholder => "最多3000个汉字(或6000个英文字符)" %>
    - +
  • diff --git a/app/views/news/_course_form.html.erb b/app/views/news/_course_form.html.erb index 4b2792627..4f67c0ce6 100644 --- a/app/views/news/_course_form.html.erb +++ b/app/views/news/_course_form.html.erb @@ -1,69 +1,12 @@ -
  • - +
  • - +
  • diff --git a/public/javascripts/course.js b/public/javascripts/course.js index bb4127f9a..e49ecd828 100644 --- a/public/javascripts/course.js +++ b/public/javascripts/course.js @@ -99,7 +99,104 @@ 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'); + return false; + } + else + { + $("#subject_span").text("填写正确"); + $("#subject_span").css('color','#008000'); + return true; + } + return false; +} +function regexContent() +{ + var content = $.trim($("#message_content").val()); + if(content.length ==0) + { + $("#message_content_span").text("描述不能为空"); + $("#message_content_span").css('color','#ff0000'); + return false; + } + else + { + $("#message_content_span").text("填写正确"); + $("#message_content_span").css('color','#008000'); + return true; + } + return false; +} +function submitCoursesBoard() +{ + if(regexSubject()&®exContent()){$("#message-form").submit();} +} +/////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////// 课程通知 +function regexTitle() +{ + var name = $("#news_title").val(); + if(name.length ==0) + { + $("#title_notice_span").text("标题不能为空"); + $("#title_notice_span").css('color','#ff0000'); + $("#title_notice_span").focus(); + return false; + } + else if(name.length <= 60) + { + $("#title_notice_span").text("填写正确"); + $("#title_notice_span").css('color','#008000'); + return true; + } + else + { + $("#title_notice_span").text("标题超过60个字符"); + $("#title_notice_span").css('color','#ff0000'); + $("#title_notice_span").focus(); + return false; + } +} +function regexDescription() +{ + var name = $("#news_description").val(); + if(name.length ==0) + { + $("#description_notice_span").text("描述不能为空"); + $("#description_notice_span").css('color','#ff0000'); + $("#description_notice_span").focus(); + return false; + } + else + { + $("#description_notice_span").text("填写正确"); + $("#description_notice_span").css('color','#008000'); + return true; + } +} + +function submitNews() +{ + if(regexTitle() && regexDescription()) + { + $("#news-form").submit(); + } +} + +function submitFocus(obj) +{ + $(obj).focus(); +} +/////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////// //验证搜索时输入名字 function regexName(content) { diff --git a/public/stylesheets/public.css b/public/stylesheets/public.css index f45f49112..17b193a44 100644 --- a/public/stylesheets/public.css +++ b/public/stylesheets/public.css @@ -22,6 +22,7 @@ a:hover,a:active{color:#000;} .ml15{ margin-left:15px;} .ml20{ margin-left:20px;} .ml45{ margin-left:45px;} +.ml55{ margin-left:55px;} .ml30{ margin-left:30px;} .ml60{ margin-left:60px;} .ml80{ margin-left:80px;}