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;}