/* Rules for the account settings page */
+#accountForm {
+ margin-top: 20px;
+}
+
#accountForm td {
padding-bottom: 10px;
}
class Changeset < ActiveRecord::Base
require 'xml/libxml'
- belongs_to :user
+ belongs_to :user, :counter_cache => true
has_many :changeset_tags
class Trace < ActiveRecord::Base
self.table_name = "gpx_files"
- belongs_to :user
+ belongs_to :user, :counter_cache => true
has_many :tags, :class_name => 'Tracetag', :foreign_key => 'gpx_id', :dependent => :delete_all
has_many :points, :class_name => 'Tracepoint', :foreign_key => 'gpx_id', :dependent => :delete_all
<h2><%= t 'user.account.my settings' %></h2>
+
+<%= link_to t('user.account.return to profile'), :controller => 'user', :action => 'view', :display_name => @user.display_name %> |
+<%= link_to t('user.view.oauth settings'), :controller => 'oauth_clients', :action => 'index' %>
+
<%= error_messages_for 'user' %>
<%= form_for :user, :html => { :multipart => true } do |f| %>
<table id="accountForm">
<%= raw t 'user.account.public editing note.text' %>
<%= button_to t('user.account.make edits public button'), :action => :go_public %>
<% end %>
-<br/>
-<br/>
-<%= link_to t('user.account.return to profile'), :controller => 'user', :action => 'view', :display_name => @user.display_name %>
-<br/>
-<br/>
<div id="userinformation">
<% if @user and @this_user.id == @user.id %>
<!-- Displaying user's own profile page -->
- <%= link_to t('user.view.my diary'), :controller => 'diary_entry', :action => 'list', :display_name => @user.display_name %>
- |
- <%= link_to t('user.view.new diary entry'), :controller => 'diary_entry', :action => 'new' %>
- |
- <%= link_to t('user.view.my comments' ), :controller => 'diary_entry', :action => 'comments', :display_name => @this_user.display_name %>
- |
<%= link_to t('user.view.my edits'), :controller => 'changeset', :action => 'list', :display_name => @user.display_name %>
+ <span class='count-number'><%= number_with_delimiter(@this_user.changesets.size) %></span>
|
<%= link_to t('user.view.my traces'), :controller => 'trace', :action=>'mine' %>
+ <span class='count-number'><%= number_with_delimiter(@this_user.traces.size) %></span>
|
- <%= link_to t('user.view.my settings'), :controller => 'user', :action => 'account', :display_name => @user.display_name %>
+ <%= link_to t('user.view.my diary'), :controller => 'diary_entry', :action => 'list', :display_name => @user.display_name %>
|
- <%= link_to t('user.view.oauth settings'), :controller => 'oauth_clients', :action => 'index' %>
+ <%= link_to t('user.view.my comments' ), :controller => 'diary_entry', :action => 'comments', :display_name => @this_user.display_name %>
|
- <%= link_to t('user.view.blocks on me'), :controller => 'user_blocks', :action => 'blocks_on', :display_name => @user.display_name %>
+ <%= link_to t('user.view.my settings'), :controller => 'user', :action => 'account', :display_name => @user.display_name %>
+ <% if @user.active_blocks.count > 0 %>
+ |
+ <%= link_to t('user.view.blocks on me'), :controller => 'user_blocks', :action => 'blocks_on', :display_name => @user.display_name %>
+ <span class='count-number'><%= number_with_delimiter(@this_user.active_blocks.count) %></span>
+ <% end %>
<% if @user and @user.moderator? %>
| <%= link_to t('user.view.blocks by me'), :controller => 'user_blocks', :action => 'blocks_by', :display_name => @user.display_name %>
<% end %>
<% else %>
+ <%= link_to t('user.view.edits'), :controller => 'changeset', :action => 'list', :display_name => @this_user.display_name %>
+ <span class='count-number'><%= number_with_delimiter(@this_user.changesets.size) %></span>
+ |
+ <%= link_to t('user.view.traces'), :controller => 'trace', :action => 'list', :display_name => @this_user.display_name %>
+ <span class='count-number'><%= number_with_delimiter(@this_user.traces.size) %></span>
+ |
<!-- Displaying another user's profile page -->
<%= link_to t('user.view.send message'), :controller => 'message', :action => 'new', :display_name => @this_user.display_name %>
|
- <%= link_to t('user.view.diary'), :controller => 'diary_entry', :action => 'list', :display_name => @this_user.display_name %>
- |
<%= link_to t('user.view.comments'), :controller => 'diary_entry', :action => 'comments', :display_name => @this_user.display_name %>
|
- <%= link_to t('user.view.edits'), :controller => 'changeset', :action => 'list', :display_name => @this_user.display_name %>
- |
- <%= link_to t('user.view.traces'), :controller => 'trace', :action => 'list', :display_name => @this_user.display_name %>
- |
<% if @user and @user.is_friends_with?(@this_user) %>
<%= link_to t('user.view.remove as friend'), :controller => 'user', :action => 'remove_friend', :display_name => @this_user.display_name %>
<% else %>
--- /dev/null
+class AddCounterCaches < ActiveRecord::Migration
+ def self.up
+ add_column :users, :changesets_count, :integer, :null => false, :default => 0
+ add_column :users, :traces_count, :integer, :null => false, :default => 0
+
+ Changeset.group(:user_id).pluck(:user_id).each do |user_id|
+ User.reset_counters(user_id, :changesets)
+ end
+
+ Trace.group(:user_id).pluck(:user_id).each do |user_id|
+ User.reset_counters(user_id, :traces)
+ end
+ end
+
+ def self.down
+ remove_column :users, :changesets_count
+ remove_column :users, :traces_count
+ end
+end
CREATE TYPE format_enum AS ENUM (
'html',
- 'markdown',
- 'text'
+ 'markdown'
);
CREATE FUNCTION maptile_for_point(bigint, bigint, integer) RETURNS integer
LANGUAGE c STRICT
- AS '/srv/www/master.osm.compton.nu/db/functions/libpgosm.so', 'maptile_for_point';
+ AS '/srv/www/next.osm.compton.nu/db/functions/libpgosm.so', 'maptile_for_point';
--
CREATE FUNCTION tile_for_point(integer, integer) RETURNS bigint
LANGUAGE c STRICT
- AS '/srv/www/master.osm.compton.nu/db/functions/libpgosm.so', 'tile_for_point';
+ AS '/srv/www/next.osm.compton.nu/db/functions/libpgosm.so', 'tile_for_point';
--
CREATE FUNCTION xid_to_int4(xid) RETURNS integer
LANGUAGE c IMMUTABLE STRICT
- AS '/srv/www/master.osm.compton.nu/db/functions/libpgosm.so', 'xid_to_int4';
+ AS '/srv/www/next.osm.compton.nu/db/functions/libpgosm.so', 'xid_to_int4';
SET default_tablespace = '';
status user_status_enum DEFAULT 'pending'::user_status_enum NOT NULL,
terms_agreed timestamp without time zone,
consider_pd boolean DEFAULT false NOT NULL,
+ openid_url character varying(255),
preferred_editor character varying(255),
terms_seen boolean DEFAULT false NOT NULL,
- openid_url character varying(255),
+ image_fingerprint character varying(255),
description_format format_enum DEFAULT 'html'::format_enum NOT NULL,
- image_fingerprint character varying(255)
+ changesets_count integer DEFAULT 0 NOT NULL,
+ traces_count integer DEFAULT 0 NOT NULL
);
INSERT INTO schema_migrations (version) VALUES ('20120404205604');
+INSERT INTO schema_migrations (version) VALUES ('20120808231205');
+
INSERT INTO schema_migrations (version) VALUES ('21');
INSERT INTO schema_migrations (version) VALUES ('22');