mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-10 01:01:39 -05:00
Add hashtag
This commit is contained in:
parent
807672170f
commit
bce1052608
7 changed files with 8 additions and 8 deletions
|
|
@ -483,7 +483,7 @@ export default class extends BaseController {
|
||||||
if (this.userTags && this.userTags.length > 0) {
|
if (this.userTags && this.userTags.length > 0) {
|
||||||
this.userTags.forEach(tag => {
|
this.userTags.forEach(tag => {
|
||||||
const icon = tag.icon || '📍';
|
const icon = tag.icon || '📍';
|
||||||
const label = `${icon} ${tag.name}`;
|
const label = `${icon} #${tag.name}`;
|
||||||
const tagLayer = this.placesManager?.createFilteredLayer([tag.id]) || L.layerGroup();
|
const tagLayer = this.placesManager?.createFilteredLayer([tag.id]) || L.layerGroup();
|
||||||
this.placesFilteredLayers[label] = tagLayer;
|
this.placesFilteredLayers[label] = tagLayer;
|
||||||
placesChildren.push({
|
placesChildren.push({
|
||||||
|
|
|
||||||
|
|
@ -133,9 +133,9 @@ export class PlacesManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
createPopupContent(place) {
|
createPopupContent(place) {
|
||||||
const tags = place.tags.map(tag =>
|
const tags = place.tags.map(tag =>
|
||||||
`<span class="badge badge-sm" style="background-color: ${tag.color}">
|
`<span class="badge badge-sm" style="background-color: ${tag.color}">
|
||||||
${tag.icon} ${tag.name}
|
${tag.icon} #${tag.name}
|
||||||
</span>`
|
</span>`
|
||||||
).join(' ');
|
).join(' ');
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -111,7 +111,7 @@ export function createPlacesControl(placesManager, tags, userTheme = 'dark') {
|
||||||
style="margin-right: 8px; cursor: pointer;"
|
style="margin-right: 8px; cursor: pointer;"
|
||||||
${this.activeFilters.has(tag.id) ? 'checked' : ''}>
|
${this.activeFilters.has(tag.id) ? 'checked' : ''}>
|
||||||
<span style="font-size: 18px; margin-right: 6px;">${tag.icon || '📍'}</span>
|
<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>` : ''}
|
${tag.color ? `<span style="width: 12px; height: 12px; border-radius: 50%; background-color: ${tag.color}; margin-left: 4px;"></span>` : ''}
|
||||||
</label>
|
</label>
|
||||||
`).join('')}
|
`).join('')}
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ module Taggable
|
||||||
extend ActiveSupport::Concern
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
included do
|
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
|
has_many :tags, through: :taggings
|
||||||
|
|
||||||
scope :with_tags, ->(tag_ids) { joins(:taggings).where(taggings: { tag_id: tag_ids }).distinct }
|
scope :with_tags, ->(tag_ids) { joins(:taggings).where(taggings: { tag_id: tag_ids }).distinct }
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@
|
||||||
<label class="cursor-pointer">
|
<label class="cursor-pointer">
|
||||||
<input type="checkbox" name="tag_ids[]" value="<%= tag.id %>" class="checkbox checkbox-sm hidden peer">
|
<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 %>">
|
<span class="badge badge-lg peer-checked:badge-primary" style="background-color: <%= tag.color %>">
|
||||||
<%= tag.icon %> <%= tag.name %>
|
<%= tag.icon %> #<%= tag.name %>
|
||||||
</span>
|
</span>
|
||||||
</label>
|
</label>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,7 @@
|
||||||
data-action="change->stat-page#filterPlacesByTags"
|
data-action="change->stat-page#filterPlacesByTags"
|
||||||
class="checkbox checkbox-sm checkbox-primary">
|
class="checkbox checkbox-sm checkbox-primary">
|
||||||
<span class="text-xl"><%= tag.icon %></span>
|
<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? %>
|
<% if tag.color.present? %>
|
||||||
<span class="w-3 h-3 rounded-full ml-1" style="background-color: <%= tag.color %>;"></span>
|
<span class="w-3 h-3 rounded-full ml-1" style="background-color: <%= tag.color %>;"></span>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
<% @tags.each do |tag| %>
|
<% @tags.each do |tag| %>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="text-2xl"><%= tag.icon %></td>
|
<td class="text-2xl"><%= tag.icon %></td>
|
||||||
<td class="font-semibold"><%= tag.name %></td>
|
<td class="font-semibold">#<%= tag.name %></td>
|
||||||
<td>
|
<td>
|
||||||
<% if tag.color.present? %>
|
<% if tag.color.present? %>
|
||||||
<div class="flex items-center gap-2">
|
<div class="flex items-center gap-2">
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue