summaryrefslogtreecommitdiff
path: root/app/controllers/admin_controller.rb
blob: 517506fe37cb23bb9a99f2550c11cd2a7f0fd336 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
class AdminController < ApplicationController
  before_filter :login_required

  def index
    @drafts = Page.drafts
    @recent_changes = Node.all(
      :limit => 50,
      :order => "updated_at desc",
      :conditions => [ 
        "updated_at < ? AND updated_at > ?", Time.now, Time.now-14.days
      ]
    )
  end
  
  def search
    @results = Node.search params[:search_term]
    
    respond_to do |format|
      format.html
      format.js do 
        render( :json => @results.map do |node| 
          {:id => node.id, :title => node.title, :edit_path => node_path(node)} 
          end
        )
        
      end 
    end
  end
  
end