From ce03eaaf2dbbfff4c1d7a3e19be66baf28b0dbcf Mon Sep 17 00:00:00 2001 From: Adam Piontek Date: Sat, 13 Aug 2022 09:26:09 -0400 Subject: [PATCH] user settings templates updated, user management index template updated --- .../live/user/registration.html.heex | 2 +- ...ord.html.leex => reset_password.html.heex} | 11 ++- ...{settings.html.leex => settings.html.heex} | 5 +- ...r_url.html.leex => calendar_url.html.heex} | 4 +- .../{email.html.leex => email.html.heex} | 8 +- ...{password.html.leex => password.html.heex} | 12 +-- ...k_start.html.leex => week_start.html.heex} | 4 +- .../{index.html.leex => index.html.heex} | 83 +++++++++---------- .../templates/user_confirmation/new.html.heex | 2 +- .../user_reset_password/new.html.heex | 2 +- .../templates/user_shifts_csv/new.html.heex | 2 +- .../templates/user_shifts_ics/index.html.heex | 2 +- priv/repo/seeds.exs | 6 +- 13 files changed, 69 insertions(+), 74 deletions(-) rename lib/shift73k_web/live/user/{reset_password.html.leex => reset_password.html.heex} (78%) rename lib/shift73k_web/live/user/{settings.html.leex => settings.html.heex} (86%) rename lib/shift73k_web/live/user/settings/{calendar_url.html.leex => calendar_url.html.heex} (65%) rename lib/shift73k_web/live/user/settings/{email.html.leex => email.html.heex} (77%) rename lib/shift73k_web/live/user/settings/{password.html.leex => password.html.heex} (78%) rename lib/shift73k_web/live/user/settings/{week_start.html.leex => week_start.html.heex} (80%) rename lib/shift73k_web/live/user_management/{index.html.leex => index.html.heex} (72%) diff --git a/lib/shift73k_web/live/user/registration.html.heex b/lib/shift73k_web/live/user/registration.html.heex index ee4d0f8c..41f9a11d 100644 --- a/lib/shift73k_web/live/user/registration.html.heex +++ b/lib/shift73k_web/live/user/registration.html.heex @@ -2,7 +2,7 @@

- Register + Register

Create an account to manage your work shifts with us.

diff --git a/lib/shift73k_web/live/user/reset_password.html.leex b/lib/shift73k_web/live/user/reset_password.html.heex similarity index 78% rename from lib/shift73k_web/live/user/reset_password.html.leex rename to lib/shift73k_web/live/user/reset_password.html.heex index 456d2449..f7761c69 100644 --- a/lib/shift73k_web/live/user/reset_password.html.leex +++ b/lib/shift73k_web/live/user/reset_password.html.heex @@ -2,16 +2,15 @@

- <%= icon_div @socket, "bi-shield-lock", [class: "icon baseline"] %> - Reset password + Reset password

Hi <%= @user.email %> — tell us your new password, please.

<%= form_for @changeset, "#", [phx_change: :validate, phx_submit: :save, novalidate: true, id: "pw_reset_form"], fn f -> %> <%= label f, :password, "New password", class: "form-label" %> -
- <%= icon_div @socket, "bi-key", [class: "icon is-left text-muted fs-5"] %> +
+ <%= password_input f, :password, value: input_value(f, :password), class: input_class(f, :password, "form-control"), @@ -23,8 +22,8 @@
<%= label f, :password_confirmation, "Confirm new password", class: "form-label" %> -
- <%= icon_div @socket, "bi-key-fill", [class: "icon is-left text-muted fs-5"] %> +
+ <%= password_input f, :password_confirmation, value: input_value(f, :password_confirmation), class: input_class(f, :password_confirmation, "form-control"), diff --git a/lib/shift73k_web/live/user/settings.html.leex b/lib/shift73k_web/live/user/settings.html.heex similarity index 86% rename from lib/shift73k_web/live/user/settings.html.leex rename to lib/shift73k_web/live/user/settings.html.heex index d3215a0d..e45e8cee 100644 --- a/lib/shift73k_web/live/user/settings.html.leex +++ b/lib/shift73k_web/live/user/settings.html.heex @@ -1,8 +1,9 @@
-

<%= icon_div @socket, "bi-sliders", [class: "icon baseline"] %> - User Settings

+

+ User Settings +

