feat: add WikiData link to city details

- Include a link to the city's WikiData page if available
- The link opens in a new tab and has a tooltip for better user experience

This change enhances the city details page by providing
users with easy access to additional information about the
city on WikiData, improving overall user engagement
and knowledge access.
This commit is contained in:
songtianlun 2025-04-02 14:36:31 +08:00
parent a4fc4d4961
commit 73c73a2a9e

View File

@ -35,6 +35,18 @@
<div class="badge badge-lg badge-secondary gap-2">
<%= @city&.state&.name %>
</div>
<% if @city.wiki_data_id.present? %>
<%= link_to "https://www.wikidata.org/wiki/#{@city.wiki_data_id}",
target: "_blank",
rel: "noopener noreferrer",
class: "badge badge-lg badge-outline badge-info gap-2",
data: { controller: "tooltip", tooltip_target: "tooltip", tooltip_content: "View on WikiData" } do %>
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
</svg>
WikiData
<% end %>
<% end %>
</div>
<!-- 主要统计信息 -->