Skip to content

Commit

Permalink
Updated j(builder) files to use Note.description
Browse files Browse the repository at this point in the history
Updated notes' j(builder) files to use Note.description instead of first note comment (opening) body. Also, improved indentation in _comment partial.
  • Loading branch information
nenad-vujicic committed Jan 3, 2025
1 parent 97a304d commit 5130c51
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 7 deletions.
10 changes: 7 additions & 3 deletions app/views/api/notes/_comment.html.erb
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
<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>
<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.author, :only_path => false) %></div>
<% end -%>
<% if comment.event == "opened" -%>
<div class="note-comment-text"><%= comment.note.description %></div>
<% else -%>
<div class="note-comment-text"><%= comment.body %></div>
<% end -%>
<div class="note-comment-text"><%= comment.body %></div>
</div>
9 changes: 7 additions & 2 deletions app/views/api/notes/_note.json.jbuilder
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,13 @@ json.properties do
json.action comment.event

if comment.body
json.text comment.body.to_text
json.html comment.body.to_html
if comment.event == "opened"
json.text note.description.to_text
json.html note.description.to_html
else
json.text comment.body.to_text
json.html comment.body.to_html
end
end
end
end
9 changes: 7 additions & 2 deletions app/views/api/notes/_note.xml.builder
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,13 @@ xml.note("lon" => note.lon, "lat" => note.lat) do
xml.action comment.event

if comment.body
xml.text comment.body.to_text
xml.html comment.body.to_html
if comment.event == "opened"
xml.text note.description.to_text
xml.html note.description.to_html
else
xml.text comment.body.to_text
xml.html comment.body.to_html
end
end
end
end
Expand Down

0 comments on commit 5130c51

Please sign in to comment.