<%= live_component @socket, Shift73kWeb.UserLive.Settings.Email, id: "email-#{@current_user.id}", current_user: @current_user %> diff --git a/lib/shift73k_web/live/user/settings/calendar_url.html.leex b/lib/shift73k_web/live/user/settings/calendar_url.html.heex similarity index 65% rename from lib/shift73k_web/live/user/settings/calendar_url.html.leex rename to lib/shift73k_web/live/user/settings/calendar_url.html.heex index c1d5e84f..9cadb224 100644 --- a/lib/shift73k_web/live/user/settings/calendar_url.html.leex +++ b/lib/shift73k_web/live/user/settings/calendar_url.html.heex @@ -1,11 +1,11 @@ -
+

iCal Subscribe URL

- +
diff --git a/lib/shift73k_web/live/user/settings/email.html.leex b/lib/shift73k_web/live/user/settings/email.html.heex similarity index 77% rename from lib/shift73k_web/live/user/settings/email.html.leex rename to lib/shift73k_web/live/user/settings/email.html.heex index 477059c3..8e8ea791 100644 --- a/lib/shift73k_web/live/user/settings/email.html.leex +++ b/lib/shift73k_web/live/user/settings/email.html.heex @@ -1,12 +1,12 @@ -
+

Change email

<%= form_for @changeset, "#", [phx_change: :validate, phx_submit: :save, phx_target: @myself], fn f -> %> <%= label f, :email, class: "form-label" %> -
- <%= icon_div @socket, "bi-at", [class: "icon is-left text-muted fs-5"] %> +
+ <%= email_input f, :email, value: input_value(f, :email), class: input_class(f, :email, "form-control"), @@ -20,7 +20,7 @@ <%= label f, :current_password, class: "form-label" %>
- <%= icon_div @socket, "bi-lock", [class: "icon is-left text-muted fs-5"] %> + <%= password_input f, :current_password, value: input_value(f, :current_password), id: "user_email_current_password", diff --git a/lib/shift73k_web/live/user/settings/password.html.leex b/lib/shift73k_web/live/user/settings/password.html.heex similarity index 78% rename from lib/shift73k_web/live/user/settings/password.html.leex rename to lib/shift73k_web/live/user/settings/password.html.heex index f3e9f654..e01e6197 100644 --- a/lib/shift73k_web/live/user/settings/password.html.leex +++ b/lib/shift73k_web/live/user/settings/password.html.heex @@ -1,12 +1,12 @@ -
+

Change password

<%= form_for @changeset, "#", [phx_change: :validate, phx_submit: :save, phx_target: @myself], fn f -> %> <%= label f, :password, "New password", class: "form-label" %> -
- <%= icon_div @socket, "bi-key", [class: "icon is-left text-muted fs-5"] %> +
+ <%= password_input f, :password, value: input_value(f, :password), class: input_class(f, :password, "form-control"), @@ -18,8 +18,8 @@
<%= label f, :password_confirmation, "Confirm new password", class: "form-label" %> -
- <%= icon_div @socket, "bi-key-fill", [class: "icon is-left text-muted fs-5"] %> +
+ <%= password_input f, :password_confirmation, value: input_value(f, :password_confirmation), class: input_class(f, :password_confirmation, "form-control"), @@ -31,7 +31,7 @@ <%= label f, :current_password, class: "form-label" %>
- <%= icon_div @socket, "bi-lock", [class: "icon is-left text-muted fs-5"] %> + <%= password_input f, :current_password, value: input_value(f, :current_password), id: "user_password_current_password", diff --git a/lib/shift73k_web/live/user/settings/week_start.html.leex b/lib/shift73k_web/live/user/settings/week_start.html.heex similarity index 80% rename from lib/shift73k_web/live/user/settings/week_start.html.leex rename to lib/shift73k_web/live/user/settings/week_start.html.heex index 120f121c..29f5c0a4 100644 --- a/lib/shift73k_web/live/user/settings/week_start.html.leex +++ b/lib/shift73k_web/live/user/settings/week_start.html.heex @@ -1,4 +1,4 @@ -
+

Calendar view

