]> git.openstreetmap.org Git - rails.git/commitdiff
Break long URLs where richtext is used.
authorTobias Jordans <t@tobiasjordans.de>
Sun, 27 Dec 2020 13:19:36 +0000 (14:19 +0100)
committerTobias Jordans <t@tobiasjordans.de>
Sun, 27 Dec 2020 21:11:36 +0000 (22:11 +0100)
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
app/views/diary_entries/_diary_comment.html.erb
app/views/diary_entries/_diary_entry.html.erb
app/views/diary_entries/comments.html.erb
app/views/messages/show.html.erb
app/views/redactions/show.html.erb
app/views/shared/_richtext_field.html.erb
app/views/user_blocks/show.html.erb
app/views/users/_user.html.erb
app/views/users/show.html.erb

index 2c8b00c17460504ddb49319b6506992a25e2be20..db8b51f5cd9e7f7d30b904bf3cd227913c128113 100644 (file)
@@ -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
index 9a3ff969dfecbd64fc0e0c987fd12352f22633f5..a7cdf21d7321d2215dc8caa915d8cd884c437e54 100644 (file)
@@ -6,7 +6,7 @@
     <% end %>
   </p>
 
-  <div class="richtext"><%= diary_comment.body.to_html %></div>
+  <div class="richtext text-break"><%= diary_comment.body.to_html %></div>
   <% if can? :hidecomment, DiaryEntry %>
     <span>
       <% if diary_comment.visible? %>
index 6616417a19e31cb8d654ea23074617fc31e01c66..946c6ce1742efb2259802f0d1d82b8e8453d78ab 100644 (file)
@@ -15,7 +15,7 @@
 
   </div>
 
-  <div class="richtext" xml:lang="<%= diary_entry.language_code %>" lang="<%= diary_entry.language_code %>">
+  <div class="richtext text-break" xml:lang="<%= diary_entry.language_code %>" lang="<%= diary_entry.language_code %>">
     <%= diary_entry.body.to_html %>
   </div>
 
index ec8c3dfda8e7535ac419171d0910171bd96abd51..67036050d635df409cc3c9ea00383ff706a4b245 100644 (file)
@@ -14,7 +14,7 @@
   <tr class="<%= "deemphasize" unless comment.visible? %>">
     <td width="25%"><%= link_to comment.diary_entry.title, diary_entry_path(comment.diary_entry.user, comment.diary_entry) %></td>
     <td width="25%"><span title="<%= l comment.created_at, :format => :friendly %>"><%= time_ago_in_words(comment.created_at, :scope => :'datetime.distance_in_words_ago') %></span></td>
-    <td width="50%" class="richtext"><%= comment.body.to_html %></td>
+    <td width="50%" class="richtext text-break"><%= comment.body.to_html %></td>
   </tr>
   <% end -%>
 </table>
index 080503f72fce70fc769ed6eba41744ee5f7c3a9b..3631467fd249277fa9c43af99c41ab53cd7826f7 100644 (file)
@@ -32,7 +32,7 @@
     </div>
   </div>
 
-  <div class="richtext"><%= @message.body.to_html %></div>
+  <div class="richtext text-break"><%= @message.body.to_html %></div>
 
   <div>
     <%= link_to t(".back"), outbox_messages_path, :class => "btn btn-link" %>
index 1eb20f16f1564ce0350d51bb5f3d802a0822d72e..cf5116edebe36aca4ef3d923454804f3d4af4099 100644 (file)
@@ -7,7 +7,7 @@
   <b><%= t ".user" %></b>
   <%= link_to(@redaction.user.display_name, user_path(@redaction.user)) %>
 </p>
-<div class="richtext">
+<div class="richtext text-break">
   <b><%= t ".description" %></b>
   <%= @redaction.description.to_html %>
 </div>
index eef982342181a7a607930e96ad08ab3cf5010600..96b90c4adb0b571ce594f6faf647d21af93c81e6 100644 (file)
@@ -3,7 +3,7 @@
   <div id="<%= id %>_container" class="form-row richtext_container">
     <div id="<%= id %>_content" class="col-sm-8 mb-3 richtext_content">
       <%= builder.text_area(attribute, options.merge(:wrapper => false, "data-preview-url" => preview_url(:type => type))) %>
-      <div id="<%= id %>_preview" class="richtext_preview richtext"></div>
+      <div id="<%= id %>_preview" class="richtext_preview richtext text-break"></div>
     </div>
     <div id="<%= id %>_help" class="col-sm-4 richtext_help">
       <div class="card bg-light">
index 69207d4e47e453a2ad08db84302b35d306475c45..52c099ee40318654f27bfc188bace36aad21dc42 100644 (file)
@@ -33,4 +33,4 @@
 <p><b><%= t ".status" %></b>: <%= block_status(@user_block) %></p>
 
 <p><b><%= t ".reason" %></b></p>
-<div class="richtext"><%= @user_block.reason.to_html %></div>
+<div class="richtext text-break"><%= @user_block.reason.to_html %></div>
index 399ef8dcd89843d0c7603152b6b8ec99a5b95947..f01f8d1edce3d26bbe959e614df08df18d37639e 100644 (file)
@@ -15,7 +15,7 @@
               :date => l(user.creation_time, :format => :friendly) %>
       <% end %>
     </p>
-    <div class="richtext"><%= user.description.to_html %></div>
+    <div class="richtext text-break"><%= user.description.to_html %></div>
   </td>
   <td>
     <%= check_box_tag "user_#{user.id}", "", false, :name => "user[#{user.id}]" %>
index 694f561b28aaa4d4e6bea4382206a994bcc5ee1e..302ec5bd3935db3d9a65dd8dd3beb39a02fa8e68 100644 (file)
       </p>
     </div>
 
-    <div class="user-description richtext"><%= @user.description.to_html %></div>
+    <div class="user-description richtext text-break"><%= @user.description.to_html %></div>
 
   </div>