Class: Admin::Muck::FeedsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Admin::Muck::FeedsController
- Defined in:
- app/controllers/admin/muck/feeds_controller.rb
Instance Method Summary collapse
-
#ban ⇒ Object
GET /feeds/1;ban.
-
#create ⇒ Object
POST /feeds POST /feeds.xml.
-
#edit ⇒ Object
GET /feeds/1;edit.
- #entries ⇒ Object
-
#index ⇒ Object
GET /feeds GET /feeds.xml.
-
#new ⇒ Object
GET /feeds/new.
-
#selection_list ⇒ Object
GET /feeds/selection_list.
-
#show ⇒ Object
GET /feeds/1 GET /feeds/1.xml.
-
#unban ⇒ Object
GET /feeds/1;unban.
-
#update ⇒ Object
PUT /feeds/1 PUT /feeds/1.xml.
Instance Method Details
#ban ⇒ Object
GET /feeds/1;ban
67 68 69 70 71 72 73 74 |
# File 'app/controllers/admin/muck/feeds_controller.rb', line 67 def ban @feed = Feed.find(params[:id]) @feed.entries.destroy_all @feed.status = -1 @feed.save! #redirect_to feeds_path redirect_to "/feeds" end |
#create ⇒ Object
POST /feeds POST /feeds.xml
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 |
# File 'app/controllers/admin/muck/feeds_controller.rb', line 113 def create @feed = Feed.new(params[:feed]) @feed.harvested_from_display_uri = @feed.display_uri @feed.entries_count = 0 @feed.last_requested_at = Time.now - 2592000 @feed.last_harvested_at = Time.now - 2592000 respond_to do |format| if @feed.save flash[:notice] = 'Feed was successfully created.' # email the admin to let them know a feed has been added # notification_feed_added(@feed) # redirect to a page letting them know the feed has been created #format.html { redirect_to entries_path(@feed) + "?new_feed=true" } format.html { redirect_to "/feeds/" } format.xml { head :created, :location => feed_url(@feed) } else format.html { render :action => "new" } format.xml { render :xml => @feed.errors.to_xml } end end end |
#edit ⇒ Object
GET /feeds/1;edit
51 52 53 54 |
# File 'app/controllers/admin/muck/feeds_controller.rb', line 51 def edit @feed = Feed.find(params[:id]) render :layout => "default" end |
#entries ⇒ Object
19 20 21 22 23 24 25 26 27 28 |
# File 'app/controllers/admin/muck/feeds_controller.rb', line 19 def entries @new_feed = params[:new_feed] @feed = Feed.find(params[:id]) @courses = @feed.entries.find(:all, :order => "title") respond_to do |format| format.html { render :partial => "courses", :layout => "default" } format.xml { render :xml => @courses.to_xml } end end |
#index ⇒ Object
GET /feeds GET /feeds.xml
9 10 11 12 13 14 15 16 17 |
# File 'app/controllers/admin/muck/feeds_controller.rb', line 9 def index @feeds = Feed.find(:all, :conditions => "status >= 0", :order => "title") @banned_feeds = Feed.find(:all, :conditions => "status < 0", :order => "title") respond_to do |format| format.html # index.rhtml format.xml { render :xml => @feeds.to_xml } end end |
#new ⇒ Object
GET /feeds/new
43 44 45 46 47 48 |
# File 'app/controllers/admin/muck/feeds_controller.rb', line 43 def new @no_follow = true @feeds = Feed.find(:all, :conditions => "status >= 0", :order => "title") @feed = Feed.new render :layout => "default" end |
#selection_list ⇒ Object
GET /feeds/selection_list
31 32 33 34 |
# File 'app/controllers/admin/muck/feeds_controller.rb', line 31 def selection_list @feeds = Feed.find(:all, :order => "short_title") render :partial => "feed_selection", :collection => @feeds, :layout => false end |
#show ⇒ Object
GET /feeds/1 GET /feeds/1.xml
38 39 40 |
# File 'app/controllers/admin/muck/feeds_controller.rb', line 38 def show redirect_to "/feeds/" + params[:id] + "/entries" end |
#unban ⇒ Object
GET /feeds/1;unban
77 78 79 80 81 82 83 84 85 |
# File 'app/controllers/admin/muck/feeds_controller.rb', line 77 def unban @feed = Feed.find(params[:id]) @feed.unban = true @feed.status = 0 @feed.refreshed_at = "2001" @feed.save! #redirect_to feeds_path redirect_to "/feeds" end |
#update ⇒ Object
PUT /feeds/1 PUT /feeds/1.xml
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 |
# File 'app/controllers/admin/muck/feeds_controller.rb', line 140 def update @feed = Feed.find(params[:id]) # force a harvest now # harvest_now respond_to do |format| if @feed.update_attributes(params[:feed]) # notification_feed_updated(@feed) flash[:notice] = 'Feed was successfully updated.' format.html { redirect_to "/feeds/" return } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @feed.errors.to_xml } end end end |