summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorerdgeist <erdgeist@erdgeist.org>2026-07-25 17:29:35 +0200
committererdgeist <erdgeist@erdgeist.org>2026-07-25 17:29:35 +0200
commit22c690749e154a5426c4f190fbbc08a5dee2eeee (patch)
tree4c3b9f7d1b79d5862a9729c45b7e31035f81957a
parentb7dee77cd1dd6f70e3bfa55df8b61681e9db321e (diff)
Retire the unroutable occurrences scaffolding
-rw-r--r--app/controllers/occurrences_controller.rb97
-rw-r--r--app/helpers/occurrences_helper.rb2
-rw-r--r--app/views/layouts/occurrences.html.erb17
-rw-r--r--app/views/occurrences/edit.html.erb32
-rw-r--r--app/views/occurrences/index.html.erb30
-rw-r--r--app/views/occurrences/new.html.erb31
-rw-r--r--app/views/occurrences/show.html.erb28
-rw-r--r--test/controllers/occurrences_controller_test.rb45
8 files changed, 0 insertions, 282 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
diff --git a/app/helpers/occurrences_helper.rb b/app/helpers/occurrences_helper.rb
deleted file mode 100644
index 8cba8817..00000000
--- a/app/helpers/occurrences_helper.rb
+++ /dev/null
@@ -1,2 +0,0 @@
1module OccurrencesHelper
2end
diff --git a/app/views/layouts/occurrences.html.erb b/app/views/layouts/occurrences.html.erb
deleted file mode 100644
index ab4aca63..00000000
--- a/app/views/layouts/occurrences.html.erb
+++ /dev/null
@@ -1,17 +0,0 @@
1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
4<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5<head>
6 <meta http-equiv="content-type" content="text/html;charset=UTF-8" />
7 <title>Occurrences: <%= controller.action_name %></title>
8 <%= stylesheet_link_tag 'scaffold' %>
9</head>
10<body>
11
12<p style="color: green"><%= flash[:notice] %></p>
13
14<%= yield %>
15
16</body>
17</html>
diff --git a/app/views/occurrences/edit.html.erb b/app/views/occurrences/edit.html.erb
deleted file mode 100644
index aa4f6e07..00000000
--- a/app/views/occurrences/edit.html.erb
+++ /dev/null
@@ -1,32 +0,0 @@
1<h1>Editing occurrence</h1>
2
3<%= form_for(@occurrence) do |f| %>
4 <%= form_error_messages(f) %>
5
6 <p>
7 <%= f.label :summary %><br />
8 <%= f.text_field :summary %>
9 </p>
10 <p>
11 <%= f.label :start_time %><br />
12 <%= f.datetime_select :start_time %>
13 </p>
14 <p>
15 <%= f.label :end_time %><br />
16 <%= f.datetime_select :end_time %>
17 </p>
18 <p>
19 <%= f.label :node_id %><br />
20 <%= f.text_field :node_id %>
21 </p>
22 <p>
23 <%= f.label :event_id %><br />
24 <%= f.text_field :event_id %>
25 </p>
26 <p>
27 <%= f.submit 'Update' %>
28 </p>
29<% end %>
30
31<%= link_to 'Show', @occurrence %> |
32<%= link_to 'Back', occurrences_path %>
diff --git a/app/views/occurrences/index.html.erb b/app/views/occurrences/index.html.erb
deleted file mode 100644
index aa084ed9..00000000
--- a/app/views/occurrences/index.html.erb
+++ /dev/null
@@ -1,30 +0,0 @@
1<h1>Occurrences</h1>
2
3<table>
4 <tr>
5 <th>Summary</th>
6 <th>Start time</th>
7 <th>End time</th>
8 <th>Node</th>
9 <th>Event</th>
10 </tr>
11
12<% @occurrences.each do |occurrence| %>
13 <tr>
14 <td><%=h occurrence.summary %></td>
15 <td><%=h occurrence.start_time %></td>
16 <td><%=h occurrence.end_time %></td>
17 <td><%=h occurrence.node_id %></td>
18 <td><%=h occurrence.event_id %></td>
19 <td><%= link_to 'Show', occurrence %></td>
20 <td><%= link_to 'Edit', edit_occurrence_path(occurrence) %></td>
21 <td><%= button_to occurrence, method: :delete, form: { data: { confirm: 'Are you sure?' }, class: 'button_to destructive' } do %>
22 <%= icon("trash", library: "tabler", "aria-hidden": true) %> Destroy
23 <% end %></td>
24 </tr>
25<% end %>
26</table>
27
28<br />
29
30<%= link_to 'New occurrence', new_occurrence_path %>
diff --git a/app/views/occurrences/new.html.erb b/app/views/occurrences/new.html.erb
deleted file mode 100644
index c05ce400..00000000
--- a/app/views/occurrences/new.html.erb
+++ /dev/null
@@ -1,31 +0,0 @@
1<h1>New occurrence</h1>
2
3<%= form_for(@occurrence) do |f| %>
4 <%= form_error_messages(f) %>
5
6 <p>
7 <%= f.label :summary %><br />
8 <%= f.text_field :summary %>
9 </p>
10 <p>
11 <%= f.label :start_time %><br />
12 <%= f.datetime_select :start_time %>
13 </p>
14 <p>
15 <%= f.label :end_time %><br />
16 <%= f.datetime_select :end_time %>
17 </p>
18 <p>
19 <%= f.label :node_id %><br />
20 <%= f.text_field :node_id %>
21 </p>
22 <p>
23 <%= f.label :event_id %><br />
24 <%= f.text_field :event_id %>
25 </p>
26 <p>
27 <%= f.submit 'Create' %>
28 </p>
29<% end %>
30
31<%= link_to 'Back', occurrences_path %>
diff --git a/app/views/occurrences/show.html.erb b/app/views/occurrences/show.html.erb
deleted file mode 100644
index 9e831cf3..00000000
--- a/app/views/occurrences/show.html.erb
+++ /dev/null
@@ -1,28 +0,0 @@
1<p>
2 <b>Summary:</b>
3 <%=h @occurrence.summary %>
4</p>
5
6<p>
7 <b>Start time:</b>
8 <%=h @occurrence.start_time %>
9</p>
10
11<p>
12 <b>End time:</b>
13 <%=h @occurrence.end_time %>
14</p>
15
16<p>
17 <b>Node:</b>
18 <%=h @occurrence.node_id %>
19</p>
20
21<p>
22 <b>Event:</b>
23 <%=h @occurrence.event_id %>
24</p>
25
26
27<%= link_to 'Edit', edit_occurrence_path(@occurrence) %> |
28<%= link_to 'Back', occurrences_path %> \ No newline at end of file
diff --git a/test/controllers/occurrences_controller_test.rb b/test/controllers/occurrences_controller_test.rb
deleted file mode 100644
index 87f8bdb6..00000000
--- a/test/controllers/occurrences_controller_test.rb
+++ /dev/null
@@ -1,45 +0,0 @@
1require 'test_helper'
2
3class OccurrencesControllerTest < ActionController::TestCase
4 # test "should get index" do
5 # get :index
6 # assert_response :success
7 # assert_not_nil assigns(:occurrences)
8 # end
9 #
10 # test "should get new" do
11 # get :new
12 # assert_response :success
13 # end
14 #
15 # test "should create occurrence" do
16 # assert_difference('Occurrence.count') do
17 # post :create, params: { :occurrence => { } }
18 # end
19 #
20 # assert_redirected_to occurrence_path(assigns(:occurrence))
21 # end
22 #
23 # test "should show occurrence" do
24 # get :show, params: { :id => occurrences(:one).to_param }
25 # assert_response :success
26 # end
27 #
28 # test "should get edit" do
29 # get :edit, params: { :id => occurrences(:one).to_param }
30 # assert_response :success
31 # end
32 #
33 # test "should update occurrence" do
34 # put :update, params: { :id => occurrences(:one).to_param, :occurrence => { } }
35 # assert_redirected_to occurrence_path(assigns(:occurrence))
36 # end
37 #
38 # test "should destroy occurrence" do
39 # assert_difference('Occurrence.count', -1) do
40 # delete params: { :destroy, :id => occurrences(:one).to_param }
41 # end
42 #
43 # assert_redirected_to occurrences_path
44 # end
45end