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%>