From b470e01f840d1b954326f8f863e185ebe7f9b9f2 Mon Sep 17 00:00:00 2001 From: Tobias Jordans Date: Sun, 27 Dec 2020 14:19:36 +0100 Subject: [PATCH] Break long URLs where richtext is used. For example on the blog post show page. This uses https://getbootstrap.com/docs/4.4/utilities/text/#word-break to break long URLs on the blog post show view. --- app/helpers/application_helper.rb | 2 +- app/views/diary_entries/_diary_comment.html.erb | 2 +- app/views/diary_entries/_diary_entry.html.erb | 2 +- app/views/diary_entries/comments.html.erb | 2 +- app/views/messages/show.html.erb | 2 +- app/views/redactions/show.html.erb | 2 +- app/views/shared/_richtext_field.html.erb | 2 +- app/views/user_blocks/show.html.erb | 2 +- app/views/users/_user.html.erb | 2 +- app/views/users/show.html.erb | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 2c8b00c17..db8b51f5c 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -24,7 +24,7 @@ module ApplicationHelper tag.div(:id => "#{id}_container", :class => "richtext_container") do output_buffer << tag.div(:id => "#{id}_content", :class => "richtext_content") do output_buffer << text_area(object_name, method, options.merge("data-preview-url" => preview_url(:type => type))) - output_buffer << tag.div("", :id => "#{id}_preview", :class => "richtext_preview richtext") + output_buffer << tag.div("", :id => "#{id}_preview", :class => "richtext_preview richtext text-break") end output_buffer << tag.div(:id => "#{id}_help", :class => "richtext_help") do diff --git a/app/views/diary_entries/_diary_comment.html.erb b/app/views/diary_entries/_diary_comment.html.erb index 9a3ff969d..a7cdf21d7 100644 --- a/app/views/diary_entries/_diary_comment.html.erb +++ b/app/views/diary_entries/_diary_comment.html.erb @@ -6,7 +6,7 @@ <% end %>

-
<%= diary_comment.body.to_html %>
+
<%= diary_comment.body.to_html %>
<% if can? :hidecomment, DiaryEntry %> <% if diary_comment.visible? %> diff --git a/app/views/diary_entries/_diary_entry.html.erb b/app/views/diary_entries/_diary_entry.html.erb index 6616417a1..946c6ce17 100644 --- a/app/views/diary_entries/_diary_entry.html.erb +++ b/app/views/diary_entries/_diary_entry.html.erb @@ -15,7 +15,7 @@ -
+
<%= diary_entry.body.to_html %>
diff --git a/app/views/diary_entries/comments.html.erb b/app/views/diary_entries/comments.html.erb index ec8c3dfda..67036050d 100644 --- a/app/views/diary_entries/comments.html.erb +++ b/app/views/diary_entries/comments.html.erb @@ -14,7 +14,7 @@ "> <%= link_to comment.diary_entry.title, diary_entry_path(comment.diary_entry.user, comment.diary_entry) %> <%= time_ago_in_words(comment.created_at, :scope => :'datetime.distance_in_words_ago') %> - <%= comment.body.to_html %> + <%= comment.body.to_html %> <% end -%> diff --git a/app/views/messages/show.html.erb b/app/views/messages/show.html.erb index 080503f72..3631467fd 100644 --- a/app/views/messages/show.html.erb +++ b/app/views/messages/show.html.erb @@ -32,7 +32,7 @@
-
<%= @message.body.to_html %>
+
<%= @message.body.to_html %>
<%= link_to t(".back"), outbox_messages_path, :class => "btn btn-link" %> diff --git a/app/views/redactions/show.html.erb b/app/views/redactions/show.html.erb index 1eb20f16f..cf5116ede 100644 --- a/app/views/redactions/show.html.erb +++ b/app/views/redactions/show.html.erb @@ -7,7 +7,7 @@ <%= t ".user" %> <%= link_to(@redaction.user.display_name, user_path(@redaction.user)) %>

-
+
<%= t ".description" %> <%= @redaction.description.to_html %>
diff --git a/app/views/shared/_richtext_field.html.erb b/app/views/shared/_richtext_field.html.erb index eef982342..96b90c4ad 100644 --- a/app/views/shared/_richtext_field.html.erb +++ b/app/views/shared/_richtext_field.html.erb @@ -3,7 +3,7 @@
<%= builder.text_area(attribute, options.merge(:wrapper => false, "data-preview-url" => preview_url(:type => type))) %> -
+
diff --git a/app/views/user_blocks/show.html.erb b/app/views/user_blocks/show.html.erb index 69207d4e4..52c099ee4 100644 --- a/app/views/user_blocks/show.html.erb +++ b/app/views/user_blocks/show.html.erb @@ -33,4 +33,4 @@

<%= t ".status" %>: <%= block_status(@user_block) %>

<%= t ".reason" %>

-
<%= @user_block.reason.to_html %>
+
<%= @user_block.reason.to_html %>
diff --git a/app/views/users/_user.html.erb b/app/views/users/_user.html.erb index 399ef8dcd..f01f8d1ed 100644 --- a/app/views/users/_user.html.erb +++ b/app/views/users/_user.html.erb @@ -15,7 +15,7 @@ :date => l(user.creation_time, :format => :friendly) %> <% end %>

-
<%= user.description.to_html %>
+
<%= user.description.to_html %>
<%= check_box_tag "user_#{user.id}", "", false, :name => "user[#{user.id}]" %> diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index 694f561b2..302ec5bd3 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -163,7 +163,7 @@

-
<%= @user.description.to_html %>
+
<%= @user.description.to_html %>
-- 2.39.5