fix tests

This commit is contained in:
2022-01-22 15:00:30 -05:00
committed by oliviasculley
parent f0676a2433
commit 3674eeaf5a
15 changed files with 83 additions and 1096 deletions

View File

@ -18,70 +18,83 @@ defmodule LokalWeb.Component.Topbar do
<div class="flex flex-row justify-between items-center space-x-4">
<div class="flex flex-row justify-start items-center space-x-2">
<%= link to: Routes.live_path(LokalWeb.Endpoint, PageLive) do %>
<h1 class="leading-5 text-xl text-white hover:underline">Lokal</h1>
<h1 class="leading-5 text-xl text-white hover:underline">
Lokal
</h1>
<% end %>
<%= if @title_content do %>
<span>|</span>
<%= render_slot(@title_content) %>
<% end %>
</div>
<ul class="flex flex-row flex-wrap justify-center items-center
text-lg space-x-4 text-lg text-white">
<%# search %>
<form phx-change="suggest" phx-submit="search">
<input type="text" name="q" class="input input-primary"
placeholder="Search" list="results" autocomplete="off"/>
<input
type="text"
name="q"
class="input input-primary"
placeholder="Search"
list="results"
autocomplete="off"
/>
<datalist id="results">
<%= for {app, _vsn} <- @results do %>
<option value={app}>"><%= app %></option>
<option value={app}>
"> <%= app %>
</option>
<% end %>
</datalist>
</form>
<%# user settings %>
<%= if @current_user do %>
<li><%= @current_user.email %></li>
<li>
<%= link "Settings", class: "hover:underline",
to: Routes.user_settings_path(LokalWeb.Endpoint, :edit) %>
<%= @current_user.email %>
</li>
<li>
<%= link "Log out", class: "hover:underline",
to: Routes.user_session_path(LokalWeb.Endpoint, :delete), method: :delete %>
<%= link("Settings",
class: "hover:underline",
to: Routes.user_settings_path(LokalWeb.Endpoint, :edit)
) %>
</li>
<li>
<%= link("Log out",
class: "hover:underline",
to: Routes.user_session_path(LokalWeb.Endpoint, :delete),
method: :delete
) %>
</li>
<%= if function_exported?(Routes, :live_dashboard_path, 2) do %>
<li>
<%= link "LiveDashboard", class: "hover:underline",
to: Routes.live_dashboard_path(LokalWeb.Endpoint, :home) %>
<%= link("LiveDashboard",
class: "hover:underline",
to: Routes.live_dashboard_path(LokalWeb.Endpoint, :home)
) %>
</li>
<% end %>
<% else %>
<li>
<%= link "Register", class: "hover:underline",
to: Routes.user_registration_path(LokalWeb.Endpoint, :new) %>
<%= link("Register",
class: "hover:underline",
to: Routes.user_registration_path(LokalWeb.Endpoint, :new)
) %>
</li>
<li>
<%= link "Log in", class: "hover:underline",
to: Routes.user_session_path(LokalWeb.Endpoint, :new) %>
<%= link("Log in",
class: "hover:underline",
to: Routes.user_session_path(LokalWeb.Endpoint, :new)
) %>
</li>
<% end %>
</ul>
</div>
</nav>
<%= if @flash && @flash |> Map.has_key?(:info) do %>
<p class="alert alert-info" role="alert"
phx-click="lv:clear-flash" phx-value-key="info">
<p class="alert alert-info" role="alert" phx-click="lv:clear-flash" phx-value-key="info">
<%= live_flash(@flash, :info) %>
</p>
<% end %>
<%= if @flash && @flash |> Map.has_key?(:error) do %>
<p class="alert alert-danger" role="alert"
phx-click="lv:clear-flash" phx-value-key="error">
<p class="alert alert-danger" role="alert" phx-click="lv:clear-flash" phx-value-key="error">
<%= live_flash(@flash, :error) %>
</p>
<% end %>

View File

@ -1,19 +1,16 @@
<main class="container min-h-full min-w-full">
<header class="mb-4 px-8 py-4 w-full bg-primary-400">
<%= render "topbar.html", assigns %>
<%= render("topbar.html", assigns) %>
<%= if get_flash(@conn, :info) do %>
<p class="alert alert-info" role="alert">
<%= get_flash(@conn, :info) %>
</p>
<% end %>
<%= if get_flash(@conn, :error) do %>
<p class="alert alert-danger" role="alert">
<%= get_flash(@conn, :error) %>
</p>
<% end %>
</header>
<%= @inner_content %>
</main>

View File

@ -1,19 +1,15 @@
<main class="container">
<LokalWeb.Component.Topbar.topbar
current_user={assigns[:current_user]}>
<LokalWeb.Component.Topbar.topbar current_user={assigns[:current_user]}>
</LokalWeb.Component.Topbar.topbar>
<%= if @flash && @flash |> Map.has_key?(:info) do %>
<p class="alert alert-info" role="alert"
phx-click="lv:clear-flash"
phx-value-key="info"><%= live_flash(@flash, :info) %></p>
<% end %>
<%= if @flash && @flash |> Map.has_key?(:error) do %>
<p class="alert alert-danger" role="alert"
phx-click="lv:clear-flash"
phx-value-key="error"><%= live_flash(@flash, :error) %></p>
<p class="alert alert-info" role="alert" phx-click="lv:clear-flash" phx-value-key="info">
<%= live_flash(@flash, :info) %>
</p>
<% end %>
<%= if @flash && @flash |> Map.has_key?(:error) do %>
<p class="alert alert-danger" role="alert" phx-click="lv:clear-flash" phx-value-key="error">
<%= live_flash(@flash, :error) %>
</p>
<% end %>
<%= @inner_content %>
</main>

View File

@ -1,13 +1,19 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<%= csrf_meta_tag() %>
<%= live_title_tag assigns[:page_title] || "Lokal", suffix: "" %>
<link phx-track-static rel="stylesheet" href={Routes.static_path(@conn, "/css/app.css")}/>
<script defer phx-track-static type="text/javascript" src={Routes.static_path(@conn, "/js/app.js")}></script>
<%= live_title_tag(assigns[:page_title] || "Lokal", suffix: "") %>
<link phx-track-static rel="stylesheet" href={Routes.static_path(@conn, "/css/app.css")} />
<script
defer
phx-track-static
type="text/javascript"
src={Routes.static_path(@conn, "/js/app.js")}
>
</script>
</head>
<body class="m-0 p-0 min-w-full min-h-full">
<%= @inner_content %>