diff --git a/app/controllers/artists_controller.rb b/app/controllers/artists_controller.rb index 4c707cf73..383c0cb7b 100644 --- a/app/controllers/artists_controller.rb +++ b/app/controllers/artists_controller.rb @@ -44,7 +44,6 @@ class ArtistsController < ApplicationController def show @current_item = @artist = Artist.find(params[:id]) - @post_set = PostSets::Artist.new(@artist) respond_with(@artist) end @@ -80,7 +79,6 @@ class ArtistsController < ApplicationController redirect_to artist_path(@artist) else @artist = Artist.new(name: params[:name]) - @post_set = PostSets::Artist.new(@artist) respond_with(@artist) end end diff --git a/app/logical/post_sets/artist.rb b/app/logical/post_sets/artist.rb deleted file mode 100644 index 6a2180407..000000000 --- a/app/logical/post_sets/artist.rb +++ /dev/null @@ -1,24 +0,0 @@ -module PostSets - class Artist < PostSets::Post - attr_reader :artist - - def initialize(artist) - super(artist.name) - @artist = artist - end - - def posts - @posts ||= begin - query = ::Post.tag_match(@artist.name).where("true /* PostSets::Artist#posts */").limit(10) - query.each # hack to force rails to eager load - query - end - rescue ::Post::SearchError - ::Post.none - end - - def presenter - ::PostSetPresenters::Post.new(self) - end - end -end diff --git a/app/views/artists/_show.html.erb b/app/views/artists/_show.html.erb index 225660b82..51f10f012 100644 --- a/app/views/artists/_show.html.erb +++ b/app/views/artists/_show.html.erb @@ -12,15 +12,17 @@ <%= yield %> -
-

Recent Posts

+ <% if @artist.tag.present? && @artist.tag.post_count > 0 %> +
+

Recent Posts <%= link_to "ยป", posts_path(tags: @artist.name) %>

- <%= render "posts/partials/common/inline_blacklist" %> + <%= render "posts/partials/common/inline_blacklist" %> -
- <%= @post_set.presenter.post_previews_html(self) %> +
+ <%= post_previews_html(@artist.tag.posts.limit(8), tags: @artist.name) %> +
-
+ <% end %>