style tweaks

This commit is contained in:
albert
2012-04-20 18:01:09 -04:00
parent fcae4bc82e
commit ec97b6aaf9
5 changed files with 22 additions and 3 deletions

View File

@@ -438,5 +438,13 @@ class User < ActiveRecord::Base
def can_update?(object, foreign_key = :user_id)
is_moderator? || is_admin? || object.__send__(foreign_key) == id
end
def dmail_count
if has_mail?
"(#{dmails.unread.count})"
else
""
end
end
end

View File

@@ -2,7 +2,7 @@
<% if CurrentUser.user.is_anonymous? %>
<%= nav_link_to("Sign in", new_session_path, :class => "login") %>
<% else %>
<%= nav_link_to("My Account", user_path(CurrentUser.user)) %>
<%= nav_link_to("My Account #{CurrentUser.dmail_count}", user_path(CurrentUser.user)) %>
<% end %>
<%= nav_link_to("Posts", posts_path) %>
<%= nav_link_to("Comments", comments_path(:group_by => "post")) %>

View File

@@ -4,7 +4,7 @@
<li><%= link_to "Unfavorite", favorite_path(post), :remote => true, :method => :delete, :id => "remove-from-favorites" %></li>
<li><%= link_to "Pool", "#", :id => "pool" %></li>
<li><%= link_to "Translate", "#", :id => "translate", :title => "Shortcut is CTRL+N" %></li>
<li><%= link_to "Find similar", "http://danbooru.iqdb.org/db-search.php?url=#{post.preview_file_url}" %></li>
<li><%= link_to "Find similar", "http://danbooru.iqdb.org/db-search.php?url=http://#{Danbooru.config.hostname}#{post.preview_file_url}" %></li>
<% unless post.is_status_locked? %>
<% if !post.is_deleted? && !post.is_pending? %>

View File

@@ -10,7 +10,7 @@
<% if @user.id == CurrentUser.id %>
<li><%= link_to "Settings", edit_user_path(CurrentUser.user) %></li>
<li><%= link_to "Profile", user_path(CurrentUser.user) %></li>
<li><%= link_to "Messages (#{CurrentUser.dmails.unread.count})", dmails_path(:search => {:owner_id_eq => CurrentUser.id, :to_id_eq => CurrentUser.id}) %></li>
<li><%= link_to "Messages #{CurrentUser.dmail_count}", dmails_path(:search => {:owner_id_eq => CurrentUser.id, :to_id_eq => CurrentUser.id}) %></li>
<% else %>
<li><%= link_to "Send message", new_dmail_path(:dmail => {:to_id => @user.id}) %></li>
<% end %>

11
script/trim.sql Normal file
View File

@@ -0,0 +1,11 @@
set statement_timeout = 0;
delete from posts where id < 1000000;
delete from comments where post_id < 1000000;
delete from favorites where post_id < 1000000;
delete from flagged_post_details where post_id < 1000000;
delete from note_versions where post_id < 1000000;
delete from notes where post_id < 1000000;
delete from pools_posts where post_id < 1000000;
delete from post_appeals where post_id < 1000000;
delete from post_tag_histories where post_id < 1000000;
delete from post_votes where post_id < 1000000;