build color, font, and size lists
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
defmodule LabelmakerWeb.Home do
|
defmodule LabelmakerWeb.Home do
|
||||||
use LabelmakerWeb, :live_view
|
use LabelmakerWeb, :live_view
|
||||||
|
alias LabelmakerWeb.Constants
|
||||||
|
|
||||||
def mount(_params, _session, socket) do
|
def mount(_params, _session, socket) do
|
||||||
{:ok,
|
{:ok,
|
||||||
@@ -37,27 +38,19 @@ defmodule LabelmakerWeb.Home do
|
|||||||
{@label}
|
{@label}
|
||||||
</div>
|
</div>
|
||||||
<select name="font" value={@font}>
|
<select name="font" value={@font}>
|
||||||
<option value="Helvetica" selected={@font == "Helvetica"}>Helvetica</option>
|
<%= for font <- Constants.fonts() do %>
|
||||||
<option value="Courier" selected={@font == "Courier"}>Courier</option>
|
<option value={font} selected={@font == font}>{font}</option>
|
||||||
<option value="Times" selected={@font == "Times"}>Times</option>
|
<% end %>
|
||||||
</select>
|
</select>
|
||||||
<select name="color" value={@color}>
|
<select name="color" value={@color}>
|
||||||
<option value="red" selected={@color == "red"}>red</option>
|
<%= for color <- Constants.colors() do %>
|
||||||
<option value="orange" selected={@color == "orange"}>orange</option>
|
<option value={color} selected={@color == color}>{color}</option>
|
||||||
<option value="yellow" selected={@color == "yellow"}>yellow</option>
|
<% end %>
|
||||||
<option value="green" selected={@color == "green"}>green</option>
|
|
||||||
<option value="blue" selected={@color == "blue"}>blue</option>
|
|
||||||
<option value="indigo" selected={@color == "indigo"}>indigo</option>
|
|
||||||
<option value="violet" selected={@color == "violet"}>violet</option>
|
|
||||||
</select>
|
</select>
|
||||||
<select name="size" value={@size}>
|
<select name="size" value={@size}>
|
||||||
<option value="8" selected={@size == "8"}>8</option>
|
<%= for size <- Constants.sizes() do %>
|
||||||
<option value="12" selected={@size == "12"}>12</option>
|
<option value={size} selected={@size == size}>{size}</option>
|
||||||
<option value="16" selected={@size == "16"}>16</option>
|
<% end %>
|
||||||
<option value="20" selected={@size == "20"}>20</option>
|
|
||||||
<option value="24" selected={@size == "24"}>24</option>
|
|
||||||
<option value="28" selected={@size == "28"}>28</option>
|
|
||||||
<option value="32" selected={@size == "32"}>32</option>
|
|
||||||
</select>
|
</select>
|
||||||
<button type="submit">Create</button>
|
<button type="submit">Create</button>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
defmodule LabelmakerWeb.Label do
|
defmodule LabelmakerWeb.Label do
|
||||||
use LabelmakerWeb, :live_view
|
use LabelmakerWeb, :live_view
|
||||||
|
alias LabelmakerWeb.Constants
|
||||||
|
|
||||||
@label_dir Path.join(:code.priv_dir(:labelmaker), "static/labels")
|
@label_dir Path.join(:code.priv_dir(:labelmaker), "static/labels")
|
||||||
File.mkdir_p!(@label_dir)
|
File.mkdir_p!(@label_dir)
|
||||||
@@ -40,6 +41,12 @@ defmodule LabelmakerWeb.Label do
|
|||||||
end
|
end
|
||||||
|
|
||||||
def render(assigns) do
|
def render(assigns) do
|
||||||
|
IO.inspect(Constants.color_count())
|
||||||
|
IO.inspect(Constants.colors())
|
||||||
|
|
||||||
|
IO.inspect(Constants.font_count())
|
||||||
|
IO.inspect(Constants.fonts())
|
||||||
|
|
||||||
~H"""
|
~H"""
|
||||||
<div>
|
<div>
|
||||||
<h1>Label: {@label}</h1>
|
<h1>Label: {@label}</h1>
|
||||||
|
|||||||
Reference in New Issue
Block a user