Make notes RSS feeds work

This commit is contained in:
Tom Hughes 2013-02-02 17:48:56 +00:00
parent 16a0f14f4a
commit ff73d12255
3 changed files with 35 additions and 1 deletions

View file

@ -1,7 +1,7 @@
<div>
<% description.comments.each do |comment| -%>
<div class="note-comment" style="margin-top: 5px">
<% if comment.author.nil> -%>
<% if comment.author.nil? -%>
<div class="note-comment-description" style="font-size: smaller; color: #999999"><%= t "note.description.#{comment.event}_at", :when => friendly_date(comment.created_at) %></div>
<% else -%>
<div class="note-comment-description" style="font-size: smaller; color: #999999"><%= t "note.description.#{comment.event}_at_by", :when => friendly_date(comment.created_at), :user => note_author(comment.author, :only_path => false) %></div>

View file

@ -0,0 +1,32 @@
#
# Make :formats work when rendering one partial from another
#
# Taken from https://github.com/rails/rails/pull/6626
#
module ActionView
class AbstractRenderer #:nodoc:
def prepend_formats(formats)
formats = Array(formats)
return if formats.empty?
@lookup_context.formats = formats | @lookup_context.formats
end
end
class PartialRenderer
def setup_with_formats(context, options, block)
prepend_formats(options[:formats])
setup_without_formats(context, options, block)
end
alias_method_chain :setup, :formats
end
class TemplateRenderer
def render_with_formats(context, options)
prepend_formats(options[:formats])
render_without_formats(context, options)
end
alias_method_chain :render, :formats
end
end

View file

@ -1,4 +1,6 @@
module Nominatim
extend ActionView::Helpers::NumberHelper
def self.describe_location(lat, lon, zoom = nil, language = nil)
zoom = zoom || 14
language = language || request.user_preferred_languages.join(',')