summaryrefslogtreecommitdiff
path: root/app/controllers/admin_controller.rb
diff options
context:
space:
mode:
authorerdgeist <erdgeist@erdgeist.org>2026-06-24 04:13:16 +0200
committererdgeist <erdgeist@erdgeist.org>2026-06-24 04:13:16 +0200
commite0a7e0fec760ba12c8067a37e10c96f1f05876e2 (patch)
treed0cf745592a46aee4d4913911fd34c7c24515220 /app/controllers/admin_controller.rb
parent6424e10be5a89f175a74c71c55660412a169b8b8 (diff)
Stage 1 complete: Rails 2.3.5 to Rails 3.2.22.5 upgrade
- Converted plugins to gems (Gemfile) - Updated config structure (application.rb, boot.rb, environment.rb) - Converted routes to Rails 3 DSL - Converted named_scope to scope throughout models - Converted find(:all, :conditions) to where() chains - Fixed has_many :order to use ordering scope - Updated session store and secret token configuration - Fixed exception_notification middleware configuration - Patched Ruby 2.4 / Rails 3.2 incompatibilities: - Integer/Float duration arithmetic (ActiveSupport) - Arel visit_Integer for PostgreSQL adapter - create_database String/Integer coercion - ActionController consider_all_requests_local - Migrated taggings schema for acts-as-taggable-on - Replaced dynamic_form gem with custom form_error_messages helper - Fixed Rails 3 block helper syntax (form_for, form_tag, fields_for) - Fixed admin layout yield - Updated test suite for Rails 3 APIs
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