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.

преди 12 години
преди 12 години
преди 12 години
преди 12 години
преди 12 години
преди 12 години
преди 12 години
преди 12 години
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. class FeedsController < ApplicationController
  2. # GET /feeds
  3. # GET /feeds.json
  4. def index
  5. @feed = Feed.new
  6. @feeds = Feed.all :order => :title
  7. respond_to do |format|
  8. format.html # index.html.erb
  9. format.json { render json: @feeds }
  10. end
  11. end
  12. # GET /feeds/1
  13. # GET /feeds/1.json
  14. def show
  15. @feed = Feed.find(params[:id])
  16. respond_to do |format|
  17. format.html # show.html.erb
  18. format.json { render json: @feed }
  19. end
  20. end
  21. # GET /feeds/new
  22. # GET /feeds/new.json
  23. def new
  24. @feed = Feed.new
  25. respond_to do |format|
  26. format.html # new.html.erb
  27. format.json { render json: @feed }
  28. end
  29. end
  30. # GET /feeds/1/edit
  31. def edit
  32. @feed = Feed.find(params[:id])
  33. end
  34. # POST /feeds
  35. # POST /feeds.json
  36. def create
  37. begin
  38. @feed = Feed.new(params[:feed])
  39. rescue
  40. redirect_to '/', error: "Feed didn't parse. Please check it with the validator."
  41. end
  42. respond_to do |format|
  43. if @feed.save
  44. format.html { redirect_to '/', notice: 'Feed added OK' }
  45. format.json { render json: @feed, status: :created, location: @feed }
  46. else
  47. format.html { render action: "new" }
  48. format.json { render json: @feed.errors, status: :unprocessable_entity }
  49. end
  50. end
  51. end
  52. # PUT /feeds/1
  53. # PUT /feeds/1.json
  54. def update
  55. @feed = Feed.find(params[:id])
  56. respond_to do |format|
  57. if @feed.update_attributes(params[:feed])
  58. format.html { redirect_to @feed, notice: 'Feed updated OK' }
  59. format.json { head :no_content }
  60. else
  61. format.html { render action: "edit" }
  62. format.json { render json: @feed.errors, status: :unprocessable_entity }
  63. end
  64. end
  65. end
  66. # DELETE /feeds/1
  67. # DELETE /feeds/1.json
  68. def destroy
  69. @feed = Feed.find(params[:id])
  70. @feed.destroy
  71. respond_to do |format|
  72. format.html { redirect_to feeds_url }
  73. format.json { head :no_content }
  74. end
  75. end
  76. def fetch
  77. @feed = Feed.find(params[:id])
  78. @feed.get
  79. redirect_to :back, notice: 'Feed fetched OK'
  80. end
  81. def fetch_all
  82. Feed.get_all
  83. redirect_to :back, notice: 'All feeds fetched OK'
  84. end
  85. end