Commit 4ed8d8c3bbaec4e4005fd3f4657b66a128de58f7
Exists in
profile_api_improvements
and in
1 other branch
Merge branch 'fix_escape_html_on_display_short_format_of_article' into 'master'
not escape HTML of link to read more article on blog index with short format This commit wants to fix escape HTML on read more link on blog posts list when post not accept comments and blog is setup to display short format as image attached  See merge request !958
Showing
2 changed files
with
13 additions
and
2 deletions
Show diff stats
app/helpers/application_helper.rb
... | ... | @@ -723,11 +723,11 @@ module ApplicationHelper |
723 | 723 | def display_short_format(article, options={}) |
724 | 724 | options[:comments_link] ||= true |
725 | 725 | options[:read_more_link] ||= true |
726 | + lead_links = (options[:comments_link] ? link_to_comments(article) : '') + (options[:read_more_link] ? reference_to_article( _('Read more'), article) : '') | |
726 | 727 | html = content_tag('div', |
727 | 728 | article.lead + |
728 | 729 | content_tag('div', |
729 | - (options[:comments_link] ? link_to_comments(article) : '') + | |
730 | - (options[:read_more_link] ? reference_to_article( _('Read more'), article) : ''), | |
730 | + lead_links.html_safe, | |
731 | 731 | :class => 'read-more' |
732 | 732 | ), |
733 | 733 | :class => 'short-post' | ... | ... |
test/integration/safe_strings_test.rb
... | ... | @@ -175,4 +175,15 @@ class SafeStringsTest < ActionDispatch::IntegrationTest |
175 | 175 | assert_select '.icon-selector .icon-edit' |
176 | 176 | end |
177 | 177 | |
178 | + should 'not escape read more link to article on display short format' do | |
179 | + profile = fast_create Profile | |
180 | + blog = fast_create Blog, :name => 'Blog', :profile_id => profile.id | |
181 | + fast_create(TinyMceArticle, :name => "Post Test", :profile_id => profile.id, :parent_id => blog.id, :accept_comments => false, :body => '<p>Lorem ipsum dolor sit amet</p>') | |
182 | + blog.update_attribute(:visualization_format, 'short') | |
183 | + | |
184 | + get "/#{profile.identifier}/blog" | |
185 | + assert_tag :tag => 'div', :attributes => {:class => 'read-more'}, :child => {:tag => 'a', :content => 'Read more'} | |
186 | + end | |
187 | + | |
188 | + | |
178 | 189 | end | ... | ... |