Skip to content

Commit

Permalink
More dashboard love.
Browse files Browse the repository at this point in the history
• Removes the best of widget.
• Reduces the last posts from Publify blog from 5 to 3.
• Displays the user's drafts instead of the lastest blog posts.
• Moves the drafts up and the inbound links down
  • Loading branch information
Frédéric de Villamil committed Aug 10, 2013
1 parent 0f3a357 commit 0b58519
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 42 deletions.
6 changes: 2 additions & 4 deletions app/controllers/admin/dashboard_controller.rb
Expand Up @@ -17,15 +17,13 @@ def index
@statspages = Page.where("published_at > ?", today).count
@statuses = Status.where("published_at > ?", today).count
@statuserposts = Article.published.where("published_at > ?", today).count(conditions: {user_id: current_user.id})

@statcomments = Comment.where("created_at > ?", today).count
@presumedspam = Comment.presumed_spam.where("created_at > ?", today).count
@confirmed = Comment.ham.where("created_at > ?", today).count
@unconfirmed = Comment.unconfirmed.where("created_at > ?", today).count

@comments = Comment.last_published
@recent_posts = Article.published.limit(5)
@bestof = Article.bestof
@drafts = Article.drafts.where("user_id = ?", current_user.id).limit(5)

@statspam = Comment.spam.count
@inbound_links = inbound_links
Expand Down Expand Up @@ -65,7 +63,7 @@ def inbound_links

def publify_dev
url = "http://blog.publify.co/articles.rss"
parse(url)[0..4]
parse(url)[0..2]
end


Expand Down
18 changes: 18 additions & 0 deletions app/views/admin/dashboard/_drafts.html.erb
@@ -0,0 +1,18 @@
<h3><%= _("Your Drafts") %></h3>
<div class='well'>
<ul class='unstyled'>
<% if @drafts.size == 0 %>
<li class='alert'>
<%= link_to _("No drafts yet, why don't you start and write one"), :controller => 'content', :action => 'new' %> ?
</li>
<% else %>
<% for post in @drafts -%>
<li>
<h5><%= link_to(post.title, :controller => "admin/content", :action => "edit", :id => post.id) %> <%= display_date_and_time(post.created_at) %></h5>
<p><%= post.body.strip_html.slice(0,300) if post.body %></p>
<hr />
</li>
<% end %>
<% end %>
</ul>
</div>
16 changes: 0 additions & 16 deletions app/views/admin/dashboard/_popular.html.erb

This file was deleted.

20 changes: 0 additions & 20 deletions app/views/admin/dashboard/_posts.html.erb

This file was deleted.

3 changes: 1 addition & 2 deletions app/views/admin/dashboard/index.html.erb
Expand Up @@ -4,12 +4,11 @@
<div class='span6'>
<%= render "welcome" %>
<%= render "comments" %>
<%= render "popular" %>
</div>

<div class='span6'>
<%= render "drafts" %>
<%= render "inbound" %>
<%= render "posts" %>
<%= render "publify_dev" %>
</div>

Expand Down

0 comments on commit 0b58519

Please sign in to comment.