diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index c8a3bca0c..6e0f70313 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -3237,6 +3237,7 @@ def strip_html(text,len=0,endss="...") ss = "" if text.length>0 ss=text.gsub(/<\/?.*?>/, '').strip + ss = ss.gsub(/ /, ' ') if len > 0 && ss.length > len ss = ss[0, len] + endss diff --git a/app/models/journal.rb b/app/models/journal.rb index 02086fa62..eeaa17dd6 100644 --- a/app/models/journal.rb +++ b/app/models/journal.rb @@ -239,8 +239,10 @@ class Journal < ActiveRecord::Base #缺陷回复微信模板消息 def issue_wechat_message - ws = WechatService.new - content = strip_html self.notes.html_safe, 200 - ws.comment_template self.issue.author_id, "issues", self.journalized_id, "#{l(:label_issue_comment_template)}", self.user.try(:realname), format_time(self.created_on), content + if !self.notes.nil? && self.notes.gsub(' ','') != '' + ws = WechatService.new + content = strip_html self.notes.html_safe, 200 + ws.comment_template self.issue.author_id, "issues", self.journalized_id, "#{l(:label_issue_comment_template)}", self.user.try(:realname), format_time(self.created_on), content + end end end diff --git a/app/models/journals_for_message.rb b/app/models/journals_for_message.rb index 68b747ab9..d0113744c 100644 --- a/app/models/journals_for_message.rb +++ b/app/models/journals_for_message.rb @@ -259,19 +259,26 @@ class JournalsForMessage < ActiveRecord::Base if self.m_parent_id.nil? if self.user_id != self.jour.user_id self.course_messages << CourseMessage.new(:user_id => self.jour.user_id,:course_id => self.jour.course.id, :viewed => false) + count = ShieldWechatMessage.where("container_type='User' and container_id=#{self.jour.user_id} and shield_type='Course' and shield_id=#{self.jour.course_id}").count + if count == 0 + ws = WechatService.new + #content = truncate(strip_tags(self.notes.to_s), length: 200) + content = strip_html self.notes.html_safe, 200 + ws.comment_template self.jour.user_id, "homework", self.jour_id, "#{l(:label_homework_comment_template)}", self.user.try(:realname), format_time(self.created_on), content + end end else if self.user_id != self.parent.user_id self.course_messages << CourseMessage.new(:user_id => self.parent.user_id,:course_id => self.jour.course.id, :viewed => false) + count = ShieldWechatMessage.where("container_type='User' and container_id=#{self.parent.user_id} and shield_type='Course' and shield_id=#{self.jour.course_id}").count + if count == 0 + ws = WechatService.new + #content = truncate(strip_tags(self.notes.to_s), length: 200) + content = strip_html self.notes.html_safe, 200 + ws.comment_template self.parent.user_id, "homework", self.jour_id, "#{l(:label_new_second_comment_template)}", self.user.try(:realname), format_time(self.created_on), content + end end end - count = ShieldWechatMessage.where("container_type='User' and container_id=#{self.jour.user_id} and shield_type='Course' and shield_id=#{self.jour.course_id}").count - if count == 0 - ws = WechatService.new - #content = truncate(strip_tags(self.notes.to_s), length: 200) - content = strip_html self.notes.html_safe, 200 - ws.comment_template self.jour.user_id, "homework", self.jour_id, "#{l(:label_homework_comment_template)}", self.user.try(:realname), format_time(self.created_on), content - end end end diff --git a/app/views/blog_comments/show.html.erb b/app/views/blog_comments/show.html.erb index de7f1647d..d3763abf3 100644 --- a/app/views/blog_comments/show.html.erb +++ b/app/views/blog_comments/show.html.erb @@ -141,6 +141,7 @@
@@ -215,5 +216,6 @@ var postContent = $("#message_description_<%= @article.id %>").html(); postContent = postContent.replace(/ /g," "); $("#message_description_<%= @article.id %>").html(postContent); + autoUrl('message_description_<%= @article.id %>'); }); diff --git a/app/views/courses/syllabus.html.erb b/app/views/courses/syllabus.html.erb index 8be245958..66bc8ff9a 100644 --- a/app/views/courses/syllabus.html.erb +++ b/app/views/courses/syllabus.html.erb @@ -120,6 +120,7 @@
@@ -214,5 +215,6 @@ postContent=postContent.replace(/  /g,"   "); $(this).html(postContent); }); + autoUrl('message_description_<%= @article.id %>'); }); \ No newline at end of file diff --git a/app/views/exercise/_student_exercise.html.erb b/app/views/exercise/_student_exercise.html.erb index d7a1b85bb..f9fd114dd 100644 --- a/app/views/exercise/_student_exercise.html.erb +++ b/app/views/exercise/_student_exercise.html.erb @@ -22,60 +22,6 @@
- <%= render :partial => "student_table"%> + <%= render :partial => "student_table" %>
-
- -<% @exercise_users_list.each do |exercise|%> - - - -
-<% end%> \ No newline at end of file +
\ No newline at end of file diff --git a/app/views/exercise/_student_exercise_archive.html.erb b/app/views/exercise/_student_exercise_archive.html.erb new file mode 100644 index 000000000..abc604b73 --- /dev/null +++ b/app/views/exercise/_student_exercise_archive.html.erb @@ -0,0 +1,81 @@ +
+ + 测验 + + (<%= @exercise_count%>人已交) + + <% if !@is_teacher && @exercise_users_list.empty?%> + 您尚未提交 + <% elsif !@is_teacher && !@exercise_users_list.empty?%> + 您已提交 + <% end %> + + <%#if @is_teacher || @exercise.exercise_status == 3%> + + <%#= select_tag(:student_work_in_group,options_for_select(course_group_list(@course),@group), {:class => "classSplit"}) unless course_group_list(@course).empty? %> + <%# end%> + +
+
+ +
+ <%= render :partial => "student_table"%> +
+
+ +<% @exercise_users_list.each do |exercise|%> + + + +
+<% end%> \ No newline at end of file diff --git a/app/views/exercise/_student_table.html.erb b/app/views/exercise/_student_table.html.erb index 8957c5048..5a93c352a 100644 --- a/app/views/exercise/_student_table.html.erb +++ b/app/views/exercise/_student_table.html.erb @@ -1,23 +1,71 @@ - + + 点击查看详情 + <% user = User.find(reply.creator_id) %> @@ -164,6 +165,7 @@ postContent=postContent.replace(/  /g,"   "); $(this).html(postContent); }); + autoUrl('intro_content_<%= @document.id %>'); var replyCount = $(".homepagePostReplyContainer").size(); if (replyCount >3){ for(var i= 3; i < replyCount+1; i++){ diff --git a/app/views/users/_course_homework.html.erb b/app/views/users/_course_homework.html.erb index fe586b28c..3721244ed 100644 --- a/app/views/users/_course_homework.html.erb +++ b/app/views/users/_course_homework.html.erb @@ -321,6 +321,7 @@ <% replies_all_i = replies_all_i + 1 %> diff --git a/app/views/users/_course_journalsformessage.html.erb b/app/views/users/_course_journalsformessage.html.erb index 05e0a67b0..aeb7f5e5d 100644 --- a/app/views/users/_course_journalsformessage.html.erb +++ b/app/views/users/_course_journalsformessage.html.erb @@ -56,6 +56,7 @@ <% replies_all_i = replies_all_i + 1 %> diff --git a/app/views/users/_course_message.html.erb b/app/views/users/_course_message.html.erb index aa2781b95..8b6056309 100644 --- a/app/views/users/_course_message.html.erb +++ b/app/views/users/_course_message.html.erb @@ -117,6 +117,7 @@ <% replies_all_i=replies_all_i+1 %> @@ -179,4 +180,4 @@ $(function(){ user_card_show_hide(); }); - + diff --git a/app/views/users/_course_news.html.erb b/app/views/users/_course_news.html.erb index 3e4bda9f3..19d62b14e 100644 --- a/app/views/users/_course_news.html.erb +++ b/app/views/users/_course_news.html.erb @@ -94,6 +94,7 @@ <% replies_all_i = replies_all_i + 1 %> diff --git a/app/views/users/_intro_content.html.erb b/app/views/users/_intro_content.html.erb index 351f1fdb0..04babe100 100644 --- a/app/views/users/_intro_content.html.erb +++ b/app/views/users/_intro_content.html.erb @@ -1,6 +1,6 @@
- <%= content.to_s.html_safe%> + <%= content.to_s.html_safe %>
\ No newline at end of file diff --git a/app/views/users/_project_issue_reply.html.erb b/app/views/users/_project_issue_reply.html.erb index 671cbeab9..5323b76b6 100644 --- a/app/views/users/_project_issue_reply.html.erb +++ b/app/views/users/_project_issue_reply.html.erb @@ -29,6 +29,7 @@ <% replies_all_i=replies_all_i + 1 %> diff --git a/app/views/users/_project_message.html.erb b/app/views/users/_project_message.html.erb index 468ce3a88..b6e3f9a94 100644 --- a/app/views/users/_project_message.html.erb +++ b/app/views/users/_project_message.html.erb @@ -112,6 +112,7 @@ <% replies_all_i=replies_all_i+1 %> diff --git a/app/views/users/_project_news.html.erb b/app/views/users/_project_news.html.erb index 681493c44..55e2182b5 100644 --- a/app/views/users/_project_news.html.erb +++ b/app/views/users/_project_news.html.erb @@ -91,6 +91,7 @@ <% replies_all_i = replies_all_i + 1 %> diff --git a/app/views/users/_user_blog.html.erb b/app/views/users/_user_blog.html.erb index 904d573bb..de5ffc31f 100644 --- a/app/views/users/_user_blog.html.erb +++ b/app/views/users/_user_blog.html.erb @@ -75,6 +75,7 @@ <% replies_all_i = replies_all_i + 1 %> diff --git a/app/views/users/_user_homework_detail.html.erb b/app/views/users/_user_homework_detail.html.erb index e561c6363..f81fbabf5 100644 --- a/app/views/users/_user_homework_detail.html.erb +++ b/app/views/users/_user_homework_detail.html.erb @@ -331,6 +331,7 @@ <% replies_all_i = replies_all_i + 1 %> diff --git a/app/views/users/_user_journalsformessage.html.erb b/app/views/users/_user_journalsformessage.html.erb index 944477e88..d39cccb11 100644 --- a/app/views/users/_user_journalsformessage.html.erb +++ b/app/views/users/_user_journalsformessage.html.erb @@ -86,6 +86,12 @@
    <% fetch_user_leaveWord_reply(activity).reorder("created_on desc").each do |comment| %> + <% replies_all_i = replies_all_i + 1 %>
  • diff --git a/app/views/users/_user_message_course.html.erb b/app/views/users/_user_message_course.html.erb index 40c4bd408..60d5b6ed8 100644 --- a/app/views/users/_user_message_course.html.erb +++ b/app/views/users/_user_message_course.html.erb @@ -407,9 +407,9 @@
  • <%= link_to ma.course_message.user, user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %> "> <% if ma.course_message.m_parent_id.nil? %> - 回复了您的作业: + 回复了您的作业: <% else %> - 回复了您: + 在作业中回复了您: <% end %>
  • diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 18f027dce..a347359bb 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -2137,6 +2137,7 @@ zh: label_notice_comment_template: 您的课程通知有新回复了 label_news_comment_template: 您的项目新闻有新回复了 label_homework_comment_template: 您的作业有新回复了 + label_new_second_comment_template: 您有新回复了 label_new_journals_template: 您有新留言了 label_journals_comment_template: 您的留言有新回复了 label_blog_comment_template: 您的博客有新回复了 diff --git a/public/javascripts/application.js b/public/javascripts/application.js index 24bf3e2cb..3828b981b 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -1317,3 +1317,54 @@ function pop_up_box(value,tWidth,tTop,tLeft){ } +//yk 自动识别URL 并加上链接 +//var strRegex = '((https?|ftp|news):\/\/)?([a-z]([a-z0-9\-]*[\.。])+([a-z]{3}|aero|arpa|biz|com|coop|edu|gov|info|int|jobs|mil|museum|name|nato|net|org|pro|travel)|(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]))(\/[a-z0-9_\-\.~]+)*(\/([a-z0-9_\-\.]*)(\?[a-z0-9+_\-\.%=&]*)?)?(#[a-z][a-z0-9_]*)?'; + +function autoUrl(id){ + if ($("#"+id).children().length > 0 ){ + $("#"+id+" p,#"+ id +" span,#"+id+" em,#"+id+" h1,#"+id+" h2,#"+id+" h3,#"+id+" h4,#"+id+" strong,#"+id+" b,#"+id+" font,#"+id+" i").each(function(){ + if ($(this).children().length == 0){ + var html = $(this).text(); //.replace(/(^\s*)|(\s*$)/g, "") + console.log("html="+html); +// var re=new RegExp(strRegex,"g"); + html = html.replace(/((https?|ftp|news):\/\/)?([a-z]([a-z0-9\-]*[\.。])+([a-z]{3}|aero|arpa|biz|com|coop|edu|gov|info|int|jobs|mil|museum|name|nato|net|org|pro|travel)|(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]))(\/[a-z0-9_\-\.~]+)*(\/([a-z0-9_\-\.]*)(\?[a-z0-9+_\-\.%=&]*)?)?(#[a-z][a-z0-9_]*)?/g,function(full) { + //没有://的都加上http:// + var reStr = full; + if (full.length > 0){ + if (full.indexOf("://") >= 0){ + reStr = ""+full+""; + } + else{ + reStr = ""+full+""; + } + console.log("reStr="+reStr); + } + return reStr ; + }); + $(this).html(html); + } + }); + } + else{ + var html = $("#"+id).text(); //.replace(/(^\s*)|(\s*$)/g, "") + console.log("!!!!html="+html); +// var re=new RegExp(strRegex,"g"); + html = html.replace(/((https?|ftp|news):\/\/)?([a-z]([a-z0-9\-]*[\.。])+([a-z]{3}|aero|arpa|biz|com|coop|edu|gov|info|int|jobs|mil|museum|name|nato|net|org|pro|travel)|(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]))(\/[a-z0-9_\-\.~]+)*(\/([a-z0-9_\-\.]*)(\?[a-z0-9+_\-\.%=&]*)?)?(#[a-z][a-z0-9_]*)?/g,function(full) { + //没有://的都加上http:// + var reStr = full; + if (full.length > 0){ + if (full.indexOf("://") >= 0){ + reStr = ""+full+""; + } + else{ + reStr = ""+full+""; + } + console.log("reStr="+reStr); + } + return reStr ; + }); + $("#"+id).html(html); + } +} + + diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css index f8d3e1deb..08981ae54 100644 --- a/public/stylesheets/courses.css +++ b/public/stylesheets/courses.css @@ -101,6 +101,10 @@ a.hworkSearchIcon:hover {background:url(../images/nav_icon.png) -49px -1px no-re .mt16{margin-top: 16px;} .pr10{padding-right: 10px;} +/*20160520作品列表table*/ +.hwork-table-wrap {width:720px; border-collapse:collapse; vertical-align:middle;} +.hwork-table-wrap th {font-size:14px; color:#2d2d2d;} + /*作业信息*/ .mt-2 {margin-top:-2px;} .homeworkInfo {background:#F6F6F6; padding:10px; margin-bottom:10px;} diff --git a/public/stylesheets/new_user.css b/public/stylesheets/new_user.css index f79b3ca02..d7b56a8aa 100644 --- a/public/stylesheets/new_user.css +++ b/public/stylesheets/new_user.css @@ -672,6 +672,7 @@ a.postTypeGrey:hover {color:#269ac9;} .homepagePostDes {float:left; width:655px; margin-left:15px; overflow:hidden;} .homepagePostTo {font-size:14px; color:#484848; margin-bottom:5px;} .homepagePostTitle {font-size:14px; color:#484848; margin-bottom:5px; font-weight:bold;} +.homepagePostTitle td,.homepagePostTitle tr {border: 1px solid; border-color: inherit;} .homepagePostSubmitContainer {height:25px; margin-top: 8px; margin-bottom: 5px;} .homepagePostSubmit {font-size:14px; color:#888888; border:1px solid #dddddd; background-color:#eaeaea; float:left; margin-right:20px; padding:0px 10px;} .homepagePostSubmit:hover {background-color:#d8d8d8;} @@ -681,10 +682,9 @@ a.postTypeGrey:hover {color:#269ac9;} .homepagePostReply {width:720px; margin:0px auto; background-color:#f1f1f1; margin-top:10px;} .homepagePostIntro ol li{list-style-type: decimal;margin-left: 40px;} .homepagePostIntro ul li{list-style-type: disc;margin-left: 40px;} +.homepagePostIntro td,.homepagePostIntro tr {border: 1px solid; border-color: inherit;} .homepagePostReplyBanner {width:718px; height:33px; border:1px solid #e4e4e4; line-height:33px; vertical-align:middle; font-size:12px; color:#888888; position: relative;} - .borderBottomNone {border-bottom:none !important;} -.homepagePostIntro td,.homepagePostIntro tr {border: 1px solid; border-color: inherit;} .homepagePostReplyBanner {width:718px; height:33px; border:1px solid #e4e4e4; line-height:33px; vertical-align:middle; font-size:12px; color:#888888;} .borderBottomNone {border-bottom:none !important;} .topBorder {border-top: 1px solid #e4e4e4;} @@ -721,6 +721,7 @@ a.postOptionLink:hover {color:#ffffff; background-color:#269ac9;} .homepagePostReplyContent {font-size:12px; color:#484848; margin:3px 5px 12px 5px;font: 14px/1.5 "sans serif",tahoma,verdana,helvetica;font-family:"微软雅黑","宋体";} .homepagePostReplyContent ol li{list-style-type: decimal;margin-left: 40px;} .homepagePostReplyContent ul li{list-style-type: disc;margin-left: 40px;} +.homepagePostReplyContent td,.homepagePostReplyContent tr {border: 1px solid; border-color: inherit;} .table_maxWidth table {max-width: 642px;} .homepagePostProjectState {width:52px; height:20px; line-height:20px; border-radius:1px; background-color:#28be6c; color:#ffffff; text-align:center; vertical-align:middle; font-size:12px; display:inline-block; margin-left:5px;} .homepagePostAssignTo {float:left; font-size:14px; color:#269ac9;} @@ -864,7 +865,7 @@ a.sortArrowActiveU {background:url(images/post_image_list.png) -17px -20px no-re .postDetailDes p,div,em{word-break: break-all;word-wrap: break-word;} .postDetailDes ol li{list-style-type: decimal;margin-left: 40px;} .postDetailDes ul li{list-style-type: disc;margin-left: 40px;} -.postDetailDes td,.homepagePostReplyContent tr {border: 1px solid; border-color: inherit;} +.postDetailDes td,.postDetailDes tr {border: 1px solid; border-color: inherit;} .homepagePostIntro p,.homepagePostIntro div,.homepagePostIntro em, .homepagePostIntro span{text-align: justify; text-justify:inter-ideograph; word-break: normal !important; word-wrap: break-word !important; } /*line-height: 18px !important;*/ .postDetailCreater {color:#888888; font-size:12px; float:left; margin-right:25px;} .postDetailDate {color:#888888; font-size:12px; float:left;} @@ -1456,7 +1457,7 @@ span.at a{color:#269ac9;text-decoration: none;} .pic_edit2:hover{display:inline-block; background:url(../images/public_icon.png) -32px -32px no-repeat; width:20px; height:15px;} .w70{ width:70px;} .w80{ width:80px;} -.label03{ width:70px; text-align:right; display:block; float:left;} +.label03{ width:70px; text-align:right; display:block; float:left;white-space: nowrap;} .pro_info_p{color:#0781b4 !important; float:left; width:80px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis; } .proInfoP{color:#000000 !important; float:left; width:80px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis; } diff --git a/public/stylesheets/project.css b/public/stylesheets/project.css index 927be4cc3..09f7075f7 100644 --- a/public/stylesheets/project.css +++ b/public/stylesheets/project.css @@ -470,7 +470,7 @@ a:hover.st_add{ color:#ff8e15;} .newpro_box select{ height:29px; float:left; margin-bottom:10px;} /*.label{ width:80px; text-align:right; font-size:14 background-image: url(../images/true.png); }*/ .label02{ width:110px; text-align:right; font-size:14px; display:block; float:left;} -.label03{ width:70px; text-align:right; display:block; float:left;} +.label03{ width:70px; text-align:right; display:block; float:left;white-space: nowrap;} .collapsible{ border-left:none;border-right:none;border-bottom:none; border-top:1px solid #e4e4e4; padding-top:10px; } .icon-reload { background-image: url(../images/reload.png); } .icon { @@ -1240,4 +1240,4 @@ a.pages-big{ width:50px;} .pages{width:330px; margin:20px auto 10px;} .red-cir-btn{ background:#e74c3c; padding:1px 5px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal;font-size:12px;} -.green-cir-btn{ background:#28be6c; padding:1px 5px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal;font-size:12px;} +.green-cir-btn{ background:#28be6c; padding:1px 5px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal;font-size:12px;} diff --git a/public/stylesheets/public.css b/public/stylesheets/public.css index fb48d9b77..9cf857597 100644 --- a/public/stylesheets/public.css +++ b/public/stylesheets/public.css @@ -48,6 +48,7 @@ h4{ font-size:14px; color:#3b3b3b;} .fr{float:right;display:inline;} .f_l{ float:left;} .f_r{ float:right;} +.float-none {float:none !important;} .clearfix:after{clear:both;content:".";display:block;font-size:0;height:0;line-height:0;visibility:hidden} .clearfix{clear:both;zoom:1} .break_word{ word-break:break-all; word-wrap: break-word;} @@ -136,6 +137,8 @@ h4{ font-size:14px; color:#3b3b3b;} .pl10 {padding-left:10px;} .pl15{ padding-left:15px;} .pl5{ padding-left:5px;} +.pr5 {padding-right:5px;} +.pr10 {padding-right:10px;} .pt5{ padding-top:5px;} .pt10{ padding-top:10px;} .pb5{ padding-bottom: 5px;}