From 7bcb1cbe2e276e445f036a713423c0683b8492c8 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 10 Jul 2014 16:57:04 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=AA=E4=BA=BA=E4=B8=BB?= =?UTF-8?q?=E9=A1=B5=E4=B8=AD=E4=BD=9C=E4=B8=9A=E3=80=81=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E4=BB=8B=E7=BB=8D=E4=B8=8D=E6=AD=A3=E7=A1=AE=E7=9A=84BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/open_source_project.rb | 3 ++- app/models/project.rb | 3 ++- app/views/users/_course_form.html.erb | 2 +- app/views/users/user_projects.html.erb | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/models/open_source_project.rb b/app/models/open_source_project.rb index e3556ce55..2de5966bb 100644 --- a/app/models/open_source_project.rb +++ b/app/models/open_source_project.rb @@ -84,7 +84,8 @@ class OpenSourceProject < ActiveRecord::Base # end def short_description(length = 255) - description.gsub(/^(.{#{length}}[^\n\r]*).*$/m, '\1...').strip if description + #description.gsub(/^(.{#{length}}[^\n\r]*).*$/m, '\1...').strip if description + description.gsub(/<\/?.*?>/,"").html_safe if description end def applied_by?(user) diff --git a/app/models/project.rb b/app/models/project.rb index 5efaf10ab..4bd1f2774 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -623,7 +623,8 @@ class Project < ActiveRecord::Base # Returns a short description of the projects (first lines) def short_description(length = 255) - description.gsub(/^(.{#{length}}[^\n\r]*).*$/m, '\1...').strip if description + #description.gsub(/^(.{#{length}}[^\n\r]*).*$/m, '\1...').strip if description + description.gsub(/<\/?.*?>/,"").html_safe if description end def css_classes diff --git a/app/views/users/_course_form.html.erb b/app/views/users/_course_form.html.erb index f5cada9a8..4d9c58392 100644 --- a/app/views/users/_course_form.html.erb +++ b/app/views/users/_course_form.html.erb @@ -32,7 +32,7 @@

- <%= membership.course.description %> + <%= membership.course.short_description %>

diff --git a/app/views/users/user_projects.html.erb b/app/views/users/user_projects.html.erb index e16700cd1..66ddcaae2 100644 --- a/app/views/users/user_projects.html.erb +++ b/app/views/users/user_projects.html.erb @@ -30,7 +30,7 @@

- <%= membership.project.description%> + <%= membership.project.short_description%>