Admin actions behind admin path.

This commit is contained in:
codevictory
2021-04-20 23:09:00 +03:00
parent cac837be20
commit b06bae000f
14 changed files with 32 additions and 21 deletions

View File

@@ -17,9 +17,17 @@ defmodule RunosaariWeb.Router do
pipe_through :browser
get "/", PageController, :index
resources "/performers", PerformerController
resources "/performances", PerformanceController
resources "/locations", LocationController
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
pipe_through :browser
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.

View File

@@ -18,7 +18,8 @@
<%= link "Etusivu", to: Routes.page_path(@conn, :index) %>
<%= link "Esiintyjät", to: Routes.performer_path(@conn, :index) %>
<%= link "Ohjelma", to: Routes.performance_path(@conn, :index) %>
<%= link "Ilmoittautuminen", to: Routes.performer_path(@conn, :new) %>
<%= link "Ilmoittautuminen", to: Routes.admin_performer_path(@conn, :new) %>
<%= link "DEBUG Uusi näytös", to: Routes.admin_performance_path(@conn, :new) %>
</nav>
</header>
<main role="main">

View File

@@ -1,5 +1,5 @@
<h1>Edit Location</h1>
<%= render "form.html", Map.put(assigns, :action, Routes.location_path(@conn, :update, @location)) %>
<%= render "form.html", Map.put(assigns, :action, Routes.admin_location_path(@conn, :update, @location)) %>
<span><%= link "Back", to: Routes.location_path(@conn, :index) %></span>

View File

@@ -23,12 +23,12 @@
<td>
<span><%= link "Show", to: Routes.location_path(@conn, :show, location) %></span>
<span><%= link "Edit", to: Routes.location_path(@conn, :edit, location) %></span>
<span><%= link "Delete", to: Routes.location_path(@conn, :delete, location), method: :delete, data: [confirm: "Are you sure?"] %></span>
<span><%= link "Edit", to: Routes.admin_location_path(@conn, :edit, location) %></span>
<span><%= link "Delete", to: Routes.admin_location_path(@conn, :delete, location), method: :delete, data: [confirm: "Are you sure?"] %></span>
</td>
</tr>
<% end %>
</tbody>
</table>
<span><%= link "New Location", to: Routes.location_path(@conn, :new) %></span>
<span><%= link "New Location", to: Routes.admin_location_path(@conn, :new) %></span>

View File

@@ -1,5 +1,5 @@
<h1>New Location</h1>
<%= render "form.html", Map.put(assigns, :action, Routes.location_path(@conn, :create)) %>
<%= render "form.html", Map.put(assigns, :action, Routes.admin_location_path(@conn, :create)) %>
<span><%= link "Back", to: Routes.location_path(@conn, :index) %></span>

View File

@@ -29,5 +29,5 @@
</ul>
<span><%= link "Edit", to: Routes.location_path(@conn, :edit, @location) %></span>
<span><%= link "Edit", to: Routes.admin_location_path(@conn, :edit, @location) %></span>
<span><%= link "Back", to: Routes.location_path(@conn, :index) %></span>

View File

@@ -1,5 +1,5 @@
<h1>Edit Performance</h1>
<%= render "form.html", Map.put(assigns, :action, Routes.performance_path(@conn, :update, @performance)) %>
<%= render "form.html", Map.put(assigns, :action, Routes.admin_performance_path(@conn, :update, @performance)) %>
<span><%= link "Back", to: Routes.performance_path(@conn, :index) %></span>

View File

@@ -19,12 +19,12 @@
<td>
<span><%= link "Show", to: Routes.performance_path(@conn, :show, performance) %></span>
<span><%= link "Edit", to: Routes.performance_path(@conn, :edit, performance) %></span>
<span><%= link "Delete", to: Routes.performance_path(@conn, :delete, performance), method: :delete, data: [confirm: "Are you sure?"] %></span>
<span><%= link "Edit", to: Routes.admin_performance_path(@conn, :edit, performance) %></span>
<span><%= link "Delete", to: Routes.admin_performance_path(@conn, :delete, performance), method: :delete, data: [confirm: "Are you sure?"] %></span>
</td>
</tr>
<% end %>
</tbody>
</table>
<span><%= link "New Performance", to: Routes.performance_path(@conn, :new) %></span>
<span><%= link "New Performance", to: Routes.admin_performance_path(@conn, :new) %></span>

View File

@@ -1,5 +1,5 @@
<h1>New Performance</h1>
<%= render "form.html", Map.put(assigns, :action, Routes.performance_path(@conn, :create)) %>
<%= render "form.html", Map.put(assigns, :action, Routes.admin_performance_path(@conn, :create)) %>
<span><%= link "Back", to: Routes.performance_path(@conn, :index) %></span>

View File

@@ -19,5 +19,5 @@
</ul>
<span><%= link "Edit", to: Routes.performance_path(@conn, :edit, @performance) %></span>
<span><%= link "Edit", to: Routes.admin_performance_path(@conn, :edit, @performance) %></span>
<span><%= link "Back", to: Routes.performance_path(@conn, :index) %></span>

View File

@@ -1,5 +1,5 @@
<h1>Edit Performer</h1>
<%= render "form.html", Map.put(assigns, :action, Routes.performer_path(@conn, :update, @performer)) %>
<%= render "form.html", Map.put(assigns, :action, Routes.admin_performer_path(@conn, :update, @performer)) %>
<span><%= link "Back", to: Routes.performer_path(@conn, :index) %></span>

View File

@@ -25,10 +25,12 @@
<td>
<span><%= link "Show", to: Routes.performer_path(@conn, :show, performer) %></span>
<span><%= link "Edit", to: Routes.performer_path(@conn, :edit, performer) %></span>
<span><%= link "Delete", to: Routes.performer_path(@conn, :delete, performer), method: :delete, data: [confirm: "Are you sure?"] %></span>
<span><%= link "Edit", to: Routes.admin_performer_path(@conn, :edit, performer) %></span>
<span><%= link "Delete", to: Routes.admin_performer_path(@conn, :delete, performer), method: :delete, data: [confirm: "Are you sure?"] %></span>
</td>
</tr>
<% end %>
</tbody>
</table>
<span><%= link "New Performance", to: Routes.admin_performance_path(@conn, :new) %></span>

View File

@@ -1,3 +1,3 @@
<h1>Ilmoittaudu</h1>
<%= render "form.html", Map.put(assigns, :action, Routes.performer_path(@conn, :create)) %>
<%= render "form.html", Map.put(assigns, :action, Routes.admin_performer_path(@conn, :create)) %>

View File

@@ -34,5 +34,5 @@
</ul>
<span><%= link "Edit", to: Routes.performer_path(@conn, :edit, @performer) %></span>
<span><%= link "Edit", to: Routes.admin_performer_path(@conn, :edit, @performer) %></span>
<span><%= link "Back", to: Routes.performer_path(@conn, :index) %></span>