minor adjustments to be in line with bones73k

This commit is contained in:
Adam Piontek 2021-03-26 19:13:57 -04:00
parent 120b80dc69
commit 79fad5920e
7 changed files with 14 additions and 16 deletions

View file

@ -6,4 +6,13 @@ defmodule Shift73k do
Contexts are also responsible for managing your data, regardless Contexts are also responsible for managing your data, regardless
if it comes from the database, an external API or others. if it comes from the database, an external API or others.
""" """
@app_vars Application.get_env(:shift73k, :app_global_vars, time_zone: "America/New_York")
@app_time_zone @app_vars[:time_zone]
@weekdays [:monday, :tuesday, :wednesday, :thursday, :friday, :saturday, :sunday]
def app_time_zone, do: @app_time_zone
def weekdays, do: @weekdays
end end

View file

@ -1,7 +1,7 @@
defmodule Shift73k.Accounts.User do defmodule Shift73k.Accounts.User do
use Ecto.Schema use Ecto.Schema
import Ecto.Changeset import Ecto.Changeset
import Shift73k.Util.Dt, only: [weekdays: 0] import Shift73k, only: [weekdays: 0]
alias Shift73k.Shifts.Templates.ShiftTemplate alias Shift73k.Shifts.Templates.ShiftTemplate
alias Shift73k.Shifts.Shift alias Shift73k.Shifts.Shift

View file

@ -1,10 +0,0 @@
defmodule Shift73k.Util.Dt do
@app_vars Application.get_env(:shift73k, :app_global_vars, time_zone: "America/New_York")
@app_time_zone @app_vars[:time_zone]
@weekdays [:monday, :tuesday, :wednesday, :thursday, :friday, :saturday, :sunday]
def app_time_zone, do: @app_time_zone
def weekdays, do: @weekdays
end

View file

@ -35,7 +35,7 @@
<div class="inner-addon left-addon mb-3"> <div class="inner-addon left-addon mb-3">
<%= icon_div @socket, "bi-map", [class: "icon is-left text-muted fs-5"] %> <%= icon_div @socket, "bi-map", [class: "icon is-left text-muted fs-5"] %>
<%= text_input iimf, :time_zone, <%= text_input iimf, :time_zone,
value: Shift73k.Util.Dt.app_time_zone(), value: Shift73k.app_time_zone(),
class: @tz_valid && "form-control" || "form-control is-invalid", class: @tz_valid && "form-control" || "form-control is-invalid",
phx_debounce: 250, phx_debounce: 250,
aria_describedby: "ics-import-tz-error", aria_describedby: "ics-import-tz-error",

View file

@ -1,6 +1,6 @@
defmodule Shift73kWeb.UserLive.Settings.WeekStart do defmodule Shift73kWeb.UserLive.Settings.WeekStart do
use Shift73kWeb, :live_component use Shift73kWeb, :live_component
import Shift73k.Util.Dt, only: [weekdays: 0] import Shift73k, only: [weekdays: 0]
alias Shift73k.Accounts alias Shift73k.Accounts

View file

@ -2,7 +2,6 @@ defmodule Shift73kWeb.UserManagementLive.Index do
use Shift73kWeb, :live_view use Shift73kWeb, :live_view
import Ecto.Query import Ecto.Query
import Shift73k.Util.Dt
import Shift73kWeb.Pagination import Shift73kWeb.Pagination
alias Shift73k.Repo alias Shift73k.Repo
@ -199,7 +198,7 @@ defmodule Shift73kWeb.UserManagementLive.Index do
def dt_out(ndt) do def dt_out(ndt) do
ndt ndt
|> DateTime.from_naive!(app_time_zone()) |> DateTime.from_naive!(Shift73k.app_time_zone())
|> Calendar.strftime("%Y %b %-d, %-I:%M %p") |> Calendar.strftime("%Y %b %-d, %-I:%M %p")
end end
end end

View file

@ -56,7 +56,7 @@ extra_mock_users = ~s([
]) ])
# for random week_start_at values # for random week_start_at values
[head | tail] = Shift73k.Util.Dt.weekdays() [head | tail] = Shift73k.weekdays()
week_starts = [head | Enum.drop(tail, 4)] week_starts = [head | Enum.drop(tail, 4)]
mock_users = mock_users =