Class: Muck::FeedsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/muck/feeds_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'app/controllers/muck/feeds_controller.rb', line 38

def create
  @feed = Feed.new(params[:feed])
  @feed.contributor = current_user # record the user that submitted the feed for auditing purposes
  @feed.harvested_from_display_uri = @feed.display_uri
  
  # setup the feed to be harvested
  @feed.entries_count = 0
  @feed.last_requested_at = 4.weeks.ago
  @feed.last_harvested_at = 4.weeks.ago

  # associate the parent if present
  @parent.feeds << @feed if @parent
  
  after_create_response(@feed.save)
end

#destroyObject



60
61
62
63
64
# File 'app/controllers/muck/feeds_controller.rb', line 60

def destroy
  @feed = Feed.find(params[:id])
  @feed.destroy
  after_destroy_response
end

#indexObject



7
8
9
10
11
12
13
# File 'app/controllers/muck/feeds_controller.rb', line 7

def index
  @feeds = Feed.valid.by_title.paginate(:page => @page, :per_page => @per_page)
  respond_to do |format|
    format.html { render :template => 'feeds/index' }
    format.xml  { render :xml => @feeds.to_xml }
  end
end

#newObject



26
27
28
29
30
# File 'app/controllers/muck/feeds_controller.rb', line 26

def new
  respond_to do |format|
    format.html { render :template => 'feeds/new', :layout => 'popup' }
  end
end

#new_extendedObject



32
33
34
35
36
# File 'app/controllers/muck/feeds_controller.rb', line 32

def new_extended
  respond_to do |format|
    format.html { render :template => 'feeds/new_extended', :layout => 'popup' }
  end
end

#showObject

pass layout=popup to remove most of the chrome



16
17
18
19
20
21
22
23
24
# File 'app/controllers/muck/feeds_controller.rb', line 16

def show
  @feed = Feed.find(params[:id])
  @entries = @feed.entries
  respond_to do |format|
    format.html { render :template => 'feeds/show', :layout => params[:layout] || true  }
    format.pjs { render :template => 'feeds/show', :layout => false }
    format.json { render :json => @feed.as_json }
  end
end

#updateObject



55
56
57
58
# File 'app/controllers/muck/feeds_controller.rb', line 55

def update
  @feed = Feed.find(params[:id])
  after_update_response(@feed.update_attributes(params[:feed]))
end