more work on post uploads
This commit is contained in:
@@ -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
|
||||
|
||||
5
app/presenters/presenter.rb
Normal file
5
app/presenters/presenter.rb
Normal file
@@ -0,0 +1,5 @@
|
||||
class Presenter
|
||||
def h(s)
|
||||
CGI.escapeHTML(s)
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user