summaryrefslogtreecommitdiff
path: root/app/controllers/admin_controller.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/admin_controller.rb')
-rw-r--r--app/controllers/admin_controller.rb38
1 files changed, 14 insertions, 24 deletions
diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb
index f3cc221..18c4104 100644
--- a/app/controllers/admin_controller.rb
+++ b/app/controllers/admin_controller.rb
@@ -5,21 +5,15 @@ class AdminController < ApplicationController
5 before_filter :login_required 5 before_filter :login_required
6 6
7 def index 7 def index
8 @drafts = Node.all( 8 @drafts = Node.where("draft_id IS NOT NULL")
9 :limit => 50, 9 .limit(50).order("updated_at desc")
10 :order => "updated_at desc", 10
11 :conditions => ["draft_id IS NOT NULL"] 11 @drafts_count = Node.where("draft_id IS NOT NULL").count
12 ) 12
13 @drafts_count = Node.count( 13 @recent_changes = Node.where(
14 :conditions => ["draft_id IS NOT NULL"] 14 "updated_at < ? AND updated_at > ? AND parent_id IS NOT NULL",
15 ) 15 Time.now, Time.now - 14.days
16 @recent_changes = Node.all( 16 ).limit(50).order("updated_at desc")
17 :limit => 50,
18 :order => "updated_at desc",
19 :conditions => [
20 "updated_at < ? AND updated_at > ? AND parent_id IS NOT NULL", Time.now, Time.now-14.days
21 ]
22 )
23 17
24 all_nodes = Node.root.self_and_descendants 18 all_nodes = Node.root.self_and_descendants
25 @sitemap_depth = {} 19 @sitemap_depth = {}
@@ -28,16 +22,12 @@ class AdminController < ApplicationController
28 end 22 end
29 @sitemap = all_nodes.to_a.sort! { |node1,node2| node1.lft <=> node2.lft }.delete_if { |node| node.update? } 23 @sitemap = all_nodes.to_a.sort! { |node1,node2| node1.lft <=> node2.lft }.delete_if { |node| node.update? }
30 24
31 @mypages = Page.all( 25 @mypages = Page.where("user_id = ? or editor_id = ?", @current_user, @current_user)
32 :conditions => [ "user_id = ? or editor_id = ?", @current_user, @current_user]
33 )
34
35 @mynodes = Node.all(
36 :order => "updated_at desc",
37 :joins => :pages,
38 :conditions => [ "pages.user_id = ? or pages.editor_id = ?", @current_user, @current_user ]
39 ).uniq.first(50)
40 26
27 @mynodes = Node.joins(:pages)
28 .where("pages.user_id = ? or pages.editor_id = ?", @current_user, @current_user)
29 .order("updated_at desc")
30 .uniq.first(50)
41 end 31 end
42 32
43 def search 33 def search