public
Description: This contains various plugins for Feather
Clone URL: git://github.com/eldiablo/feather-plugins.git
Click here to lend your support to: feather-plugins and make a donation at www.pledgie.com !
commit  9411a6633461f5cef1de4c316e3221d168155943
tree    029553c9b0877c4a82c5104dff27e9d0df26b916
parent  bdb1bb8b25686c86a80d1d5da5a6377f08486814
100644 54 lines (45 sloc) 1.091 kb
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
module Admin
  class Redirects < Base
    include_plugin_views __FILE__
 
    before :find_redirect, :only => %w(edit update delete show)
 
    def index
      @redirects = Redirect.all
      display @redirects
    end
    
    def new
      @redirect = Redirect.new
      display @redirect
    end
    
    def create(redirect)
      redirect["permanent"] = (redirect["permanent"] == "0" ? false : true)
      @redirect = Redirect.new(redirect)
      if @redirect.save
        redirect url(:admin_redirect)
      else
        render :new
      end
    end
 
    def edit
      display @redirect
    end
    
    def update(redirect)
      redirect["permanent"] = (redirect["permanent"] == "0" ? false : true)
      if @redirect.update_attributes(redirect)
        redirect url(:admin_redirect, @redirect)
      else
        render :edit
      end
    end
    
    def delete
      @redirect.destroy!
      redirect url(:admin_redirects)
    end
    
    def show
      display @redirect
    end
 
    private
      def find_redirect
        @redirect = Redirect[params[:id]]
      end
  end
end