class PostHistoryRevisionPresenter < Presenter
attr_reader :revision
def initialize(revision)
@revision = revision
end
def changes
html = []
html << revision.diff[:del].map {|x| "#{h(x)}"}
html << revision.diff[:add].map {|x| "#{h(x)}"}
html << "source:#{h(revision.diff[:source])}" if revision.diff[:source].present?
html << "rating:#{h(revision.diff[:rating])}" if revision.diff[:rating].present?
html << "parent:#{revision.diff[:parent_id]}" if revision.diff[:parent_id].present?
html.join(" ").html_safe
end
def updated_at
Time.parse(revision.updated_at)
end
def updater_name
User.id_to_name(revision.user_id)
end
end