Update link to Immich search on the trip page

This commit is contained in:
Eugene Burmakin 2024-11-28 10:51:11 +01:00
parent c689051472
commit b712332277
2 changed files with 11 additions and 1 deletions

View file

@ -110,4 +110,14 @@ module ApplicationHelper
def human_date(date)
date.strftime('%e %B %Y')
end
def immich_search_url(base_url, start_date, end_date)
query = {
takenAfter: "#{start_date.to_date}T00:00:00.000Z",
takenBefore: "#{end_date.to_date}T23:59:59.999Z"
}
encoded_query = URI.encode_www_form_component(query.to_json)
"#{base_url}/search?query=#{encoded_query}"
end
end

View file

@ -65,7 +65,7 @@
<% end %>
<div class="text-center mt-6">
<%= link_to "More photos on Immich", "#", class: "btn btn-primary" %>
<%= link_to "More photos on Immich", immich_search_url(current_user.settings['immich_url'], @trip.started_at, @trip.ended_at), class: "btn btn-primary", target: '_blank' %>
</div>
</div>
</div>