diff --git a/Procfile b/Procfile index 0fe2ce1c7..5a2f07d60 100644 --- a/Procfile +++ b/Procfile @@ -1,2 +1,2 @@ -unicorn: bundle exec unicorn -c config/unicorn/unicorn.rb +unicorn: bundle exec rails server jobs: bundle exec script/delayed_job run diff --git a/app/assets/javascripts/posts.js b/app/assets/javascripts/posts.js index 09a8b77b3..a06f9aa34 100644 --- a/app/assets/javascripts/posts.js +++ b/app/assets/javascripts/posts.js @@ -548,7 +548,7 @@ method: "get", success: function(data) { resp($.map(data, function(saved_search) { - var category = saved_search.category === null ? "Uncategorized" : saved_search.category; + var category = saved_search.category === null ? "uncategorized" : saved_search.category; return { label: category, value: category diff --git a/app/assets/stylesheets/specific/saved_searches.css.scss b/app/assets/stylesheets/specific/saved_searches.css.scss new file mode 100644 index 000000000..0cd98bc84 --- /dev/null +++ b/app/assets/stylesheets/specific/saved_searches.css.scss @@ -0,0 +1,7 @@ +#c-saved-searches { + #a-index { + table { + margin-bottom: 2em; + } + } +} \ No newline at end of file diff --git a/app/models/saved_search.rb b/app/models/saved_search.rb index 4b2dba0d5..2e552557a 100644 --- a/app/models/saved_search.rb +++ b/app/models/saved_search.rb @@ -1,5 +1,5 @@ class SavedSearch < ActiveRecord::Base - UNCATEGORIZED_NAME = "Uncategorized" + UNCATEGORIZED_NAME = "uncategorized" module ListbooruMethods extend ActiveSupport::Concern @@ -57,9 +57,15 @@ class SavedSearch < ActiveRecord::Base body = Cache.get("ss-pids-#{user_id}-#{hash_name}", 60) do params = { "key" => Danbooru.config.listbooru_auth_key, - "user_id" => user_id, - "name" => name + "user_id" => user_id } + + if name == UNCATEGORIZED_NAME + params["name"] = nil + elsif name.present? + params["name"] = name + end + uri = URI.parse("#{Danbooru.config.listbooru_server}/users") uri.query = URI.encode_www_form(params) @@ -133,7 +139,13 @@ class SavedSearch < ActiveRecord::Base end def self.categories_for(user) - user.saved_searches.pluck("distinct category") + user.saved_searches.pluck("distinct category").map do |x| + if x.blank? + SavedSearch::UNCATEGORIZED_NAME + else + x + end + end end def normalize diff --git a/app/presenters/post_set_presenters/post.rb b/app/presenters/post_set_presenters/post.rb index 8f26d3ef3..e3b600f01 100644 --- a/app/presenters/post_set_presenters/post.rb +++ b/app/presenters/post_set_presenters/post.rb @@ -11,6 +11,8 @@ module PostSetPresenters def related_tags if post_set.is_pattern_search? pattern_tags + elsif post_set.is_saved_search? + SavedSearch.categories_for(CurrentUser.user).map {|x| "search:#{x}"} elsif post_set.is_tag_subscription? post_set.tag_subscription_tags elsif post_set.is_single_tag? @@ -59,6 +61,10 @@ module PostSetPresenters end def tag_list_html(template, options = {}) + if post_set.is_saved_search? + options[:name_only] = true + end + tag_set_presenter.tag_list_html(template, options) end end diff --git a/app/views/saved_searches/index.html.erb b/app/views/saved_searches/index.html.erb index b09bb8e34..6a37c837c 100644 --- a/app/views/saved_searches/index.html.erb +++ b/app/views/saved_searches/index.html.erb @@ -8,7 +8,7 @@ <%= link_to_if SavedSearch.posts_search_available?, category.tr("_", " "), posts_path(:tags => "search:#{category}") %> (<%= link_to "rename", new_saved_search_category_change_path(:old => category) %>) <% else %> - <%= link_to_if SavedSearch.posts_search_available?, SavedSearch::UNCATEGORIZED_NAME, posts_path(:tags => "search:all") %> + <%= link_to_if SavedSearch.posts_search_available?, SavedSearch::UNCATEGORIZED_NAME, posts_path(:tags => "search:#{SavedSearch::UNCATEGORIZED_NAME}") %> <% end %>