@@ -6,7 +6,7 @@ <%= label cvf, :week_start_at, "Week starts at", class: "form-label" %>
- <%= icon_div @socket, "bi-calendar2-range", [class: "icon is-left text-muted fs-5"] %> + <%= select cvf, :week_start_at, week_start_options(), value: @current_user.week_start_at, class: "form-select" diff --git a/lib/shift73k_web/live/user_management/index.html.leex b/lib/shift73k_web/live/user_management/index.html.heex similarity index 72% rename from lib/shift73k_web/live/user_management/index.html.leex rename to lib/shift73k_web/live/user_management/index.html.heex index 9e16d581..912bb88b 100644 --- a/lib/shift73k_web/live/user_management/index.html.leex +++ b/lib/shift73k_web/live/user_management/index.html.heex @@ -17,7 +17,7 @@

- Listing Users + Listing Users

<%# filtering and new item creation %> @@ -26,7 +26,7 @@
<%= live_patch to: Routes.user_management_index_path(@socket, :new, Enum.into(@query, [])), class: "btn btn-primary mb-3 mb-md-0" do %> - New User + New User <% end %>
@@ -34,10 +34,10 @@ <%= form_for :sort, "#", [phx_change: "sort-by-change"], fn srt -> %> <%= label srt, :sort_by, class: "visually-hidden" %>
- <%= icon_div @socket, "bi-arrow-down-up", [class: "icon is-left text-muted fs-5", style: "z-index:1001;"], [style: "padding: 1px;"] %> - <%= Phoenix.HTML.Form.select srt, :sort_by, ["Email": "email", "Role": "role", "Created at": "inserted_at"], value: @query.sort_by, class: "form-select" %> + + <%= Phoenix.HTML.Form.select srt, :sort_by, ["Email": "email", "Role": "role", "Created at": "inserted_at"], value: @query.sort_by, class: "form-select rounded-start" %>
<% end %> @@ -47,9 +47,9 @@ <%= form_for :filter, "#", [phx_change: "filter-change"], fn flt -> %> <%= label flt, :filter, class: "visually-hidden" %>
- + <%= if @query.filter != "" do %> - <%= icon_div @socket, "bi-x-circle-fill", [class: "icon is-right text-primary fs-5"], [role: "img", aria_hidden: false, aria_label: "Clear filter", class: "cursor-pointer pe-auto", phx_click: "filter-clear"] %> + <% end %> <%= text_input flt, :filter, name: "filter", @@ -90,21 +90,19 @@
<%= user.confirmed_at && "Yes" || "No" %> - disabled> +
<%= if Roles.can?(@current_user, user, :edit) do %> <%= live_patch to: Routes.user_management_index_path(@socket, :edit, user.id, Enum.into(@query, [])), class: "btn btn-primary btn-sm text-nowrap" do %> - <%= icon_div @socket, "bi-pencil", [class: "icon baseline"] %> - Edit + Edit <% end %> <% end %> <%= if Roles.can?(@current_user, user, :delete) do %> - <% end %> @@ -124,28 +122,25 @@ - + Email - <%= if @query.sort_by == "email", do: icon_div @socket, - (@query.sort_order == "desc" && "bi-sort-up-alt" || "bi-sort-down-alt"), - [class: "icon baseline ms-1"] - %> + <%= if @query.sort_by == "email" do %> + + <% end %> - + Role - <%= if @query.sort_by == "role", do: icon_div @socket, - (@query.sort_order == "desc" && "bi-sort-up-alt" || "bi-sort-down-alt"), - [class: "icon baseline ms-1"] - %> + <%= if @query.sort_by == "role" do %> + + <% end %> - + Created at - <%= if @query.sort_by == "inserted_at", do: icon_div @socket, - (@query.sort_order == "desc" && "bi-sort-up-alt" || "bi-sort-down-alt"), - [class: "icon baseline ms-1"] - %> + <%= if @query.sort_by == "inserted_at" do %> + + <% end %> Confirmed? @@ -166,27 +161,25 @@ <% else %> <%= for user <- @page.entries do %> - + <%= user.email %> <%= user.role |> Atom.to_string() |> String.capitalize() %> <%= dt_out(user.inserted_at) %> <%= user.confirmed_at && "Confirmed" || "Not confirmed" %> - disabled> + <%= if Roles.can?(@current_user, user, :edit) do %> <%= live_patch to: Routes.user_management_index_path(@socket, :edit, user.id, Enum.into(@query, [])), class: "btn btn-outline-primary btn-sm text-nowrap" do %> - <%= icon_div @socket, "bi-pencil", [class: "icon baseline"] %> - Edit + Edit <% end %> <% end %> <%= if Roles.can?(@current_user, user, :delete) do %> - <% end %> @@ -225,16 +218,16 @@
    <%# previous page button %> - <% icon = icon_div @socket, "bi-chevron-left", [class: "icon baseline"] %> <%= if @page.page_number == 1 do %>
  • - + Previous +
  • <% else %>
  • - <%= icon %> - <% end %> +
  • + <% end %> <%# page buttons %> <%= for page_num <- generate_page_list(@page.page_number, @page.total_pages) do %> @@ -246,26 +239,26 @@ <% page_num == @page.page_number -> %>
  • - <%= page_num %> + <%= page_num %>
  • <% true -> %>
  • - <%= page_num %> + <%= page_num %>
  • <% end %> <% end %> <%# next page button %> - <% icon = icon_div @socket, "bi-chevron-right", [class: "icon baseline"] %> <%= if @page.page_number == @page.total_pages do %>
  • - + Next +
  • <% else %>
  • - <%= icon %> - <% end %> +
  • + <% end %>
