Performers index and detailed info page.
This commit is contained in:
@@ -6,6 +6,7 @@
|
|||||||
@import './pages/performance.scss';
|
@import './pages/performance.scss';
|
||||||
@import './pages/admin.scss';
|
@import './pages/admin.scss';
|
||||||
@import './pages/privacy.scss';
|
@import './pages/privacy.scss';
|
||||||
|
@import './pages/performer.scss';
|
||||||
/* Alerts and form errors */
|
/* Alerts and form errors */
|
||||||
.alert {
|
.alert {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
41
assets/css/pages/performer.scss
Normal file
41
assets/css/pages/performer.scss
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
.performer-img {
|
||||||
|
max-width: 57%;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media screen and (max-width: 600px) {
|
||||||
|
.performer-img {
|
||||||
|
max-width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.performers-container {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
width: 80%;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: baseline;
|
||||||
|
|
||||||
|
.performer-name {
|
||||||
|
width: 30%;
|
||||||
|
font-size: x-large;
|
||||||
|
border-right: solid 1px;
|
||||||
|
border-left: solid 1px;
|
||||||
|
margin-bottom: 4%;
|
||||||
|
border-radius: 3px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media screen and (max-width: 600px) {
|
||||||
|
.performers-container {
|
||||||
|
.performer-name {
|
||||||
|
width: 100%;
|
||||||
|
margin-bottom: 10%;
|
||||||
|
text-align: left;
|
||||||
|
padding-left: 5%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.performer-name::before {
|
||||||
|
content: '>> ';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -71,7 +71,7 @@ defmodule RunosaariWeb.PerformerController do
|
|||||||
{:ok, performer} ->
|
{:ok, performer} ->
|
||||||
conn
|
conn
|
||||||
|> put_flash(:info, "Esiintyjän tiedot päivitetty.")
|
|> put_flash(:info, "Esiintyjän tiedot päivitetty.")
|
||||||
|> redirect(to: Routes.admin_performer_path(conn, :show, performer))
|
|> redirect(to: Routes.performer_path(conn, :show, performer))
|
||||||
|
|
||||||
{:error, %Ecto.Changeset{} = changeset} ->
|
{:error, %Ecto.Changeset{} = changeset} ->
|
||||||
render(conn, "edit.html", performer: performer, changeset: changeset)
|
render(conn, "edit.html", performer: performer, changeset: changeset)
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ defmodule RunosaariWeb.Router do
|
|||||||
get "/info", PageController, :info
|
get "/info", PageController, :info
|
||||||
get "/covid19", PageController, :covid19
|
get "/covid19", PageController, :covid19
|
||||||
get "/privacy", PageController, :privacy
|
get "/privacy", PageController, :privacy
|
||||||
resources "/performers", PerformerController, only: [:index]
|
resources "/performers", PerformerController, only: [:index, :show]
|
||||||
resources "/performances", PerformanceController, only: [:index]
|
resources "/performances", PerformanceController, only: [:index]
|
||||||
resources "/visitors", VisitorController, only: [:new, :create]
|
resources "/visitors", VisitorController, only: [:new, :create]
|
||||||
get "/confirmation", VisitorController, :confirmation
|
get "/confirmation", VisitorController, :confirmation
|
||||||
@@ -33,7 +33,7 @@ defmodule RunosaariWeb.Router do
|
|||||||
resources "/index", IndexController, except: [:index]
|
resources "/index", IndexController, except: [:index]
|
||||||
get "/performers", PerformerController, :admin
|
get "/performers", PerformerController, :admin
|
||||||
get "/performances", PerformanceController, :admin
|
get "/performances", PerformanceController, :admin
|
||||||
resources "/performers", PerformerController, except: [:index]
|
resources "/performers", PerformerController, except: [:index, :show]
|
||||||
resources "/performances", PerformanceController, except: [:index]
|
resources "/performances", PerformanceController, except: [:index]
|
||||||
resources "/visitors", VisitorController, except: [:new, :create]
|
resources "/visitors", VisitorController, except: [:new, :create]
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
<td><%= performer.seqnum %></td>
|
<td><%= performer.seqnum %></td>
|
||||||
|
|
||||||
<td class="actions">
|
<td class="actions">
|
||||||
<span><%= link "Lisätietoja", to: Routes.admin_performer_path(@conn, :show, performer) %></span>
|
<span><%= link "Esiintyjäsivu", to: Routes.performer_path(@conn, :show, performer) %></span>
|
||||||
<span><%= link "Muokkaa", to: Routes.admin_performer_path(@conn, :edit, performer) %></span>
|
<span><%= link "Muokkaa", to: Routes.admin_performer_path(@conn, :edit, performer) %></span>
|
||||||
<span><%= link "Poista", to: Routes.admin_performer_path(@conn, :delete, performer), method: :delete, data: [confirm: "Haluatko poistaa esiintyjän #{performer.name}?"] %></span>
|
<span><%= link "Poista", to: Routes.admin_performer_path(@conn, :delete, performer), method: :delete, data: [confirm: "Haluatko poistaa esiintyjän #{performer.name}?"] %></span>
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
@@ -4,8 +4,9 @@
|
|||||||
<%= if length(@performers) == 0 do %>
|
<%= if length(@performers) == 0 do %>
|
||||||
<i>Lisätietoja tulossa myöhemmin!</i>
|
<i>Lisätietoja tulossa myöhemmin!</i>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<div class="performers-container">
|
||||||
<%= for performer <- @performers do %>
|
<%= for performer <- @performers do %>
|
||||||
<h2><%= performer.name %></h2>
|
<%= link "#{performer.name}", to: Routes.performer_path(@conn, :show, performer), class: "performer-name" %>
|
||||||
<p><%= performer.desc %></p>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
@@ -1,30 +1,5 @@
|
|||||||
<section class="main">
|
<section class="main">
|
||||||
<h1>Esiintyjän tiedot</h1>
|
<h1><%= @performer.name %></h1>
|
||||||
|
<p><%= @performer.desc %></p>
|
||||||
<ul>
|
<img src="<%= @performer.photo_path %>" alt="Esiintyjän kuva" class="performer-img" />
|
||||||
|
|
||||||
<li>
|
|
||||||
<strong>Nimi:</strong>
|
|
||||||
<%= @performer.name %>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li>
|
|
||||||
<strong>Seloste:</strong>
|
|
||||||
<%= @performer.desc %>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li>
|
|
||||||
<strong>Vahvistettu:</strong>
|
|
||||||
<%= @performer.confirmed %>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li>
|
|
||||||
<strong>Prioriteetti:</strong>
|
|
||||||
<%= @performer.seqnum %>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<span><%= link "Muokkaa", to: Routes.admin_performer_path(@conn, :edit, @performer) %></span>
|
|
||||||
<span><%= link "Takaisin", to: Routes.admin_performer_path(@conn, :admin) %></span>
|
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
@@ -70,9 +70,9 @@ defmodule RunosaariWeb.PerformerControllerTest do
|
|||||||
conn =
|
conn =
|
||||||
put(conn, Routes.admin_performer_path(conn, :update, performer), performer: @update_attrs)
|
put(conn, Routes.admin_performer_path(conn, :update, performer), performer: @update_attrs)
|
||||||
|
|
||||||
assert redirected_to(conn) == Routes.admin_performer_path(conn, :show, performer)
|
assert redirected_to(conn) == Routes.performer_path(conn, :show, performer)
|
||||||
|
|
||||||
conn = get(conn, Routes.admin_performer_path(conn, :show, performer))
|
conn = get(conn, Routes.performer_path(conn, :show, performer))
|
||||||
assert html_response(conn, 200) =~ "some updated name"
|
assert html_response(conn, 200) =~ "some updated name"
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -92,7 +92,7 @@ defmodule RunosaariWeb.PerformerControllerTest do
|
|||||||
assert redirected_to(conn) == Routes.admin_performer_path(conn, :admin)
|
assert redirected_to(conn) == Routes.admin_performer_path(conn, :admin)
|
||||||
|
|
||||||
assert_error_sent 404, fn ->
|
assert_error_sent 404, fn ->
|
||||||
get(conn, Routes.admin_performer_path(conn, :show, performer))
|
get(conn, Routes.performer_path(conn, :show, performer))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user