diff options
Diffstat (limited to 'app/controllers/admin_controller.rb')
| -rw-r--r-- | app/controllers/admin_controller.rb | 21 |
1 files changed, 2 insertions, 19 deletions
diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index 8445997..37fd78b 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb | |||
| @@ -5,25 +5,8 @@ class AdminController < ApplicationController | |||
| 5 | before_action :login_required | 5 | before_action :login_required |
| 6 | 6 | ||
| 7 | def index | 7 | def index |
| 8 | @drafts = Node.where("draft_id IS NOT NULL OR autosave_id IS NOT NULL") | 8 | @drafts = Node.drafts_and_autosaves(current_user_id: current_user.id).limit(5) |
| 9 | .limit(50).order("updated_at desc") | 9 | @recent_changes = Node.recently_changed.limit(5) |
| 10 | |||
| 11 | @drafts_count = Node.where("draft_id IS NOT NULL OR autosave_id IS NOT NULL").count | ||
| 12 | |||
| 13 | @recent_changes = Node.where( | ||
| 14 | "updated_at < ? AND updated_at > ? AND parent_id IS NOT NULL", | ||
| 15 | Time.now, Time.now - 14.days | ||
| 16 | ).limit(50).order("updated_at desc") | ||
| 17 | |||
| 18 | ordered_with_level = Node.root.self_and_descendants_ordered_with_level | ||
| 19 | @sitemap_depth = {} | ||
| 20 | ordered_with_level.each { |node, level| @sitemap_depth[node.id] = level } | ||
| 21 | @sitemap = ordered_with_level.map(&:first).reject(&:update?) | ||
| 22 | |||
| 23 | @mynodes = Node.joins(:pages) | ||
| 24 | .where("pages.user_id = ? or pages.editor_id = ?", current_user, current_user) | ||
| 25 | .order("updated_at desc") | ||
| 26 | .distinct.first(50) | ||
| 27 | end | 10 | end |
| 28 | 11 | ||
| 29 | def conventions | 12 | def conventions |
