GeoRSS aggregator and Layar augmented reality server
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 
 
 

96 lignes
2.0 KiB

  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. @feed = Feed.new(params[:feed])
  38. respond_to do |format|
  39. if @feed.save
  40. format.html { redirect_to '/', notice: 'Feed added OK' }
  41. format.json { render json: @feed, status: :created, location: @feed }
  42. else
  43. format.html { render action: "new" }
  44. format.json { render json: @feed.errors, status: :unprocessable_entity }
  45. end
  46. end
  47. end
  48. # PUT /feeds/1
  49. # PUT /feeds/1.json
  50. def update
  51. @feed = Feed.find(params[:id])
  52. respond_to do |format|
  53. if @feed.update_attributes(params[:feed])
  54. format.html { redirect_to @feed, notice: 'Feed updated OK' }
  55. format.json { head :no_content }
  56. else
  57. format.html { render action: "edit" }
  58. format.json { render json: @feed.errors, status: :unprocessable_entity }
  59. end
  60. end
  61. end
  62. # DELETE /feeds/1
  63. # DELETE /feeds/1.json
  64. def destroy
  65. @feed = Feed.find(params[:id])
  66. @feed.destroy
  67. respond_to do |format|
  68. format.html { redirect_to feeds_url }
  69. format.json { head :no_content }
  70. end
  71. end
  72. def fetch
  73. @feed = Feed.find(params[:id])
  74. @feed.get
  75. redirect_to :back, notice: 'Feed fetched OK'
  76. end
  77. def fetch_all
  78. Feed.get_all
  79. redirect_to :back, notice: 'All feeds fetched OK'
  80. end
  81. end