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.
 
 
 
 
 

87 lines
1.9 KiB

  1. class LayersController < ApplicationController
  2. before_filter :require_login
  3. # GET /layers
  4. # GET /layers.json
  5. def index
  6. @layers = Layer.all
  7. respond_to do |format|
  8. format.html # index.html.erb
  9. format.json { render json: @layers }
  10. end
  11. end
  12. # GET /layers/1
  13. # GET /layers/1.json
  14. def show
  15. @layer = Layer.find(params[:id])
  16. @subscription = Subscription.new(:layer_id => @layer.id)
  17. respond_to do |format|
  18. format.html # show.html.erb
  19. format.json { render json: @layer }
  20. end
  21. end
  22. # GET /layers/new
  23. # GET /layers/new.json
  24. def new
  25. @layer = Layer.new
  26. respond_to do |format|
  27. format.html # new.html.erb
  28. format.json { render json: @layer }
  29. end
  30. end
  31. # GET /layers/1/edit
  32. def edit
  33. @layer = Layer.find(params[:id])
  34. end
  35. # POST /layers
  36. # POST /layers.json
  37. def create
  38. @layer = Layer.new(params[:layer])
  39. respond_to do |format|
  40. if @layer.save
  41. format.html { redirect_to @layer, notice: 'Layer was successfully created.' }
  42. format.json { render json: @layer, status: :created, location: @layer }
  43. else
  44. format.html { render action: "new" }
  45. format.json { render json: @layer.errors, status: :unprocessable_entity }
  46. end
  47. end
  48. end
  49. # PUT /layers/1
  50. # PUT /layers/1.json
  51. def update
  52. @layer = Layer.find(params[:id])
  53. respond_to do |format|
  54. if @layer.update_attributes(params[:layer])
  55. format.html { redirect_to @layer, notice: 'Layer was successfully updated.' }
  56. format.json { head :no_content }
  57. else
  58. format.html { render action: "edit" }
  59. format.json { render json: @layer.errors, status: :unprocessable_entity }
  60. end
  61. end
  62. end
  63. # DELETE /layers/1
  64. # DELETE /layers/1.json
  65. def destroy
  66. @layer = Layer.find(params[:id])
  67. @layer.destroy
  68. respond_to do |format|
  69. format.html { redirect_to layers_url }
  70. format.json { head :no_content }
  71. end
  72. end
  73. end