diff --git a/lib/runosaari_web/controllers/location_controller.ex b/lib/runosaari_web/controllers/location_controller.ex
deleted file mode 100644
index 21e95c7..0000000
--- a/lib/runosaari_web/controllers/location_controller.ex
+++ /dev/null
@@ -1,67 +0,0 @@
-defmodule RunosaariWeb.LocationController do
- use RunosaariWeb, :controller
-
- alias Runosaari.Area
- alias Runosaari.Area.Location
-
- def index(conn, _params) do
- locations = Area.list_locations()
- render(conn, "index.html", locations: locations)
- end
-
- def admin(conn, _params) do
- locations = Area.list_locations()
- render(conn, "admin.html", locations: locations)
- end
-
- def new(conn, _params) do
- changeset = Area.change_location(%Location{})
- render(conn, "new.html", changeset: changeset)
- end
-
- def create(conn, %{"location" => location_params}) do
- case Area.create_location(location_params) do
- {:ok, location} ->
- conn
- |> put_flash(:info, "Location created successfully.")
- |> redirect(to: Routes.location_path(conn, :show, location))
-
- {:error, %Ecto.Changeset{} = changeset} ->
- render(conn, "new.html", changeset: changeset)
- end
- end
-
- def show(conn, %{"id" => id}) do
- location = Area.get_location!(id)
- render(conn, "show.html", location: location)
- end
-
- def edit(conn, %{"id" => id}) do
- location = Area.get_location!(id)
- changeset = Area.change_location(location)
- render(conn, "edit.html", location: location, changeset: changeset)
- end
-
- def update(conn, %{"id" => id, "location" => location_params}) do
- location = Area.get_location!(id)
-
- case Area.update_location(location, location_params) do
- {:ok, location} ->
- conn
- |> put_flash(:info, "Location updated successfully.")
- |> redirect(to: Routes.location_path(conn, :show, location))
-
- {:error, %Ecto.Changeset{} = changeset} ->
- render(conn, "edit.html", location: location, changeset: changeset)
- end
- end
-
- def delete(conn, %{"id" => id}) do
- location = Area.get_location!(id)
- {:ok, _location} = Area.delete_location(location)
-
- conn
- |> put_flash(:info, "Location deleted successfully.")
- |> redirect(to: Routes.location_path(conn, :index))
- end
-end
diff --git a/lib/runosaari_web/router.ex b/lib/runosaari_web/router.ex
index c0b6637..484b4b0 100644
--- a/lib/runosaari_web/router.ex
+++ b/lib/runosaari_web/router.ex
@@ -19,7 +19,6 @@ defmodule RunosaariWeb.Router do
get "/", PageController, :index
resources "/performers", PerformerController, only: [:index, :show]
resources "/performances", PerformanceController, only: [:index, :show]
- resources "/locations", LocationController, only: [:index, :show]
end
scope "/admin", RunosaariWeb, as: :admin do
@@ -27,10 +26,8 @@ defmodule RunosaariWeb.Router do
get "/performers", PerformerController, :admin
get "/performers", PerformanceController, :admin
- get "/performers", LocationController, :admin
resources "/performers", PerformerController, except: [:index, :show]
resources "/performances", PerformanceController, except: [:index, :show]
- resources "/locations", LocationController, except: [:index, :show]
end
# Other scopes may use custom stacks.
diff --git a/lib/runosaari_web/templates/location/admin.html.eex b/lib/runosaari_web/templates/location/admin.html.eex
deleted file mode 100644
index fc4e5d2..0000000
--- a/lib/runosaari_web/templates/location/admin.html.eex
+++ /dev/null
@@ -1,34 +0,0 @@
-
Tapahtumapaikat - HALLINTA
-
-
-
-
- | Name |
- Address |
- Reserved seats |
- Max seats |
- Description |
-
- |
-
-
-
-<%= for location <- @locations do %>
-
- | <%= location.name %> |
- <%= location.address %> |
- <%= location.reserved_seats %> |
- <%= location.max_seats %> |
- <%= location.description %> |
-
-
- <%= link "Show", to: Routes.location_path(@conn, :show, location) %>
- <%= link "Edit", to: Routes.admin_location_path(@conn, :edit, location) %>
- <%= link "Delete", to: Routes.admin_location_path(@conn, :delete, location), method: :delete, data: [confirm: "Are you sure?"] %>
- |
-
-<% end %>
-
-
-
-<%= link "New Location", to: Routes.admin_location_path(@conn, :new) %>
diff --git a/lib/runosaari_web/templates/location/edit.html.eex b/lib/runosaari_web/templates/location/edit.html.eex
deleted file mode 100644
index c473d49..0000000
--- a/lib/runosaari_web/templates/location/edit.html.eex
+++ /dev/null
@@ -1,5 +0,0 @@
-Edit Location
-
-<%= render "form.html", Map.put(assigns, :action, Routes.admin_location_path(@conn, :update, @location)) %>
-
-<%= link "Back", to: Routes.location_path(@conn, :index) %>
diff --git a/lib/runosaari_web/templates/location/form.html.eex b/lib/runosaari_web/templates/location/form.html.eex
deleted file mode 100644
index 7b29336..0000000
--- a/lib/runosaari_web/templates/location/form.html.eex
+++ /dev/null
@@ -1,31 +0,0 @@
-<%= form_for @changeset, @action, fn f -> %>
- <%= if @changeset.action do %>
-
-
Oops, something went wrong! Please check the errors below.
-
- <% end %>
-
- <%= label f, :name %>
- <%= text_input f, :name %>
- <%= error_tag f, :name %>
-
- <%= label f, :address %>
- <%= text_input f, :address %>
- <%= error_tag f, :address %>
-
- <%= label f, :reserved_seats %>
- <%= number_input f, :reserved_seats %>
- <%= error_tag f, :reserved_seats %>
-
- <%= label f, :max_seats %>
- <%= number_input f, :max_seats %>
- <%= error_tag f, :max_seats %>
-
- <%= label f, :description %>
- <%= text_input f, :description %>
- <%= error_tag f, :description %>
-
-
- <%= submit "Save" %>
-
-<% end %>
diff --git a/lib/runosaari_web/templates/location/index.html.eex b/lib/runosaari_web/templates/location/index.html.eex
deleted file mode 100644
index 1d7d363..0000000
--- a/lib/runosaari_web/templates/location/index.html.eex
+++ /dev/null
@@ -1,28 +0,0 @@
-Listing Locations
-
-
-
-
- | Name |
- Address |
- Reserved seats |
- Max seats |
- Description |
-
- |
-
-
-
-<%= for location <- @locations do %>
-
- | <%= location.name %> |
- <%= location.address %> |
- <%= location.reserved_seats %> |
- <%= location.max_seats %> |
- <%= location.description %> |
-
-<% end %>
-
-
-
-<%= link "Hallinta", to: Routes.admin_location_path(@conn, :admin) %>
diff --git a/lib/runosaari_web/templates/location/new.html.eex b/lib/runosaari_web/templates/location/new.html.eex
deleted file mode 100644
index f3afd0f..0000000
--- a/lib/runosaari_web/templates/location/new.html.eex
+++ /dev/null
@@ -1,5 +0,0 @@
-New Location
-
-<%= render "form.html", Map.put(assigns, :action, Routes.admin_location_path(@conn, :create)) %>
-
-<%= link "Back", to: Routes.location_path(@conn, :index) %>
diff --git a/lib/runosaari_web/templates/location/show.html.eex b/lib/runosaari_web/templates/location/show.html.eex
deleted file mode 100644
index 7f11456..0000000
--- a/lib/runosaari_web/templates/location/show.html.eex
+++ /dev/null
@@ -1,33 +0,0 @@
-Show Location
-
-
-
- -
- Name:
- <%= @location.name %>
-
-
- -
- Address:
- <%= @location.address %>
-
-
- -
- Reserved seats:
- <%= @location.reserved_seats %>
-
-
- -
- Max seats:
- <%= @location.max_seats %>
-
-
- -
- Description:
- <%= @location.description %>
-
-
-
-
-<%= link "Edit", to: Routes.admin_location_path(@conn, :edit, @location) %>
-<%= link "Back", to: Routes.location_path(@conn, :index) %>
diff --git a/lib/runosaari_web/views/location_view.ex b/lib/runosaari_web/views/location_view.ex
deleted file mode 100644
index a446578..0000000
--- a/lib/runosaari_web/views/location_view.ex
+++ /dev/null
@@ -1,3 +0,0 @@
-defmodule RunosaariWeb.LocationView do
- use RunosaariWeb, :view
-end
diff --git a/test/runosaari_web/controllers/location_controller_test.exs b/test/runosaari_web/controllers/location_controller_test.exs
deleted file mode 100644
index e9c3d18..0000000
--- a/test/runosaari_web/controllers/location_controller_test.exs
+++ /dev/null
@@ -1,88 +0,0 @@
-defmodule RunosaariWeb.LocationControllerTest do
- use RunosaariWeb.ConnCase
-
- alias Runosaari.Area
-
- @create_attrs %{address: "some address", description: "some description", max_seats: 42, name: "some name", reserved_seats: 42}
- @update_attrs %{address: "some updated address", description: "some updated description", max_seats: 43, name: "some updated name", reserved_seats: 43}
- @invalid_attrs %{address: nil, description: nil, max_seats: nil, name: nil, reserved_seats: nil}
-
- def fixture(:location) do
- {:ok, location} = Area.create_location(@create_attrs)
- location
- end
-
- describe "index" do
- test "lists all locations", %{conn: conn} do
- conn = get(conn, Routes.location_path(conn, :index))
- assert html_response(conn, 200) =~ "Listing Locations"
- end
- end
-
- describe "new location" do
- test "renders form", %{conn: conn} do
- conn = get(conn, Routes.location_path(conn, :new))
- assert html_response(conn, 200) =~ "New Location"
- end
- end
-
- describe "create location" do
- test "redirects to show when data is valid", %{conn: conn} do
- conn = post(conn, Routes.location_path(conn, :create), location: @create_attrs)
-
- assert %{id: id} = redirected_params(conn)
- assert redirected_to(conn) == Routes.location_path(conn, :show, id)
-
- conn = get(conn, Routes.location_path(conn, :show, id))
- assert html_response(conn, 200) =~ "Show Location"
- end
-
- test "renders errors when data is invalid", %{conn: conn} do
- conn = post(conn, Routes.location_path(conn, :create), location: @invalid_attrs)
- assert html_response(conn, 200) =~ "New Location"
- end
- end
-
- describe "edit location" do
- setup [:create_location]
-
- test "renders form for editing chosen location", %{conn: conn, location: location} do
- conn = get(conn, Routes.location_path(conn, :edit, location))
- assert html_response(conn, 200) =~ "Edit Location"
- end
- end
-
- describe "update location" do
- setup [:create_location]
-
- test "redirects when data is valid", %{conn: conn, location: location} do
- conn = put(conn, Routes.location_path(conn, :update, location), location: @update_attrs)
- assert redirected_to(conn) == Routes.location_path(conn, :show, location)
-
- conn = get(conn, Routes.location_path(conn, :show, location))
- assert html_response(conn, 200) =~ "some updated address"
- end
-
- test "renders errors when data is invalid", %{conn: conn, location: location} do
- conn = put(conn, Routes.location_path(conn, :update, location), location: @invalid_attrs)
- assert html_response(conn, 200) =~ "Edit Location"
- end
- end
-
- describe "delete location" do
- setup [:create_location]
-
- test "deletes chosen location", %{conn: conn, location: location} do
- conn = delete(conn, Routes.location_path(conn, :delete, location))
- assert redirected_to(conn) == Routes.location_path(conn, :index)
- assert_error_sent 404, fn ->
- get(conn, Routes.location_path(conn, :show, location))
- end
- end
- end
-
- defp create_location(_) do
- location = fixture(:location)
- %{location: location}
- end
-end