From b981c4d07b113e73a3ba83635d3b3d28a6807597 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 17 Jul 2015 17:30:48 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=96=B9=E6=B3=95=E5=88=A4?= =?UTF-8?q?=E6=96=AD=EF=BC=9A=E5=B0=86/n=E8=BD=AC=E8=BF=98=E6=88=90
?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/application_helper.rb | 4 ++++ app/views/student_work/_programing_work_show.html.erb | 2 +- app/views/student_work/_show.html.erb | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 64d8ce142..47a3b59ae 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -2343,4 +2343,8 @@ module ApplicationHelper end end + #将文本内的/n转换为
+ def text_format text + text.gsub("\n","
").html_safe + end end diff --git a/app/views/student_work/_programing_work_show.html.erb b/app/views/student_work/_programing_work_show.html.erb index e73fdb1bb..8060b8a79 100644 --- a/app/views/student_work/_programing_work_show.html.erb +++ b/app/views/student_work/_programing_work_show.html.erb @@ -19,7 +19,7 @@ 编程代码:
- <%= textilizable @work.description%> + <%= text_format @work.description%>
diff --git a/app/views/student_work/_show.html.erb b/app/views/student_work/_show.html.erb index dfe61d3db..2b7d49402 100644 --- a/app/views/student_work/_show.html.erb +++ b/app/views/student_work/_show.html.erb @@ -36,7 +36,7 @@
  • 内容:
    - <%= textilizable @work.description%> + <%= text_format @work.description%>