summaryrefslogtreecommitdiff
path: root/app/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/occurrences_controller.rb97
1 files changed, 0 insertions, 97 deletions
diff --git a/app/controllers/occurrences_controller.rb b/app/controllers/occurrences_controller.rb
deleted file mode 100644
index 2e3c2ec1..00000000
--- a/app/controllers/occurrences_controller.rb
+++ /dev/null
@@ -1,97 +0,0 @@
1class OccurrencesController < ApplicationController
2
3 # Private
4
5 before_action :login_required
6
7 # GET /occurrences
8 # GET /occurrences.xml
9 def index
10 @occurrences = Occurrence.all
11
12 respond_to do |format|
13 format.html # index.html.erb
14 format.xml { render :xml => @occurrences }
15 end
16 end
17
18 # GET /occurrences/1
19 # GET /occurrences/1.xml
20 def show
21 @occurrence = Occurrence.find(params[:id])
22
23 respond_to do |format|
24 format.html # show.html.erb
25 format.xml { render :xml => @occurrence }
26 end
27 end
28
29 # GET /occurrences/new
30 # GET /occurrences/new.xml
31 def new
32 @occurrence = Occurrence.new
33
34 respond_to do |format|
35 format.html # new.html.erb
36 format.xml { render :xml => @occurrence }
37 end
38 end
39
40 # GET /occurrences/1/edit
41 def edit
42 @occurrence = Occurrence.find(params[:id])
43 end
44
45 # POST /occurrences
46 # POST /occurrences.xml
47 def create
48 @occurrence = Occurrence.new(occurrence_params)
49
50 respond_to do |format|
51 if @occurrence.save
52 flash[:notice] = t("flash.occurrences.created")
53 format.html { redirect_to(@occurrence) }
54 format.xml { render :xml => @occurrence, :status => :created, :location => @occurrence }
55 else
56 format.html { render :action => "new" }
57 format.xml { render :xml => @occurrence.errors, :status => :unprocessable_entity }
58 end
59 end
60 end
61
62 # PUT /occurrences/1
63 # PUT /occurrences/1.xml
64 def update
65 @occurrence = Occurrence.find(params[:id])
66
67 respond_to do |format|
68 if @occurrence.update(occurrence_params)
69 flash[:notice] = t("flash.occurrences.updated")
70 format.html { redirect_to(@occurrence) }
71 format.xml { head :ok }
72 else
73 format.html { render :action => "edit" }
74 format.xml { render :xml => @occurrence.errors, :status => :unprocessable_entity }
75 end
76 end
77 end
78
79 # DELETE /occurrences/1
80 # DELETE /occurrences/1.xml
81 def destroy
82 @occurrence = Occurrence.find(params[:id])
83 @occurrence.destroy
84
85 respond_to do |format|
86 format.html { redirect_to(occurrences_url) }
87 format.xml { head :ok }
88 end
89 end
90
91 private
92
93 def occurrence_params
94 params.require(:occurrence).permit(:start_time, :end_time, :node_id, :event_id)
95 end
96
97end