more work on post uploads

This commit is contained in:
albert
2010-03-12 19:27:54 -05:00
parent 9eb578927c
commit ca8be10ab9
18 changed files with 218 additions and 168 deletions

View File

@@ -1,4 +1,4 @@
class PostSetPresenter
class PostSetPresenter < Presenter
attr_accessor :post_set
def initialize(post_set)
@@ -24,13 +24,18 @@ class PostSetPresenter
html = ""
posts.each do |post|
html << %{<article id="post_#{post.id}" data-id="#{post.id}" data-tags="#{h(post.tag_string)}" data-uploader="#{h(post.uploader_name)}" data-rating="#{post.rating}" data-width="#{post.image_width}" data-height="#{post.image_height}">}
flags = []
flags << "pending" if post.is_pending?
flags << "flagged" if post.is_flagged?
flags << "deleted" if post.is_deleted?
html << %{<article id="post_#{post.id}" data-id="#{post.id}" data-tags="#{h(post.tag_string)}" data-uploader="#{h(post.uploader_name)}" data-rating="#{post.rating}" data-width="#{post.image_width}" data-height="#{post.image_height}" data-flags="#{flags.join(' ')}">}
html << %{<a href="/posts/#{post.id}">}
html << %{<img src="#{post.preview_url}>"}
html << %{<img src="#{post.preview_file_url}">}
html << %{</a>}
html << %{</article>}
end
html
html.html_safe
end
end

View File

@@ -0,0 +1,5 @@
class Presenter
def h(s)
CGI.escapeHTML(s)
end
end