Skip to content

Commit

Permalink
Switched to tmp_{body, author} from {body, author}
Browse files Browse the repository at this point in the history
Switched to using note.{body, author} instead of note_comment.{body, author} when note comment has event set to "opened", by using helper methods tmp_{body, author}.
  • Loading branch information
nenad-vujicic committed Jan 14, 2025
1 parent 8bacb3c commit 71990e9
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 20 deletions.
8 changes: 4 additions & 4 deletions app/views/api/notes/_comment.html.erb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<div class="note-comment" style="margin-top: 5px">
<% if comment.author.nil? -%>
<div class="note-comment-description" style="font-size: smaller; color: #999999"><%= t ".#{comment.event}_at_html", :when => friendly_date_ago(comment.created_at) %></div>
<% if comment.tmp_author.nil? -%>
<div class="note-comment-description" style="font-size: smaller; color: #999999"><%= t ".#{comment.event}_at_html", :when => friendly_date_ago(comment.created_at) %></div>
<% else -%>
<div class="note-comment-description" style="font-size: smaller; color: #999999"><%= t ".#{comment.event}_at_by_html", :when => friendly_date_ago(comment.created_at), :user => note_author(comment.author, :only_path => false) %></div>
<div class="note-comment-description" style="font-size: smaller; color: #999999"><%= t ".#{comment.event}_at_by_html", :when => friendly_date_ago(comment.created_at), :user => note_author(comment.tmp_author, :only_path => false) %></div>
<% end -%>
<div class="note-comment-text"><%= comment.body %></div>
<div class="note-comment-text"><%= comment.tmp_body %></div>
</div>
14 changes: 7 additions & 7 deletions app/views/api/notes/_note.json.jbuilder
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@ json.properties do
json.comments(note.comments) do |comment|
json.date comment.created_at.to_s

if comment.author
json.uid comment.author.id
json.user comment.author.display_name
json.user_url user_url(:display_name => comment.author.display_name, :only_path => false)
if comment.tmp_author
json.uid comment.tmp_author.id
json.user comment.tmp_author.display_name
json.user_url user_url(:display_name => comment.tmp_author.display_name, :only_path => false)
end

json.action comment.event

if comment.body
json.text comment.body.to_text
json.html comment.body.to_html
if comment.tmp_body
json.text comment.tmp_body.to_text
json.html comment.tmp_body.to_html
end
end
end
14 changes: 7 additions & 7 deletions app/views/api/notes/_note.xml.builder
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@ xml.note("lon" => note.lon, "lat" => note.lat) do
xml.comment do
xml.date comment.created_at

if comment.author
xml.uid comment.author.id
xml.user comment.author.display_name
xml.user_url user_url(:display_name => comment.author.display_name, :only_path => false)
if comment.tmp_author
xml.uid comment.tmp_author.id
xml.user comment.tmp_author.display_name
xml.user_url user_url(:display_name => comment.tmp_author.display_name, :only_path => false)
end

xml.action comment.event

if comment.body
xml.text comment.body.to_text
xml.html comment.body.to_html
if comment.tmp_body
xml.text comment.tmp_body.to_text
xml.html comment.tmp_body.to_html
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion app/views/api/notes/feed.rss.builder
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ xml.rss("version" => "2.0",
xml.cdata! render(:partial => "entry", :object => comment, :formats => [:html])
end

xml.dc :creator, comment.author.display_name if comment.author
xml.dc :creator, comment.tmp_author.display_name if comment.tmp_author

xml.pubDate comment.created_at.to_fs(:rfc822)
xml.geo :lat, comment.note.lat
Expand Down
2 changes: 1 addition & 1 deletion app/views/notes/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
</p>
</div>

<% if @note_comments.find { |comment| comment.author.nil? } -%>
<% if @note_comments.find { |comment| comment.tmp_author.nil? } -%>
<p class='alert alert-warning'><%= t ".anonymous_warning" %></p>
<% end -%>

Expand Down

0 comments on commit 71990e9

Please sign in to comment.