Commit dcd887c5134ce0f04809d6775b2bc445d7993271

Thomas de Grivel 2021-11-22T13:21:28

admin: repositories

diff --git a/lib/kmxgit_web/templates/admin/repository/edit.html.heex b/lib/kmxgit_web/templates/admin/repository/edit.html.heex
new file mode 100644
index 0000000..389fb72
--- /dev/null
+++ b/lib/kmxgit_web/templates/admin/repository/edit.html.heex
@@ -0,0 +1,6 @@
+<div class="container-fluid">
+  <h1>
+    <%= gettext "Edit repository %{repo}", repo: Repository.full_slug(@repo) %>
+  </h1>
+  <%= render "form.html", assigns %>
+</div>
diff --git a/lib/kmxgit_web/templates/admin/repository/form.html.heex b/lib/kmxgit_web/templates/admin/repository/form.html.heex
new file mode 100644
index 0000000..0c4465d
--- /dev/null
+++ b/lib/kmxgit_web/templates/admin/repository/form.html.heex
@@ -0,0 +1,33 @@
+<%= form_for @changeset, @action, fn f -> %>
+  <%= if @changeset.action do %>
+    <div class="alert alert-danger">
+      <p>Invalid parameters</p>
+    </div>
+  <% end %>
+
+  <div class="mb-3">
+    <%= label f, :slug, class: "form-label" %>
+    <%= text_input f, :slug, class: "form-control" %>
+    <%= error_tag f, :slug %>
+  </div>
+
+  <div class="mb-3">
+    <%= label f, :description, class: "form-label" %>
+    <%= textarea f, :description, class: "form-control" %>
+    <%= error_tag f, :description %>
+  </div>
+
+  <div class="mb-3">
+    <%= if @conn.assigns[:repo] do %>
+      <%= link gettext("Cancel"),
+          to: Routes.admin_repository_path(@conn, :show, @repo),
+          class: "btn btn-secondary" %>
+    <% else %>
+      <%= link gettext("Cancel"),
+          to: Routes.admin_repository_path(@conn, :index),
+          class: "btn btn-secondary" %>
+    <% end %>
+    <%= submit gettext("Submit"), class: "btn btn-primary" %>
+  </div>
+
+<% end %>