Editable workshops.

This commit is contained in:
codevictory
2021-07-06 19:06:20 +03:00
parent eb93d7afc1
commit b4a22b68d2
17 changed files with 473 additions and 15 deletions

View File

@@ -32,10 +32,10 @@
<% end %>
<% end %>
<h2>Työpajat</h2>
<p id="workshops">
<b>Jaana Kouri:</b> Shamanistinen kirjoitustyöpaja <br class="workshops-br">
<b>Hanna Toivonen:</b> Sarjakuvatyöpaja <br class="workshops-br">
<br />
<i>Näihin avataan ennakkoilmoittautuminen hyvissä ajoin.</i>
</p>
<%= for workshop <- @workshops do %>
<p class="workshop-paragraph">
<b><%= workshop.name %></b><%= workshop.text %>
</p>
<% end %>
<i class="foot-note">Näihin avataan ennakkoilmoittautuminen hyvissä ajoin.</i>
</section>

View File

@@ -0,0 +1,32 @@
<section class="main">
<h1>HALLINTA - Työpajat</h1>
<table>
<thead>
<tr>
<th>Nimi</th>
<th>Teksti</th>
<th>Prioriteetti</th>
<th></th>
</tr>
</thead>
<tbody>
<%= for workshop <- @workshops do %>
<tr>
<td><%= workshop.name %></td>
<td><%= workshop.text %></td>
<td><%= workshop.seqnum %></td>
<td class="actions">
<span><%= link "Lisätietoja", to: Routes.admin_workshop_path(@conn, :show, workshop) %></span>
<span><%= link "Muokkaa", to: Routes.admin_workshop_path(@conn, :edit, workshop) %></span>
<span><%= link "Poista", to: Routes.admin_workshop_path(@conn, :delete, workshop), method: :delete, data: [confirm: "Oletko varma?"] %></span>
</td>
</tr>
<% end %>
</tbody>
</table>
<span><%= link "Luo uusi työpaja", to: Routes.admin_workshop_path(@conn, :new) %></span>
</section>

View File

@@ -0,0 +1,5 @@
<h1>Muokkaa työpajan tietoja</h1>
<%= render "form.html", Map.put(assigns, :action, Routes.admin_workshop_path(@conn, :update, @workshop)) %>
<span><%= link "Takaisin", to: Routes.admin_workshop_path(@conn, :admin) %></span>

View File

@@ -0,0 +1,23 @@
<%= form_for @changeset, @action, fn f -> %>
<%= if @changeset.action do %>
<div class="alert alert-danger">
<p>Joku kentistä on tyhjä.</p>
</div>
<% end %>
<%= label f, :name, "Nimi" %>
<%= text_input f, :name %>
<%= error_tag f, :name %>
<%= label f, :text, "Teksti" %>
<%= textarea f, :text %>
<%= error_tag f, :text %>
<%= label f, :seqnum, "Prioriteetti (1 on korkein)" %>
<%= number_input f, :seqnum %>
<%= error_tag f, :seqnum %>
<div>
<%= submit "Tallenna" %>
</div>
<% end %>

View File

@@ -0,0 +1,5 @@
<h1>Luo uusi työpaja</h1>
<%= render "form.html", Map.put(assigns, :action, Routes.admin_workshop_path(@conn, :create)) %>
<span><%= link "Takaisin", to: Routes.admin_workshop_path(@conn, :admin) %></span>

View File

@@ -0,0 +1,23 @@
<h1>Työpajan tiedot</h1>
<ul>
<li>
<strong>Nimi:</strong>
<%= @workshop.name %>
</li>
<li>
<strong>Teksti:</strong>
<%= @workshop.text %>
</li>
<li>
<strong>Prioriteetti:</strong>
<%= @workshop.seqnum %>
</li>
</ul>
<span><%= link "Muokkaa", to: Routes.admin_workshop_path(@conn, :edit, @workshop) %></span>
<span><%= link "Takaisin", to: Routes.admin_workshop_path(@conn, :admin) %></span>