Fix #3694: Favgroup UX issues.

This commit is contained in:
evazion
2018-05-03 00:52:36 -05:00
parent 12a8c0db70
commit 96669ca4b5
3 changed files with 4 additions and 7 deletions

View File

@@ -38,7 +38,7 @@
}
Danbooru.FavoriteGroup.add_to_favgroup = function(e) {
var favgroup_index = String.fromCharCode(e.which);
var favgroup_index = (e.key === "0") ? "10" : e.key;
var link = $("#add-to-favgroup-" + favgroup_index + ":visible");
if (link.length) {
link.click();

View File

@@ -42,7 +42,7 @@ class FavoriteGroup < ApplicationRecord
end
def default_order
order(updated_at: :desc)
order(name: :asc)
end
def search(params)

View File

@@ -104,6 +104,7 @@ class User < ApplicationRecord
has_many :saved_searches
has_many :forum_posts, lambda {order("forum_posts.created_at, forum_posts.id")}, :foreign_key => "creator_id"
has_many :user_name_change_requests, lambda {visible.order("user_name_change_requests.created_at desc")}
has_many :favorite_groups, lambda {order(name: :asc)}, foreign_key: :creator_id
belongs_to :inviter, class_name: "User", optional: true
after_update :create_mod_action
accepts_nested_attributes_for :dmail_filter
@@ -305,10 +306,6 @@ class User < ApplicationRecord
def remove_favorite!(post)
Favorite.remove(post: post, user: self)
end
def favorite_groups
FavoriteGroup.for_creator(CurrentUser.user.id).order("updated_at desc")
end
end
module LevelMethods
@@ -753,7 +750,7 @@ class User < ApplicationRecord
end
def favorite_group_count
FavoriteGroup.for_creator(id).count
favorite_groups.count
end
def appeal_count