diff --git a/lib/shift73k_web/templates/user_confirmation/new.html.heex b/lib/shift73k_web/templates/user_confirmation/new.html.heex index 0c543099..1155cd44 100644 --- a/lib/shift73k_web/templates/user_confirmation/new.html.heex +++ b/lib/shift73k_web/templates/user_confirmation/new.html.heex @@ -2,7 +2,7 @@

- Resend confirmation instructions + Resend confirmation instructions

We'll send you another email with instructions to confirm your email address.

diff --git a/lib/shift73k_web/templates/user_reset_password/new.html.heex b/lib/shift73k_web/templates/user_reset_password/new.html.heex index 84d64187..8bcab246 100644 --- a/lib/shift73k_web/templates/user_reset_password/new.html.heex +++ b/lib/shift73k_web/templates/user_reset_password/new.html.heex @@ -2,7 +2,7 @@

- Forgot your password? + Forgot your password?

We'll send you an email with instructions to reset your password.

diff --git a/lib/shift73k_web/templates/user_shifts_csv/new.html.heex b/lib/shift73k_web/templates/user_shifts_csv/new.html.heex index ceeb6862..0a3d98ac 100644 --- a/lib/shift73k_web/templates/user_shifts_csv/new.html.heex +++ b/lib/shift73k_web/templates/user_shifts_csv/new.html.heex @@ -2,7 +2,7 @@

- CSV Export + CSV Export

Select a date range for which to export a CSV of your scheduled shifts, or click "Export All" to export everything.

diff --git a/lib/shift73k_web/templates/user_shifts_ics/index.html.heex b/lib/shift73k_web/templates/user_shifts_ics/index.html.heex index bdc56c14..e6fc92d1 100644 --- a/lib/shift73k_web/templates/user_shifts_ics/index.html.heex +++ b/lib/shift73k_web/templates/user_shifts_ics/index.html.heex @@ -2,7 +2,7 @@

- User Shifts ICS + User Shifts ICS

Shifts for user: <%= @user.email %>

Calendar slug: <%= @slug %>

diff --git a/priv/repo/seeds.exs b/priv/repo/seeds.exs index a2062be5..6c143b84 100644 --- a/priv/repo/seeds.exs +++ b/priv/repo/seeds.exs @@ -51,8 +51,10 @@ mock_users = users_json |> File.read!() |> Jason.decode!() |> Enum.take_random(c extra_mock_users = ~s([ {"email":"adam@73k.us","password":"adamadamA1","role":"admin","inserted_at":"2018-12-14T01:01:01Z","confirmed_at":true}, - {"email":"karen@73k.us","password":"karenkarenA1","role":"manager","inserted_at":"2018-12-14T01:06:01Z","confirmed_at":true}, - {"email":"kat@73k.us","password":"katkatA1","role":"manager","inserted_at":"2018-12-14T01:06:01Z","confirmed_at":true} + {"email":"kat@73k.us","password":"katkatA1","role":"manager","inserted_at":"2018-12-14T01:06:01Z","confirmed_at":true}, + {"email":"babka@73k.us","password":"Babka2020","role":"user","inserted_at":"2018-12-14T01:06:01Z","confirmed_at":false}, + {"email":"malcolm@73k.us","password":"Malc2018","role":"user","inserted_at":"2018-12-14T01:06:01Z","confirmed_at":false}, + {"email":"casio@73k.us","password":"Casio2011","role":"user","inserted_at":"2018-12-14T01:06:01Z","confirmed_at":false} ]) # for random week_start_at values