new action for intro page for new users

This commit is contained in:
r888888888 2013-06-17 13:15:52 -07:00
parent ec56d7abc9
commit 90e90e8be2
5 changed files with 53 additions and 0 deletions

View File

@ -0,0 +1,15 @@
div#c-explore-posts {
header {
text-align: center;
h1 {
font-size: 3em;
}
}
div.posts {
padding: 1em;
margin-bottom: 2em;
background: #EEF;
}
}

View File

@ -7,5 +7,10 @@ module Explore
@posts = @post_set.posts
respond_with(@posts)
end
def intro
@presenter = IntroPresenter.new
render :layout => "blank"
end
end
end

View File

@ -0,0 +1,11 @@
class IntroPresenter
def popular_tags
Tag.order("post_count desc").limit(8).map(&:name)
end
def each
popular_tags.each do |tag|
yield(tag, PostSets::Post.new(tag, 1, 6))
end
end
end

View File

@ -0,0 +1,21 @@
<div id="c-explore-posts">
<div id="a-intro">
<header>
<h1>Danbooru</h1>
<p class="byline">Find good anime art fast</p>
<%= form_tag(posts_path, :method => :get) do %>
<%= text_field_tag "tags", "", :size => 50 %>
<%= submit_tag "Search" %>
<% end %>
</header>
<% @presenter.each do |tag, post_set| %>
<div class="posts">
<h2><%= link_to tag, posts_path(:tags => tag) %></h2>
<%= post_set.presenter.post_previews_html(self) %>
<div class="clearfix"></div>
</div>
<% end %>
</div>
</div>

View File

@ -40,6 +40,7 @@ Danbooru::Application.routes.draw do
collection do
get :popular
get :hot
get :intro
end
end
end