diff --git a/app/helpers/blog_helper.rb b/app/helpers/blog_helper.rb index 740b721..702f496 100644 --- a/app/helpers/blog_helper.rb +++ b/app/helpers/blog_helper.rb @@ -45,9 +45,9 @@ module BlogHelper def display_post(article, format = 'full') no_comments = (format == 'full') ? false : true + title = article_title(article, :no_comments => no_comments) html = send("display_#{format}_format", FilePresenter.for(article)).html_safe - - article_title(article, :no_comments => no_comments) + html + title + html end def display_full_format(article) diff --git a/lib/file_presenter.rb b/lib/file_presenter.rb index d456882..96baff5 100644 --- a/lib/file_presenter.rb +++ b/lib/file_presenter.rb @@ -6,7 +6,9 @@ class FilePresenter # one accepts it. That behave allow to give any model to this class, # like a Article and have no trouble with that. def self.for(f) - return f if f.is_a? FilePresenter + #FIXME This check after the || is redundant but increases the blog_page + # speed considerably. + return f if f.is_a?(FilePresenter ) || (!f.kind_of?(UploadedFile) && !f.kind_of?(Image)) klass = FilePresenter.subclasses.sort_by {|class_name| class_name.constantize.accepts?(f) || 0 }.last.constantize -- libgit2 0.21.2