User management
Some checks are pending
CI / scan_ruby (push) Waiting to run
CI / scan_js (push) Waiting to run
CI / lint (push) Waiting to run
CI / test (push) Waiting to run

This commit is contained in:
sto
2025-03-22 09:16:38 +01:00
parent ce5b729fef
commit 0b47cc4d8a
7 changed files with 70 additions and 8 deletions

View File

@@ -1,4 +1,6 @@
= form_with model: user do |form|
= form_with model: user, method: method do |form|
- if method == :patch
h4 General settings
.row.mb-3
.col
.input-group
@@ -9,7 +11,23 @@
.row.mb-3
.col
.form-floating
= form.text_field :email_address, autocomplete: "off", class: "form-control", type: "email"
= form.text_field :email_address, autocomplete: "off", class: "form-control"
= form.label :email_address, class: "required"
div
= form.submit "Save", class: "btn btn-primary"
- if method == :post
.row.mb-3
.col
.form-floating
= form.password_field :password, autocomplete: "off", class: "form-control"
= form.label :password, class: "required"
= form.submit "Save", class: "btn btn-primary"
- if method == :patch
h4.mt-5 Change password
= form_with model: user, method: method do |form|
.row.mb-3
.col
.form-floating
= form.password_field :password, autocomplete: "off", class: "form-control"
= form.label :password, class: "required"
| New password
= form.submit "Save new password", class: "btn btn-primary"

View File

@@ -1 +1 @@
= render "form", user: @user
= render "form", user: @user, method: :patch

View File

@@ -0,0 +1,27 @@
table.table.table-striped.table-hover
thead
tr
th scope="col"
| Id
th scope="col"
| Name
th scope="col"
| Admin?
th scope="col"
| # contests
tbody
- @users.each do |user|
tr scope="row"
td
= user.id
td
= user.username
td
= user.admin ? "Yes" : "No"
td
= user.contests.length
.row
.col
a.btn.btn-primary href=new_user_path
| New user

View File

@@ -1 +1 @@
= render "form", user: @user
= render "form", user: @user, method: :post