Rename api_notes resource to avoid conflict with non-API resource

This allows using e.g. note_path for notes#show in the future.
This commit is contained in:
Andy Allan 2023-01-25 19:01:57 +00:00
parent e443d99edd
commit f7367baa6b
7 changed files with 140 additions and 140 deletions

View file

@ -10,13 +10,13 @@ xml.wpt("lon" => note.lon, "lat" => note.lat) do
xml.extensions do
xml.id note.id
xml.url note_url(note, :format => params[:format])
xml.url api_note_url(note, :format => params[:format])
if note.closed?
xml.reopen_url reopen_note_url(note, :format => params[:format])
xml.reopen_url reopen_api_note_url(note, :format => params[:format])
else
xml.comment_url comment_note_url(note, :format => params[:format])
xml.close_url close_note_url(note, :format => params[:format])
xml.comment_url comment_api_note_url(note, :format => params[:format])
xml.close_url close_api_note_url(note, :format => params[:format])
end
xml.date_created note.created_at

View file

@ -7,13 +7,13 @@ end
json.properties do
json.id note.id
json.url note_url(note, :format => params[:format])
json.url api_note_url(note, :format => params[:format])
if note.closed?
json.reopen_url reopen_note_url(note, :format => params[:format])
json.reopen_url reopen_api_note_url(note, :format => params[:format])
else
json.comment_url comment_note_url(note, :format => params[:format])
json.close_url close_note_url(note, :format => params[:format])
json.comment_url comment_api_note_url(note, :format => params[:format])
json.close_url close_api_note_url(note, :format => params[:format])
end
json.date_created note.created_at.to_s

View file

@ -10,7 +10,7 @@ xml.item do
end
xml.link browse_note_url(note)
xml.guid note_url(note)
xml.guid api_note_url(note)
xml.description render(:partial => "description", :object => note, :formats => [:html])
xml.dc :creator, note.author.display_name if note.author

View file

@ -1,12 +1,12 @@
xml.note("lon" => note.lon, "lat" => note.lat) do
xml.id note.id
xml.url note_url(note, :format => params[:format])
xml.url api_note_url(note, :format => params[:format])
if note.closed?
xml.reopen_url reopen_note_url(note, :format => params[:format])
xml.reopen_url reopen_api_note_url(note, :format => params[:format])
else
xml.comment_url comment_note_url(note, :format => params[:format])
xml.close_url close_note_url(note, :format => params[:format])
xml.comment_url comment_api_note_url(note, :format => params[:format])
xml.close_url close_api_note_url(note, :format => params[:format])
end
xml.date_created note.created_at

View file

@ -49,10 +49,10 @@
</div>
<div class="btn-wrapper">
<% if current_user.moderator? -%>
<input type="submit" name="hide" value="<%= t("javascripts.notes.show.hide") %>" class="btn btn-light" data-method="DELETE" data-url="<%= note_url(@note, "json") %>">
<input type="submit" name="hide" value="<%= t("javascripts.notes.show.hide") %>" class="btn btn-light" data-method="DELETE" data-url="<%= api_note_url(@note, "json") %>">
<% end -%>
<input type="submit" name="close" value="<%= t("javascripts.notes.show.resolve") %>" class="btn btn-primary" data-method="POST" data-url="<%= close_note_url(@note, "json") %>">
<input type="submit" name="comment" value="<%= t("javascripts.notes.show.comment") %>" class="btn btn-primary" data-method="POST" data-url="<%= comment_note_url(@note, "json") %>" disabled="1">
<input type="submit" name="close" value="<%= t("javascripts.notes.show.resolve") %>" class="btn btn-primary" data-method="POST" data-url="<%= close_api_note_url(@note, "json") %>">
<input type="submit" name="comment" value="<%= t("javascripts.notes.show.comment") %>" class="btn btn-primary" data-method="POST" data-url="<%= comment_api_note_url(@note, "json") %>" disabled="1">
</div>
</form>
<% end -%>
@ -61,10 +61,10 @@
<input type="hidden" name="text" value="" autocomplete="off">
<div class="btn-wrapper">
<% if @note.status != "hidden" and current_user and current_user.moderator? -%>
<input type="submit" name="hide" value="<%= t("javascripts.notes.show.hide") %>" class="btn btn-light" data-method="DELETE" data-url="<%= note_url(@note, "json") %>">
<input type="submit" name="hide" value="<%= t("javascripts.notes.show.hide") %>" class="btn btn-light" data-method="DELETE" data-url="<%= api_note_url(@note, "json") %>">
<% end -%>
<% if current_user -%>
<input type="submit" name="reopen" value="<%= t("javascripts.notes.show.reactivate") %>" class="btn btn-primary" data-method="POST" data-url="<%= reopen_note_url(@note, "json") %>">
<input type="submit" name="reopen" value="<%= t("javascripts.notes.show.reactivate") %>" class="btn btn-primary" data-method="POST" data-url="<%= reopen_api_note_url(@note, "json") %>">
<% end -%>
</div>
</form>