-<svg xmlns="http://www.w3.org/2000/svg" width="520" height="20">
- <style><![CDATA[.C{fill-opacity:.51}.D{stroke-width:2}]]></style>
- <path d="M9 6.969V17h2V6.969z"/>
- <path d="M15 6.985L10 2 5 7zm72.125-2.001V5H86v7.006L82 12l5 5 5-4.984-4-.006V6.984h7V17h2V5h-.469v-.016h-9.406zM28 3.988l2.814 2.82-4.777 4.746v.043H26V17h2v-4.576l4.229-4.201L35 11V4l-7-.012zM53 4l.006 3.984H47v2V17h2V9.984h4.01L53.016 14 58 9l-5-5zm14.025.41L67.004 17h2V9.447l3.686 3.871-2.683 2.695 6.99.055.011-7.085-2.855 2.921zM170 3l-4 5h3v5h2V8h3zm19 3.969V17h2V6.969z"/>
- <path d="M195 6.985L190 2l-5 5zm-83-2.997l-2.814 2.82 4.777 4.746v.043H114V17h-2v-4.576l-4.229-4.201L105 11V4l7-.012zM128 4l-.006 3.984H134v2V17h-2V9.985h-4.01L127.984 14 123 9l5-5zm25.986.41l.022 12.59h-2V9.447l-3.686 3.871 2.683 2.695-6.99.055-.011-7.085 2.855 2.921z"/>
- <circle r="3" cy="12" cx="208" fill="none" stroke="#000" class="D"/>
- <path d="M209 3.988l2.814 2.82-1.766 1.754a4.03 4.03 0 0 1 1.418 1.41l1.762-1.75L216 11V4l-7-.012zm-2 11.855V17h2v-1.131c-.309.077-.627.131-.959.131-.362 0-.707-.065-1.041-.156z"/>
- <circle cx="228" cy="12" r="3" fill="none" stroke="#000" class="D"/>
- <path d="M229 3.988l2.814 2.82-1.766 1.754a4.03 4.03 0 0 1 1.418 1.41l1.762-1.75L236 11V4l-7-.012zm-2 11.855V17h2v-1.131c-.309.077-.627.131-.959.131-.362 0-.707-.065-1.041-.156z"/>
- <circle r="3" cy="12" cx="248" fill="none" stroke="#000" class="D"/>
- <path d="M249 3.988l2.814 2.82-1.766 1.754a4.03 4.03 0 0 1 1.418 1.41l1.762-1.75L256 11V4l-7-.012zm-2 11.855V17h2v-1.131c-.309.077-.627.131-.959.131a3.94 3.94 0 0 1-1.041-.156zm22-8.874V17h2V6.969z"/>
- <path d="M275 6.985L270 2l-5 5zM290 3a2 2 0 1 0 0 4 2 2 0 1 0 0-4zm0 4l-4 5h3v5h2v-5h3l-4-5zm14.011-.02v7.976h2V6.98z"/>
- <path d="M308.006 6.985L305.011 4 302 7.012zm4.005 5.047V2h2v10.031z"/>
- <path d="M318.011 12.016l-5 4.984-5-5z"/>
- <path d="M336 12.02v-7.976h-2v7.976z"/>
- <path d="M332.005 12.015l2.995 2.985 3.011-3.012z m-4.005-5.047v10.031h-2v-10.031z"/>
- <path d="M322 6.984l5-4.984 5 5z"/>
- <path d="M349 3v1h-3v5.227l-2.045.773L347 13v.904l1.611 1.426 1.889-1.672 1.891 1.672L354 13.906V13l3.045-2.955L355 9.262V4h-3V3h-3zm-2 2h7v3.877l-3.514-1.346L347 8.85V5zm-.279 9.992l-2.221 1.967.662.748 1.559-1.379 1.89 1.672 1.889-1.672L352.391 18l1.889-1.672 1.559 1.379.662-.748-2.221-1.967-1.889 1.674-1.891-1.674-1.889 1.674-1.891-1.674zM370 3.988l2.814 2.82-4.777 4.746v.043H368V17h2v-4.576l4.229-4.201L377 11V4l-7-.012z"/>
- <path d="M365.186 6.809l4.777 4.746v.043H370V17h-2v-4.576l-4.229-4.201z" class="C"/>
- <path d="M390 3.989l-2.814 2.82 4.777 4.746v0.043H392v5.402h-2v-4.576l-4.229-4.201-2.771 2.777v-7l7-0.012z"/>
- <path d="M394.814 6.809l-4.777 4.746v0.043H390v5.402h2v-4.576l4.229-4.201z" class="C"/>
- <path d="M407.029 3.988v5.402h.037v.043l1.951 1.938v5.639l2.816-2.82 2.727 2.797 1.445-1.383-2.768-2.838.019-.021 2.76-2.746-5.529.01-1.459-1.443V3.988h-2z"/>
- <path d="M404.214 14.18l4.777-4.746V9.39h.037V3.988h-2v4.576l-4.229 4.201z" class="C"/>
- <path d="M432.989 3.988v5.402h-0.037v0.043l-1.951 1.938v5.639l-2.816-2.82-2.727 2.797-1.445-1.383 2.768-2.838-0.019-0.021-2.76-2.746 5.529 0.01 1.459-1.443v-4.576h2z"/>
- <path d="M435.804 14.18l-4.777-4.746v-0.043h-0.037v-5.402h2v4.576l4.229 4.201z" class="C"/>
- <path d="M448 9v8h2V9zm5.016 4L458 8l-5-5z"/>
- <path d="M454 6.985h-6v2h6z"/>
- <path d="M450.016 6.985h-7.963v2h7.963z" class="C"/>
- <path d="M472.053 9v8h-2V9zm-5.016 4l-4.984-5 5-5z"/>
- <path d="M466.053 6.985h6v2h-6z"/>
- <path d="M470.037 6.985H478v2h-7.963z" class="C"/>
- <path d="M490 3.988l2.814 2.82-4.777 4.746v.043H488V17h2v-4.576l4.229-4.201L497 11V4l-7-.012z"/>
- <path d="M490 6v11h-2V6z" class="C"/>
- <path d="M490 3.988l2.814 2.82-4.777 4.746v.043H488V17h2v-4.576l4.229-4.201L497 11V4l-7-.012zm20 0l-2.814 2.82 4.777 4.746v.043H512V17h-2v-4.576l-4.229-4.201L503 11V4l7-.012z"/>
- <path d="M510 6v11h2V6z" class="C"/>
- <path d="M510 3.988l-2.814 2.82 4.777 4.746v.043H512V17h-2v-4.576l-4.229-4.201L503 11V4l7-.012z"/>
+<svg xmlns="http://www.w3.org/2000/svg" width="520" height="20"
+ fill="none" stroke="#000" stroke-width="2">
+ <!-- 0: straight / continue -->
+ <path d="M10 17 v-13 m2.5 2 l-2.5 -2.5 -2.5 2.5 z"/>
+ <!-- 1: turn slight right / stay right -->
+ <path d="M27 17 v-3 q0 -2 2 -4 l5 -5 m0 0 h-3 l3 3 z"/>
+ <!-- 2: turn right -->
+ <path d="M48 17 v-5 q0 -3 3 -3 h4 m-2 2.5 l2.5 -2.5 -2.5 -2.5 z"/>
+ <!-- 3: turn sharp right-->
+ <path d="M68 17 v-7 q0 -6 6 0 l2 2 m0 0 v-3 l-3 3 z"/>
+ <!-- 4: u-turn -->
+ <path d="M96 17 v-7 a4.5 4.5 0 0 0 -9 0 v5 m-2.5 -2 l2.5 2.5 2.5 -2.5 z"/>
+ <!-- 5: turn slight left / stay left -->
+ <path d="M113 17 v-3 q0 -2 -2 -4 l-5 -5 m0 0 h3 l-3 3 z"/>
+ <!-- 6: turn left -->
+ <path d="M133 17 v-5 q0 -3 -3 -3 h-4 m2 2.5 l-2.5 -2.5 2.5 -2.5 z"/>
+ <!-- 7: turn sharp left-->
+ <path d="M153 17 v-7 q0 -6 -6 0 l-2 2 m0 0 v-3 l3 3 z"/>
+ <!-- 8: start -->
+ <path d="M170 16 a1 1 0 1 0 0 -2 1 1 0 1 0 0 2 m0 -4 v-8 m2.5 2 l-2.5 -2.5 -2.5 2.5 z"/>
+ <!-- 10: roundabout -->
+ <path d="M208 17 v-3 a 3 3 0 1 0 0 -6 3 3 0 1 0 0 6 m2 -4 l5 -5 m0 0 h-3 l3 3 z"/>
+ <!-- 14: destination -->
+ <path d="M290 5 a1 1 0 1 0 0 -2 1 1 0 1 0 0 2 m0 12 v-8 m2.5 2 l-2.5 -2.5 -2.5 2.5 z"/>
+ <!-- 17: ferry -->
+ <g stroke-width="1">
+ <path d="M350.5 8 l-6 2 l2.5 2 v1.5 a2.828 2.828 0 0 1 1.5 1 a2.828 2.828 0 0 1 4 0 a2.828 2.828 0 0 1 1.5 -1 v-1.5 l2.5 -2 z" fill="#000"/>
+ <path d="M346.5 9.5 v-5 h8 v5 m-5.5 -6 h3"/>
+ <path d="M345.5 16.5 a1.414 2.828 0 0 1 2 0 a1.414 2.828 0 0 0 2 0 a1.414 2.828 0 0 1 2 0 a1.414 2.828 0 0 0 2 0 a1.414 2.828 0 0 1 2 0"/>
+ </g>
+ <!-- 18: fork right -->
+ <path d="M369 14 q0 -2 -2 -4 l-3 -3" opacity=".5"/>
+ <path d="M369 17 v-3 q0 -2 2 -4 l5 -5 m0 0 h-3 l3 3 z"/>
+ <!-- 19: fork left -->
+ <path d="M391 14 q0 -2 2 -4 l3 -3" opacity=".5"/>
+ <path d="M391 17 v-3 q0 -2 -2 -4 l-5 -5 m0 0 h3 l-3 3 z"/>
+ <!-- 20: merge left -->
+ <path d="M408 7 q0 2 -2 4 l-3 3" opacity=".5"/>
+ <path d="M408 4 v3 q0 2 2 4 l5 5 m-5 -5 h3 l-3 3 z"/>
+ <!-- 21: merge right-->
+ <path d="M432 7 q0 2 2 4 l3 3" opacity=".5"/>
+ <path d="M432 4 v3 q0 2 -2 4 l-5 5 m5 -5 h-3 l3 3 z"/>
+ <!-- 22: end of road right-->
+ <path d="M442 9 h10" opacity=".5"/>
+ <path d="M449 17 v-5 q0 -3 3 -3 h4 m-2 2.5 l2.5 -2.5 -2.5 -2.5 z"/>
+ <!-- 23: end of road left-->
+ <path d="M478 9 h-10" opacity=".5"/>
+ <path d="M471 17 v-5 q0 -3 -3 -3 h-4 m2 2.5 l-2.5 -2.5 2.5 -2.5 z"/>
+ <!-- 24: off ramp / exit right -->
+ <path d="M489 14 v-8" opacity=".5"/>
+ <path d="M489 17 v-3 q0 -2 2 -4 l5 -5 m0 0 h-3 l3 3 z"/>
+ <!-- 25: off ramp / exit left -->
+ <path d="M511 14 v-8" opacity=".5"/>
+ <path d="M511 17 v-3 q0 -2 -2 -4 l-5 -5 m0 0 h3 l-3 3 z"/>
</svg>
5, // kStayLeft = 24;
20, // kMerge = 25;
10, // kRoundaboutEnter = 26;
- 11, // kRoundaboutExit = 27;
+ 10, // kRoundaboutExit = 27;
17, // kFerryEnter = 28;
0, // kFerryExit = 29;
null, // kTransit = 30;
$(".richtext_dopreview").click(function (event) {
var editor = $(this).parents(".richtext_container").find("textarea");
var preview = $(this).parents(".richtext_container").find(".richtext_preview");
- var width = editor.outerWidth() - preview.outerWidth() + preview.width();
var minHeight = editor.outerHeight() - preview.outerHeight() + preview.height();
if (preview.contents().length === 0) {
}
editor.hide();
- preview.width(width);
preview.css("min-height", minHeight + "px");
preview.show();
#
class DiaryComment < ApplicationRecord
- belongs_to :user
+ belongs_to :user, :counter_cache => true
belongs_to :diary_entry
scope :visible, -> { where(:visible => true) }
class NoteComment < ApplicationRecord
belongs_to :note, :touch => true
- belongs_to :author, :class_name => "User", :optional => true
+ belongs_to :author, :class_name => "User", :optional => true, :counter_cache => true
validates :id, :uniqueness => true, :presence => { :on => :update },
:numericality => { :on => :update, :only_integer => true }
#
# Table name: users
#
-# email :string not null
-# id :bigint(8) not null, primary key
-# pass_crypt :string not null
-# creation_time :datetime not null
-# display_name :string default(""), not null
-# data_public :boolean default(FALSE), not null
-# description :text default(""), not null
-# home_lat :float
-# home_lon :float
-# home_zoom :integer default(3)
-# pass_salt :string
-# email_valid :boolean default(FALSE), not null
-# new_email :string
-# creation_ip :string
-# languages :string
-# status :enum default("pending"), not null
-# terms_agreed :datetime
-# consider_pd :boolean default(FALSE), not null
-# auth_uid :string
-# preferred_editor :string
-# terms_seen :boolean default(FALSE), not null
-# description_format :enum default("markdown"), not null
-# changesets_count :integer default(0), not null
-# traces_count :integer default(0), not null
-# diary_entries_count :integer default(0), not null
-# image_use_gravatar :boolean default(FALSE), not null
-# auth_provider :string
-# home_tile :bigint(8)
-# tou_agreed :datetime
+# email :string not null
+# id :bigint(8) not null, primary key
+# pass_crypt :string not null
+# creation_time :datetime not null
+# display_name :string default(""), not null
+# data_public :boolean default(FALSE), not null
+# description :text default(""), not null
+# home_lat :float
+# home_lon :float
+# home_zoom :integer default(3)
+# pass_salt :string
+# email_valid :boolean default(FALSE), not null
+# new_email :string
+# creation_ip :string
+# languages :string
+# status :enum default("pending"), not null
+# terms_agreed :datetime
+# consider_pd :boolean default(FALSE), not null
+# auth_uid :string
+# preferred_editor :string
+# terms_seen :boolean default(FALSE), not null
+# description_format :enum default("markdown"), not null
+# changesets_count :integer default(0), not null
+# traces_count :integer default(0), not null
+# diary_entries_count :integer default(0), not null
+# image_use_gravatar :boolean default(FALSE), not null
+# auth_provider :string
+# home_tile :bigint(8)
+# tou_agreed :datetime
+# diary_comments_count :integer default(0)
+# note_comments_count :integer default(0)
#
# Indexes
#
<span class='badge count-number'><%= number_with_delimiter(current_user.changesets.size) %></span>
</li>
<li>
- <%= link_to t(".my notes"), user_notes_path(@user) %>
+ <%= link_to t(".my notes"), user_notes_path(current_user) %>
+ <span class='badge count-number'><%= number_with_delimiter(current_user.note_comments.size) %></span>
</li>
<li>
<%= link_to t(".my traces"), :controller => "traces", :action => "mine" %>
</li>
<li>
<%= link_to t(".my comments"), diary_comments_path(current_user) %>
+ <span class='badge count-number'><%= number_with_delimiter(current_user.diary_comments.size) %></span>
</li>
<li>
<%= link_to t(".my settings"), edit_account_path %>
</li>
<li>
<%= link_to t(".notes"), user_notes_path(@user) %>
+ <span class='badge count-number'><%= number_with_delimiter(@user.note_comments.size) %></span>
</li>
<li>
<%= link_to t(".traces"), :controller => "traces", :action => "index", :display_name => @user.display_name %>
</li>
<li>
<%= link_to t(".comments"), diary_comments_path(@user) %>
+ <span class='badge count-number'><%= number_with_delimiter(@user.diary_comments.size) %></span>
</li>
<li>
<% if current_user and current_user.friends_with?(@user) %>
index:
js_1: "You are either using a browser that does not support JavaScript, or you have disabled JavaScript."
js_2: "OpenStreetMap uses JavaScript for its slippy map."
- permalink: Permalink
- shortlink: Shortlink
- createnote: Add a note
license:
copyright: "Copyright OpenStreetMap and contributors, under an open license"
license_url: "https://openstreetmap.org/copyright"
--- /dev/null
+class AddNotesAndDiaryCommentsCounterCaches < ActiveRecord::Migration[7.1]
+ def self.up
+ add_column :users, :diary_comments_count, :integer, :default => 0
+ add_column :users, :note_comments_count, :integer, :default => 0
+
+ users_with_diary_comments = DiaryComment.distinct.pluck(:user_id)
+ users_with_diary_comments.each do |user_id|
+ User.reset_counters(user_id, :diary_comments)
+ end
+
+ users_with_note_comments = NoteComment.where.not(:author_id => nil).distinct.pluck(:author_id)
+ users_with_note_comments.each do |author_id|
+ User.reset_counters(author_id, :note_comments)
+ end
+ end
+
+ def self.down
+ remove_column :users, :diary_comments_count
+ remove_column :users, :note_comments_count
+ end
+end
image_use_gravatar boolean DEFAULT false NOT NULL,
auth_provider character varying,
home_tile bigint,
- tou_agreed timestamp without time zone
+ tou_agreed timestamp without time zone,
+ diary_comments_count integer DEFAULT 0,
+ note_comments_count integer DEFAULT 0
);
('23'),
('22'),
('21'),
+('20240605134916'),
('20240405083825'),
('20240307181018'),
('20240307180830'),