From 0b58519b2177c4f4b22acb60648f0e9cad84018b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20de=20Villamil?= Date: Sat, 10 Aug 2013 22:18:07 +0200 Subject: [PATCH] More dashboard love. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit • 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 --- app/controllers/admin/dashboard_controller.rb | 6 ++---- app/views/admin/dashboard/_drafts.html.erb | 18 +++++++++++++++++ app/views/admin/dashboard/_popular.html.erb | 16 --------------- app/views/admin/dashboard/_posts.html.erb | 20 ------------------- app/views/admin/dashboard/index.html.erb | 3 +-- 5 files changed, 21 insertions(+), 42 deletions(-) create mode 100644 app/views/admin/dashboard/_drafts.html.erb delete mode 100644 app/views/admin/dashboard/_popular.html.erb delete mode 100644 app/views/admin/dashboard/_posts.html.erb diff --git a/app/controllers/admin/dashboard_controller.rb b/app/controllers/admin/dashboard_controller.rb index 4850337815..de41cd1d2e 100644 --- a/app/controllers/admin/dashboard_controller.rb +++ b/app/controllers/admin/dashboard_controller.rb @@ -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 @@ -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 diff --git a/app/views/admin/dashboard/_drafts.html.erb b/app/views/admin/dashboard/_drafts.html.erb new file mode 100644 index 0000000000..a7a1fe1dbc --- /dev/null +++ b/app/views/admin/dashboard/_drafts.html.erb @@ -0,0 +1,18 @@ +

<%= _("Your Drafts") %>

+
+ +
diff --git a/app/views/admin/dashboard/_popular.html.erb b/app/views/admin/dashboard/_popular.html.erb deleted file mode 100644 index dd3303e51e..0000000000 --- a/app/views/admin/dashboard/_popular.html.erb +++ /dev/null @@ -1,16 +0,0 @@ -

<%= _("Most popular") %>

-
- -
diff --git a/app/views/admin/dashboard/_posts.html.erb b/app/views/admin/dashboard/_posts.html.erb deleted file mode 100644 index 4a69f7d087..0000000000 --- a/app/views/admin/dashboard/_posts.html.erb +++ /dev/null @@ -1,20 +0,0 @@ -

<%= _("Latest Posts") %>

-
- -
diff --git a/app/views/admin/dashboard/index.html.erb b/app/views/admin/dashboard/index.html.erb index c307cecc1e..44fc2bdcc4 100644 --- a/app/views/admin/dashboard/index.html.erb +++ b/app/views/admin/dashboard/index.html.erb @@ -4,12 +4,11 @@
<%= render "welcome" %> <%= render "comments" %> - <%= render "popular" %>
+ <%= render "drafts" %> <%= render "inbound" %> - <%= render "posts" %> <%= render "publify_dev" %>