From 3fa67447bbbe99ca45ff6e7b1d8d7183ddf2adc7 Mon Sep 17 00:00:00 2001 From: Kyle Drake Date: Tue, 16 Sep 2014 21:28:55 -0700 Subject: [PATCH] Show more tags, popular on top for autocomplete --- models/tag.rb | 2 +- views/browse.erb | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/models/tag.rb b/models/tag.rb index 58ffdb06..d06e9190 100644 --- a/models/tag.rb +++ b/models/tag.rb @@ -19,7 +19,7 @@ class Tag < Sequel::Model end def self.autocomplete(name, limit=3) - DB["select tags.name,count(*) as c from sites_tags inner join tags on tags.id=sites_tags.tag_id where tags.name != '' and tags.name LIKE ? group by tags.name having count(*) > 1 order by c desc LIMIT ?", name+'%', limit].all + DB["select tags.name,count(*) as c from sites_tags inner join tags on tags.id=sites_tags.tag_id inner join sites on sites.id=sites_tags.site_id where is_deleted='f' and is_banned='f' and is_crashing='f' and site_changed='t' and tags.name != '' and tags.name LIKE ? group by tags.name having count(*) > 1 order by c desc LIMIT ?", name+'%', limit].all end def self.popular_names(limit=10) diff --git a/views/browse.erb b/views/browse.erb index 1e5960c2..564ad1ad 100644 --- a/views/browse.erb +++ b/views/browse.erb @@ -70,7 +70,7 @@
- <%= site.title.shorten(35) %> + <%= site.title.shorten(30) %>
@@ -117,9 +117,9 @@ <% end %>