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 години
преди 11 години
преди 12 години
преди 12 години
преди 12 години
преди 12 години
преди 11 години
преди 12 години
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. # Feeds are never deleted. They're always retained in the DB.
  52. def fetch
  53. @feed = Feed.find(params[:id])
  54. @feed.fetch
  55. redirect_to :back, notice: 'Feed fetched OK'
  56. end
  57. def fetch_all
  58. Feed.fetch_all
  59. redirect_to :back, notice: 'All feeds fetched OK'
  60. end
  61. end