GeoRSS aggregator and Layar augmented reality server
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

85 regels
1.8 KiB

  1. class FeedsController < ApplicationController
  2. before_filter :require_login
  3. # GET /feeds
  4. # GET /feeds.json
  5. def index
  6. @feed = Feed.new
  7. @feeds = Feed.all :order => :title
  8. respond_to do |format|
  9. format.html # index.html.erb
  10. format.json { render json: @feeds }
  11. end
  12. end
  13. # GET /feeds/1
  14. # GET /feeds/1.json
  15. def show
  16. @feed = Feed.find(params[:id])
  17. @posts = @feed.posts.order("published desc").paginate(:page => params[:page], :per_page => 20)
  18. respond_to do |format|
  19. format.html # show.html.erb
  20. format.json { render json: @feed }
  21. end
  22. end
  23. # GET /feeds/new
  24. # GET /feeds/new.json
  25. def new
  26. @feed = Feed.new
  27. respond_to do |format|
  28. format.html # new.html.erb
  29. format.json { render json: @feed }
  30. end
  31. end
  32. # GET /feeds/1/edit
  33. def edit
  34. @feed = Feed.find(params[:id])
  35. end
  36. # Feeds are created through the Subscriptions controller
  37. # PUT /feeds/1
  38. # PUT /feeds/1.json
  39. def update
  40. @feed = Feed.find(params[:id])
  41. respond_to do |format|
  42. if @feed.update_attributes(params[:feed])
  43. format.html { redirect_to @feed, notice: 'Feed updated OK' }
  44. format.json { head :no_content }
  45. else
  46. format.html { render action: "edit" }
  47. format.json { render json: @feed.errors, status: :unprocessable_entity }
  48. end
  49. end
  50. end
  51. # DELETE /feeds/1
  52. # DELETE /feeds/1.json
  53. def destroy
  54. @feed = Feed.find(params[:id])
  55. @feed.destroy
  56. respond_to do |format|
  57. format.html { redirect_to feeds_url, notice: 'Feed deleted OK' }
  58. format.json { head :no_content }
  59. end
  60. end
  61. def fetch
  62. @feed = Feed.find(params[:id])
  63. @feed.fetch
  64. redirect_to :back, notice: 'Feed fetched OK'
  65. end
  66. def fetch_all
  67. Feed.fetch_all
  68. redirect_to :back, notice: 'All feeds fetched OK'
  69. end
  70. end