new action for intro page for new users
This commit is contained in:
15
app/assets/stylesheets/specific/explore.css.scss
Normal file
15
app/assets/stylesheets/specific/explore.css.scss
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,5 +7,10 @@ module Explore
|
|||||||
@posts = @post_set.posts
|
@posts = @post_set.posts
|
||||||
respond_with(@posts)
|
respond_with(@posts)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def intro
|
||||||
|
@presenter = IntroPresenter.new
|
||||||
|
render :layout => "blank"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
11
app/presenters/intro_presenter.rb
Normal file
11
app/presenters/intro_presenter.rb
Normal 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
|
||||||
21
app/views/explore/posts/intro.html.erb
Normal file
21
app/views/explore/posts/intro.html.erb
Normal 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>
|
||||||
@@ -40,6 +40,7 @@ Danbooru::Application.routes.draw do
|
|||||||
collection do
|
collection do
|
||||||
get :popular
|
get :popular
|
||||||
get :hot
|
get :hot
|
||||||
|
get :intro
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user