From bce10526081062305331f73494f0cf15abd4f3dd Mon Sep 17 00:00:00 2001 From: Eugene Burmakin Date: Tue, 18 Nov 2025 21:24:14 +0100 Subject: [PATCH] Add hashtag --- app/javascript/controllers/maps_controller.js | 2 +- app/javascript/maps/places.js | 4 ++-- app/javascript/maps/places_control.js | 2 +- app/models/concerns/taggable.rb | 2 +- app/views/shared/_place_creation_modal.html.erb | 2 +- app/views/stats/_month.html.erb | 2 +- app/views/tags/index.html.erb | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/javascript/controllers/maps_controller.js b/app/javascript/controllers/maps_controller.js index f26a9fd3..b8bef55a 100644 --- a/app/javascript/controllers/maps_controller.js +++ b/app/javascript/controllers/maps_controller.js @@ -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({ diff --git a/app/javascript/maps/places.js b/app/javascript/maps/places.js index 386b9583..694831ef 100644 --- a/app/javascript/maps/places.js +++ b/app/javascript/maps/places.js @@ -133,9 +133,9 @@ export class PlacesManager { } createPopupContent(place) { - const tags = place.tags.map(tag => + const tags = place.tags.map(tag => ` - ${tag.icon} ${tag.name} + ${tag.icon} #${tag.name} ` ).join(' '); diff --git a/app/javascript/maps/places_control.js b/app/javascript/maps/places_control.js index 97016428..1c485987 100644 --- a/app/javascript/maps/places_control.js +++ b/app/javascript/maps/places_control.js @@ -111,7 +111,7 @@ export function createPlacesControl(placesManager, tags, userTheme = 'dark') { style="margin-right: 8px; cursor: pointer;" ${this.activeFilters.has(tag.id) ? 'checked' : ''}> ${tag.icon || '📍'} - ${this.escapeHtml(tag.name)} + #${this.escapeHtml(tag.name)} ${tag.color ? `` : ''} `).join('')} diff --git a/app/models/concerns/taggable.rb b/app/models/concerns/taggable.rb index 881c5a10..99b3c14f 100644 --- a/app/models/concerns/taggable.rb +++ b/app/models/concerns/taggable.rb @@ -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 } diff --git a/app/views/shared/_place_creation_modal.html.erb b/app/views/shared/_place_creation_modal.html.erb index 0acf52c1..f53c8e76 100644 --- a/app/views/shared/_place_creation_modal.html.erb +++ b/app/views/shared/_place_creation_modal.html.erb @@ -43,7 +43,7 @@ <% end %> diff --git a/app/views/stats/_month.html.erb b/app/views/stats/_month.html.erb index 07ffdf4f..9004b046 100644 --- a/app/views/stats/_month.html.erb +++ b/app/views/stats/_month.html.erb @@ -100,7 +100,7 @@ data-action="change->stat-page#filterPlacesByTags" class="checkbox checkbox-sm checkbox-primary"> <%= tag.icon %> - <%= tag.name %> + #<%= tag.name %> <% if tag.color.present? %> <% end %> diff --git a/app/views/tags/index.html.erb b/app/views/tags/index.html.erb index 535af9c6..55cb4155 100644 --- a/app/views/tags/index.html.erb +++ b/app/views/tags/index.html.erb @@ -20,7 +20,7 @@ <% @tags.each do |tag| %> <%= tag.icon %> - <%= tag.name %> + #<%= tag.name %> <% if tag.color.present? %>