From 1f7dd79daf44de5f8f8b6c246a269e44bb258175 Mon Sep 17 00:00:00 2001
From: Tom Hughes
Date: Thu, 24 Jan 2013 14:54:26 +0000
Subject: [PATCH] Fix lists in rich text to display properly
Add a "richtext" class to anything which contains text rendered
by our rich text library, and move styles which were only being
applied to diary entries to apply to all rich text.
---
app/assets/stylesheets/common.css.scss | 26 +++++++++++++------
app/helpers/application_helper.rb | 2 +-
app/views/diary_entry/_diary_comment.html.erb | 8 +++---
app/views/diary_entry/_diary_entry.html.erb | 3 ++-
app/views/diary_entry/comments.html.erb | 4 +--
app/views/message/read.html.erb | 6 ++---
app/views/redactions/show.html.erb | 2 +-
app/views/user/_user.html.erb | 2 +-
app/views/user/view.html.erb | 2 +-
app/views/user_blocks/show.html.erb | 2 +-
10 files changed, 34 insertions(+), 23 deletions(-)
diff --git a/app/assets/stylesheets/common.css.scss b/app/assets/stylesheets/common.css.scss
index db14033a5..d516e0b9a 100644
--- a/app/assets/stylesheets/common.css.scss
+++ b/app/assets/stylesheets/common.css.scss
@@ -1133,15 +1133,7 @@ ul.results-list li { border-bottom: 1px solid #ccc; }
}
ul,
ol {
- margin-bottom: 20px;
font-style: italic;
- margin-left: 20px;
- }
- ul li {
- list-style: disc;
- }
- ol li {
- list-style: decimal;
}
ul.secondary-actions { display: inline-block;}
}
@@ -1530,6 +1522,7 @@ a.button.submit {
background-color: #9ed485;
}
}
+
/* Rules for doing distinct colour of alternate table rows */
.table0,
@@ -1549,6 +1542,23 @@ a.button.submit {
border: 0;
}
+/* Rules for rich text */
+
+.richtext {
+ ul,
+ ol {
+ margin-bottom: 20px;
+ margin-left: 20px;
+ }
+ ul li {
+ list-style: disc;
+ }
+
+ ol li {
+ list-style: decimal;
+ }
+}
+
/* Rules for rich text editors */
.richtext_container {
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index f0c0ccbd5..49608c4a0 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -77,7 +77,7 @@ module ApplicationHelper
content_tag(:div, :id => "#{id}_container", :class => "richtext_container") do
output_buffer << content_tag(:div, :id => "#{id}_content", :class => "richtext_content") do
output_buffer << text_area(object_name, method, options.merge("data-preview-url" => preview_url(:format => format)))
- output_buffer << content_tag(:div, "", :id => "#{id}_preview", :class => "richtext_preview")
+ output_buffer << content_tag(:div, "", :id => "#{id}_preview", :class => "richtext_preview richtext")
end
output_buffer << content_tag(:div, :id => "#{id}_help", :class => "richtext_help") do
diff --git a/app/views/diary_entry/_diary_comment.html.erb b/app/views/diary_entry/_diary_comment.html.erb
index ccc1c744f..c7700b361 100644
--- a/app/views/diary_entry/_diary_comment.html.erb
+++ b/app/views/diary_entry/_diary_comment.html.erb
@@ -1,8 +1,8 @@
-
diff --git a/app/views/diary_entry/_diary_entry.html.erb b/app/views/diary_entry/_diary_entry.html.erb
index c17cf05e6..a7d40c792 100644
--- a/app/views/diary_entry/_diary_entry.html.erb
+++ b/app/views/diary_entry/_diary_entry.html.erb
@@ -6,7 +6,8 @@
<%= link_to h(diary_entry.title), :action => 'view', :display_name => diary_entry.user.display_name, :id => diary_entry.id %>
-
+
+
<%= diary_entry.body.to_html %>
diff --git a/app/views/diary_entry/comments.html.erb b/app/views/diary_entry/comments.html.erb
index e486308ea..b55eecf76 100644
--- a/app/views/diary_entry/comments.html.erb
+++ b/app/views/diary_entry/comments.html.erb
@@ -13,7 +13,7 @@
<%= link_to comment.diary_entry.title, :action => :view, :display_name => comment.diary_entry.user.display_name, :id => comment.diary_entry.id %> |
<%= t 'diary_entry.comments.ago', :ago => time_ago_in_words(comment.created_at) %> |
- <%= comment.body.to_html %> |
+ <%= comment.body.to_html %> |
<% end -%>
@@ -21,4 +21,4 @@
- <%= link_to t('diary_entry.comments.older_comments') , { :page => @comment_pages.current.next} if @comment_pages.current.next %>
- <%= link_to t('diary_entry.comments.newer_comments'), { :page => @comment_pages.current.previous } if @comment_pages.current.previous %>
-
\ No newline at end of file
+
diff --git a/app/views/message/read.html.erb b/app/views/message/read.html.erb
index e62873ad4..f3d6ef139 100644
--- a/app/views/message/read.html.erb
+++ b/app/views/message/read.html.erb
@@ -13,7 +13,7 @@
- <%= @message.body.to_html %>
+ <%= @message.body.to_html %>
<%= link_to t('message.read.back_to_inbox'), :controller => 'message', :action => 'inbox', :display_name => @user.display_name %>
@@ -29,8 +29,8 @@
- <%= @message.body.to_html %>
+ <%= @message.body.to_html %>
<%= link_to t('message.read.back_to_outbox'), :controller => 'message', :action => 'outbox', :display_name => @user.display_name %>
-<% end %>
\ No newline at end of file
+<% end %>
diff --git a/app/views/redactions/show.html.erb b/app/views/redactions/show.html.erb
index 798ed962a..2404df734 100644
--- a/app/views/redactions/show.html.erb
+++ b/app/views/redactions/show.html.erb
@@ -7,7 +7,7 @@
<%= t 'redaction.show.user' %>
<%= link_to(@redaction.user.display_name, {:controller => 'user', :action => 'view', :display_name => @redaction.user.display_name}) %>
-
+
<%= t 'redaction.show.description' %>
<%= @redaction.description.to_html %>
diff --git a/app/views/user/_user.html.erb b/app/views/user/_user.html.erb
index 4f2f59c92..b1ea3f299 100644
--- a/app/views/user/_user.html.erb
+++ b/app/views/user/_user.html.erb
@@ -19,7 +19,7 @@
%>
<% 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/user/view.html.erb b/app/views/user/view.html.erb
index de2e93f94..67619a536 100644
--- a/app/views/user/view.html.erb
+++ b/app/views/user/view.html.erb
@@ -146,7 +146,7 @@
- <%= @this_user.description.to_html %>
+ <%= @this_user.description.to_html %>
diff --git a/app/views/user_blocks/show.html.erb b/app/views/user_blocks/show.html.erb
index 73b26b930..e882e6e3b 100644
--- a/app/views/user_blocks/show.html.erb
+++ b/app/views/user_blocks/show.html.erb
@@ -33,4 +33,4 @@
<%= t'user_block.show.status' %>: <%= block_status(@user_block) %>
<%= t'user_block.show.reason' %>
-<%= @user_block.reason.to_html %>
\ No newline at end of file
+<%= @user_block.reason.to_html %>
--
2.39.5
|
<%= raw(t('diary_entry.diary_comment.comment_from', :link_user => (link_to h(diary_comment.user.display_name), :controller => 'user', :action => 'view', :display_name => diary_comment.user.display_name), :comment_created_at => l(diary_comment.created_at, :format => :friendly))) %>
- <%= diary_comment.body.to_html %> +<%= raw(t('diary_entry.diary_comment.comment_from', :link_user => (link_to h(diary_comment.user.display_name), :controller => 'user', :action => 'view', :display_name => diary_comment.user.display_name), :comment_created_at => l(diary_comment.created_at, :format => :friendly))) %>
+