From 76f31bd6b56220b5cb5eade525326dcff3ec7a0e Mon Sep 17 00:00:00 2001 From: Toks Date: Thu, 31 Jul 2014 21:19:43 -0400 Subject: [PATCH] Bulk reqs: add line breaks Scripts longer than 1 line are completely unreadable without line breaks --- app/helpers/bulk_update_requests_helper.rb | 4 ++++ app/views/bulk_update_requests/index.html.erb | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/helpers/bulk_update_requests_helper.rb b/app/helpers/bulk_update_requests_helper.rb index c84b6163a..3c19f847f 100644 --- a/app/helpers/bulk_update_requests_helper.rb +++ b/app/helpers/bulk_update_requests_helper.rb @@ -1,2 +1,6 @@ module BulkUpdateRequestsHelper + def script_with_line_breaks(script) + escaped_script = script.gsub(/&/, "&").gsub(//, ">") + escaped_script.gsub(/\n/m, "
").html_safe + end end diff --git a/app/views/bulk_update_requests/index.html.erb b/app/views/bulk_update_requests/index.html.erb index 7e138678b..a8ecfe89d 100644 --- a/app/views/bulk_update_requests/index.html.erb +++ b/app/views/bulk_update_requests/index.html.erb @@ -17,7 +17,7 @@ <%= link_to_user(request.user) %> <%= link_to(request.forum_topic_id, forum_topic_path(request.forum_topic_id)) %> - <%= request.script %> + <%= script_with_line_breaks(request.script) %> <%= request.status %> <% if CurrentUser.is_moderator? && request.status == "pending" %>