GeoRSS aggregator and Layar augmented reality server
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 
 
 
 

98 Zeilen
2.1 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. respond_to do |format|
  18. format.html # show.html.erb
  19. format.json { render json: @feed }
  20. end
  21. end
  22. # GET /feeds/new
  23. # GET /feeds/new.json
  24. def new
  25. @feed = Feed.new
  26. respond_to do |format|
  27. format.html # new.html.erb
  28. format.json { render json: @feed }
  29. end
  30. end
  31. # GET /feeds/1/edit
  32. def edit
  33. @feed = Feed.find(params[:id])
  34. end
  35. # POST /feeds
  36. # POST /feeds.json
  37. def create
  38. @feed = Feed.new(params[:feed])
  39. respond_to do |format|
  40. if @feed.save
  41. format.html { redirect_to '/', notice: 'Feed added OK' }
  42. format.json { render json: @feed, status: :created, location: @feed }
  43. else
  44. format.html { render action: "new" }
  45. format.json { render json: @feed.errors, status: :unprocessable_entity }
  46. end
  47. end
  48. end
  49. # PUT /feeds/1
  50. # PUT /feeds/1.json
  51. def update
  52. @feed = Feed.find(params[:id])
  53. respond_to do |format|
  54. if @feed.update_attributes(params[:feed])
  55. format.html { redirect_to @feed, notice: 'Feed updated OK' }
  56. format.json { head :no_content }
  57. else
  58. format.html { render action: "edit" }
  59. format.json { render json: @feed.errors, status: :unprocessable_entity }
  60. end
  61. end
  62. end
  63. # DELETE /feeds/1
  64. # DELETE /feeds/1.json
  65. def destroy
  66. @feed = Feed.find(params[:id])
  67. @feed.destroy
  68. respond_to do |format|
  69. format.html { redirect_to feeds_url }
  70. format.json { head :no_content }
  71. end
  72. end
  73. def fetch
  74. @feed = Feed.find(params[:id])
  75. @feed.get
  76. redirect_to :back, notice: 'Feed fetched OK'
  77. end
  78. def fetch_all
  79. Feed.get_all
  80. redirect_to :back, notice: 'All feeds fetched OK'
  81. end
  82. end