Add hashtag

This commit is contained in:
Eugene Burmakin 2025-11-18 21:24:14 +01:00
parent 807672170f
commit bce1052608
7 changed files with 8 additions and 8 deletions

View file

@ -483,7 +483,7 @@ export default class extends BaseController {
if (this.userTags && this.userTags.length > 0) {
this.userTags.forEach(tag => {
const icon = tag.icon || '📍';
const label = `${icon} ${tag.name}`;
const label = `${icon} #${tag.name}`;
const tagLayer = this.placesManager?.createFilteredLayer([tag.id]) || L.layerGroup();
this.placesFilteredLayers[label] = tagLayer;
placesChildren.push({

View file

@ -133,9 +133,9 @@ export class PlacesManager {
}
createPopupContent(place) {
const tags = place.tags.map(tag =>
const tags = place.tags.map(tag =>
`<span class="badge badge-sm" style="background-color: ${tag.color}">
${tag.icon} ${tag.name}
${tag.icon} #${tag.name}
</span>`
).join(' ');

View file

@ -111,7 +111,7 @@ export function createPlacesControl(placesManager, tags, userTheme = 'dark') {
style="margin-right: 8px; cursor: pointer;"
${this.activeFilters.has(tag.id) ? 'checked' : ''}>
<span style="font-size: 18px; margin-right: 6px;">${tag.icon || '📍'}</span>
<span style="flex: 1;">${this.escapeHtml(tag.name)}</span>
<span style="flex: 1;">#${this.escapeHtml(tag.name)}</span>
${tag.color ? `<span style="width: 12px; height: 12px; border-radius: 50%; background-color: ${tag.color}; margin-left: 4px;"></span>` : ''}
</label>
`).join('')}

View file

@ -4,7 +4,7 @@ module Taggable
extend ActiveSupport::Concern
included do
has_many :taggings, as: :taggable, dependent: :destroy
has_many :taggings, -> { order(created_at: :asc) }, as: :taggable, dependent: :destroy
has_many :tags, through: :taggings
scope :with_tags, ->(tag_ids) { joins(:taggings).where(taggings: { tag_id: tag_ids }).distinct }

View file

@ -43,7 +43,7 @@
<label class="cursor-pointer">
<input type="checkbox" name="tag_ids[]" value="<%= tag.id %>" class="checkbox checkbox-sm hidden peer">
<span class="badge badge-lg peer-checked:badge-primary" style="background-color: <%= tag.color %>">
<%= tag.icon %> <%= tag.name %>
<%= tag.icon %> #<%= tag.name %>
</span>
</label>
<% end %>

View file

@ -100,7 +100,7 @@
data-action="change->stat-page#filterPlacesByTags"
class="checkbox checkbox-sm checkbox-primary">
<span class="text-xl"><%= tag.icon %></span>
<span class="text-sm font-medium"><%= tag.name %></span>
<span class="text-sm font-medium">#<%= tag.name %></span>
<% if tag.color.present? %>
<span class="w-3 h-3 rounded-full ml-1" style="background-color: <%= tag.color %>;"></span>
<% end %>

View file

@ -20,7 +20,7 @@
<% @tags.each do |tag| %>
<tr>
<td class="text-2xl"><%= tag.icon %></td>
<td class="font-semibold"><%= tag.name %></td>
<td class="font-semibold">#<%= tag.name %></td>
<td>
<% if tag.color.present? %>
<div class="flex items-center gap-2">