diff --git a/lib/pinchflat/utils/string_utils.ex b/lib/pinchflat/utils/string_utils.ex
index d96d6c10..bee23b50 100644
--- a/lib/pinchflat/utils/string_utils.ex
+++ b/lib/pinchflat/utils/string_utils.ex
@@ -41,4 +41,15 @@ defmodule Pinchflat.Utils.StringUtils do
string
end
end
+
+ @doc """
+ Wraps a string in double braces. Useful as a UI helper now that
+ LiveView 1.0.0 allows `{}` for interpolation so now we can't use braces
+ directly in the view.
+
+ Returns binary()
+ """
+ def double_brace(string) do
+ "{{ #{string} }}"
+ end
end
diff --git a/lib/pinchflat_web.ex b/lib/pinchflat_web.ex
index ef58d005..28d58077 100644
--- a/lib/pinchflat_web.ex
+++ b/lib/pinchflat_web.ex
@@ -100,6 +100,7 @@ defmodule PinchflatWeb do
import PinchflatWeb.CustomComponents.TextComponents
import PinchflatWeb.CustomComponents.TableComponents
import PinchflatWeb.CustomComponents.ButtonComponents
+ import Pinchflat.Utils.StringUtils, only: [double_brace: 1]
alias Pinchflat.Settings
alias Pinchflat.Utils.StringUtils
diff --git a/lib/pinchflat_web/components/core_components.ex b/lib/pinchflat_web/components/core_components.ex
index 8f5ff759..e66e236f 100644
--- a/lib/pinchflat_web/components/core_components.ex
+++ b/lib/pinchflat_web/components/core_components.ex
@@ -82,7 +82,7 @@ defmodule PinchflatWeb.CoreComponents do
- <%= render_slot(@inner_block) %>
+ {render_slot(@inner_block)}
@@ -126,9 +126,9 @@ defmodule PinchflatWeb.CoreComponents do
]}>
- <%= render_slot(@inner_block, f) %>
+ {render_slot(@inner_block, f)}
- <%= render_slot(action, f) %>
+ {render_slot(action, f)}
"""
@@ -297,11 +297,11 @@ defmodule PinchflatWeb.CoreComponents do
class={["rounded focus:ring-0", @inputclass]}
{@rest}
/>
- <%= @label %>
- <%= @label_suffix %>
+ {@label}
+ {@label_suffix}
- <.help :if={@help}><%= if @html_help, do: Phoenix.HTML.raw(@help), else: @help %>
- <.error :for={msg <- @errors}><%= msg %>
+ <.help :if={@help}>{if @html_help, do: Phoenix.HTML.raw(@help), else: @help}
+ <.error :for={msg <- @errors}>{msg}
"""
end
@@ -310,7 +310,7 @@ defmodule PinchflatWeb.CoreComponents do
~H"""
<.label for={@id}>
- <%= @label %>
<%= @label_suffix %>
+ {@label}
{@label_suffix}
@@ -323,12 +323,12 @@ defmodule PinchflatWeb.CoreComponents do
class={["rounded focus:ring-offset-0 ring-offset-0 focus:ring-0 h-5 w-5 ", @inputclass]}
/>
- <%= option_name %>
+ {option_name}
- <.help :if={@help}><%= if @html_help, do: Phoenix.HTML.raw(@help), else: @help %>
- <.error :for={msg <- @errors}><%= msg %>
+ <.help :if={@help}>{if @html_help, do: Phoenix.HTML.raw(@help), else: @help}
+ <.error :for={msg <- @errors}>{msg}
"""
end
@@ -342,8 +342,8 @@ defmodule PinchflatWeb.CoreComponents do
~H"""
<.label :if={@label} for={@id}>
- <%= @label %>
-
<%= @label_suffix %>
+ {@label}
+
{@label_suffix}
@@ -359,8 +359,8 @@ defmodule PinchflatWeb.CoreComponents do
>
- <.help :if={@help}><%= if @html_help, do: Phoenix.HTML.raw(@help), else: @help %>
- <.error :for={msg <- @errors}><%= msg %>
+ <.help :if={@help}>{if @html_help, do: Phoenix.HTML.raw(@help), else: @help}
+ <.error :for={msg <- @errors}>{msg}
"""
@@ -370,7 +370,7 @@ defmodule PinchflatWeb.CoreComponents do
~H"""
<.label :if={@label} for={@id}>
- <%= @label %>
<%= @label_suffix %>
+ {@label}
{@label_suffix}
- <%= @prompt %>
- <%= Phoenix.HTML.Form.options_for_select(@options, @value) %>
+ {@prompt}
+ {Phoenix.HTML.Form.options_for_select(@options, @value)}
- <%= render_slot(@inner_block) %>
+ {render_slot(@inner_block)}
- <.help :if={@help}><%= if @html_help, do: Phoenix.HTML.raw(@help), else: @help %>
- <.error :for={msg <- @errors}><%= msg %>
+ <.help :if={@help}>{if @html_help, do: Phoenix.HTML.raw(@help), else: @help}
+ <.error :for={msg <- @errors}>{msg}
"""
end
@@ -400,7 +400,7 @@ defmodule PinchflatWeb.CoreComponents do
~H"""
<.label for={@id}>
- <%= @label %><%= @label_suffix %>
+ {@label}{@label_suffix}
- <.help :if={@help}><%= if @html_help, do: Phoenix.HTML.raw(@help), else: @help %>
- <.error :for={msg <- @errors}><%= msg %>
+ <.help :if={@help}>{if @html_help, do: Phoenix.HTML.raw(@help), else: @help}
+ <.error :for={msg <- @errors}>{msg}
"""
end
@@ -425,7 +425,7 @@ defmodule PinchflatWeb.CoreComponents do
~H"""
<.label for={@id}>
- <%= @label %>
<%= @label_suffix %>
+ {@label}
{@label_suffix}
- <%= render_slot(@input_append) %>
+ {render_slot(@input_append)}
- <.help :if={@help}><%= if @html_help, do: Phoenix.HTML.raw(@help), else: @help %>
- <.error :for={msg <- @errors}><%= msg %>
+ <.help :if={@help}>{if @html_help, do: Phoenix.HTML.raw(@help), else: @help}
+ <.error :for={msg <- @errors}>{msg}
"""
end
@@ -458,7 +458,7 @@ defmodule PinchflatWeb.CoreComponents do
def help(assigns) do
~H"""
- <%= render_slot(@inner_block) %>
+ {render_slot(@inner_block)}
"""
end
@@ -472,7 +472,7 @@ defmodule PinchflatWeb.CoreComponents do
def label(assigns) do
~H"""
- <%= render_slot(@inner_block) %>
+ {render_slot(@inner_block)}
"""
end
@@ -486,7 +486,7 @@ defmodule PinchflatWeb.CoreComponents do
~H"""
<.icon name="hero-exclamation-circle-mini" class="mt-0.5 h-5 w-5 flex-none" />
- <%= render_slot(@inner_block) %>
+ {render_slot(@inner_block)}
"""
end
@@ -505,13 +505,13 @@ defmodule PinchflatWeb.CoreComponents do
"""
end
@@ -551,9 +551,9 @@ defmodule PinchflatWeb.CoreComponents do
- <%= col[:label] %>
+ {col[:label]}
- <%= gettext("Actions") %>
+ {gettext("Actions")}
@@ -571,7 +571,7 @@ defmodule PinchflatWeb.CoreComponents do
- <%= render_slot(col, @row_item.(row)) %>
+ {render_slot(col, @row_item.(row))}
@@ -579,7 +579,7 @@ defmodule PinchflatWeb.CoreComponents do
- <%= render_slot(action, @row_item.(row)) %>
+ {render_slot(action, @row_item.(row))}
@@ -608,8 +608,8 @@ defmodule PinchflatWeb.CoreComponents do
-
<%= item.title %>
- <%= render_slot(item) %>
+ {item.title}
+ {render_slot(item)}
@@ -644,12 +644,12 @@ defmodule PinchflatWeb.CoreComponents do
~H"""
- <%= k %>:
+ {k}:
<%= if is_binary(v) && URI.parse(v).scheme && URI.parse(v).scheme =~ "http" do %>
- <%= v %>
+ {v}
<% else %>
- <%= v %>
+ {v}
<% end %>
@@ -672,7 +672,7 @@ defmodule PinchflatWeb.CoreComponents do
<.link href={@href} class="text-sm font-semibold leading-6 text-zinc-900 hover:text-zinc-700">
<.icon name="hero-arrow-left-solid" class="h-3 w-3" />
- <%= render_slot(@inner_block) %>
+ {render_slot(@inner_block)}
"""
diff --git a/lib/pinchflat_web/components/custom_components/button_components.ex b/lib/pinchflat_web/components/custom_components/button_components.ex
index 61a8ed10..9942ebcb 100644
--- a/lib/pinchflat_web/components/custom_components/button_components.ex
+++ b/lib/pinchflat_web/components/custom_components/button_components.ex
@@ -37,7 +37,7 @@ defmodule PinchflatWeb.CustomComponents.ButtonComponents do
disabled={@disabled}
{@rest}
>
- <%= render_slot(@inner_block) %>
+ {render_slot(@inner_block)}
"""
end
@@ -66,7 +66,7 @@ defmodule PinchflatWeb.CustomComponents.ButtonComponents do
"font-medium text-white hover:bg-opacity-95"
]}
>
- <%= @text %>
+ {@text}
- <%= render_slot(option) %>
+ {render_slot(option)}
@@ -126,7 +126,7 @@ defmodule PinchflatWeb.CustomComponents.ButtonComponents do
>
- <%= @tooltip %>
+ {@tooltip}
"""
diff --git a/lib/pinchflat_web/components/custom_components/tab_components.ex b/lib/pinchflat_web/components/custom_components/tab_components.ex
index 56cfe2a1..baade530 100644
--- a/lib/pinchflat_web/components/custom_components/tab_components.ex
+++ b/lib/pinchflat_web/components/custom_components/tab_components.ex
@@ -34,16 +34,16 @@ defmodule PinchflatWeb.CustomComponents.TabComponents do
x-bind:class={"openTab === '#{tab.id}' ? activeClasses : inactiveClasses"}
class="border-b-2 py-4 w-full sm:w-fit text-sm font-medium hover:text-meta-5 md:text-base"
>
- <%= tab.title %>
+ {tab.title}
- <%= render_slot(@tab_append) %>
+ {render_slot(@tab_append)}
- <%= render_slot(tab) %>
+ {render_slot(tab)}
diff --git a/lib/pinchflat_web/components/custom_components/table_components.ex b/lib/pinchflat_web/components/custom_components/table_components.ex
index 464de2ee..7c661bab 100644
--- a/lib/pinchflat_web/components/custom_components/table_components.ex
+++ b/lib/pinchflat_web/components/custom_components/table_components.ex
@@ -32,7 +32,7 @@ defmodule PinchflatWeb.CustomComponents.TableComponents do
- <%= col[:label] %>
+ {col[:label]}
@@ -45,7 +45,7 @@ defmodule PinchflatWeb.CustomComponents.TableComponents do
col[:class]
]}
>
- <%= render_slot(col, @row_item.(row)) %>
+ {render_slot(col, @row_item.(row))}
diff --git a/lib/pinchflat_web/components/custom_components/text_components.ex b/lib/pinchflat_web/components/custom_components/text_components.ex
index 9319c553..d2bc8f6f 100644
--- a/lib/pinchflat_web/components/custom_components/text_components.ex
+++ b/lib/pinchflat_web/components/custom_components/text_components.ex
@@ -12,7 +12,7 @@ defmodule PinchflatWeb.CustomComponents.TextComponents do
def inline_code(assigns) do
~H"""
- <%= render_slot(@inner_block) %>
+ {render_slot(@inner_block)}
"""
end
@@ -26,7 +26,7 @@ defmodule PinchflatWeb.CustomComponents.TextComponents do
def inline_link(assigns) do
~H"""
<.link href={@href} target="_blank" class="text-blue-500 hover:text-blue-300">
- <%= render_slot(@inner_block) %>
+ {render_slot(@inner_block)}
"""
end
@@ -41,7 +41,7 @@ defmodule PinchflatWeb.CustomComponents.TextComponents do
def subtle_link(assigns) do
~H"""
<.link href={@href} target={@target} class="underline decoration-bodydark decoration-1 hover:decoration-white">
- <%= render_slot(@inner_block) %>
+ {render_slot(@inner_block)}
"""
end
@@ -82,7 +82,7 @@ defmodule PinchflatWeb.CustomComponents.TextComponents do
assigns = Map.put(assigns, :text, formatted_text)
~H"""
- <%= @text %>
+ {@text}
"""
end
@@ -98,7 +98,7 @@ defmodule PinchflatWeb.CustomComponents.TextComponents do
assigns = Map.put(assigns, :timezone, timezone)
~H"""
- <%= Calendar.strftime(Timex.Timezone.convert(@datetime, @timezone), @format) %>
+ {Calendar.strftime(Timex.Timezone.convert(@datetime, @timezone), @format)}
"""
end
@@ -109,7 +109,7 @@ defmodule PinchflatWeb.CustomComponents.TextComponents do
def localized_number(assigns) do
~H"""
- <%= @number %>
+ {@number}
"""
end
@@ -122,7 +122,7 @@ defmodule PinchflatWeb.CustomComponents.TextComponents do
def pluralize(assigns) do
~H"""
- <%= @word %><%= if @count == 1, do: "", else: @suffix %>
+ {@word}{if @count == 1, do: "", else: @suffix}
"""
end
end
diff --git a/lib/pinchflat_web/components/layouts.ex b/lib/pinchflat_web/components/layouts.ex
index fd4e4f4a..2dacac28 100644
--- a/lib/pinchflat_web/components/layouts.ex
+++ b/lib/pinchflat_web/components/layouts.ex
@@ -61,7 +61,7 @@ defmodule PinchflatWeb.Layouts do
x-on:click="selected = !selected"
>
- <.icon name={@icon} /> <%= @text %>
+ <.icon name={@icon} /> {@text}
<.icon name="hero-chevron-down" x-bind:class="{ 'rotate-180': selected }" />
@@ -103,7 +103,7 @@ defmodule PinchflatWeb.Layouts do
@class
]}
>
- <.icon :if={@icon} name={@icon} /> <%= @text %>
+ <.icon :if={@icon} name={@icon} /> {@text}
"""
end
diff --git a/lib/pinchflat_web/components/layouts/app.html.heex b/lib/pinchflat_web/components/layouts/app.html.heex
index 63762ff4..491035cd 100644
--- a/lib/pinchflat_web/components/layouts/app.html.heex
+++ b/lib/pinchflat_web/components/layouts/app.html.heex
@@ -6,7 +6,7 @@
<.flash_group flash={@flash} />
- <%= @inner_content %>
+ {@inner_content}
diff --git a/lib/pinchflat_web/components/layouts/onboarding.html.heex b/lib/pinchflat_web/components/layouts/onboarding.html.heex
index b2b4e976..e7f24d96 100644
--- a/lib/pinchflat_web/components/layouts/onboarding.html.heex
+++ b/lib/pinchflat_web/components/layouts/onboarding.html.heex
@@ -11,7 +11,7 @@
<.flash_group flash={@flash} />
- <%= @inner_content %>
+ {@inner_content}
diff --git a/lib/pinchflat_web/components/layouts/partials/sidebar.html.heex b/lib/pinchflat_web/components/layouts/partials/sidebar.html.heex
index 2d7ae0d2..e5e5b390 100644
--- a/lib/pinchflat_web/components/layouts/partials/sidebar.html.heex
+++ b/lib/pinchflat_web/components/layouts/partials/sidebar.html.heex
@@ -67,7 +67,7 @@
class="group relative flex items-center gap-2.5 px-4 pt-2 text-sm"
x-on:click={"markVersionAsSeen('#{Application.spec(:pinchflat)[:vsn]}')"}
>
- Pinchflat <%= Application.spec(:pinchflat)[:vsn] %>
+ Pinchflat {Application.spec(:pinchflat)[:vsn]}
- yt-dlp <%= Settings.get!(:yt_dlp_version) %>
+ yt-dlp {Settings.get!(:yt_dlp_version)}
diff --git a/lib/pinchflat_web/components/layouts/partials/upgrade_modal.heex b/lib/pinchflat_web/components/layouts/partials/upgrade_modal.heex
index 64226181..cbf5bc47 100644
--- a/lib/pinchflat_web/components/layouts/partials/upgrade_modal.heex
+++ b/lib/pinchflat_web/components/layouts/partials/upgrade_modal.heex
@@ -25,6 +25,6 @@
into the text box and press the button.
- <%= live_render(@conn, Pinchflat.UpgradeButtonLive) %>
+ {live_render(@conn, Pinchflat.UpgradeButtonLive)}
diff --git a/lib/pinchflat_web/components/layouts/root.html.heex b/lib/pinchflat_web/components/layouts/root.html.heex
index ba870864..4068d74a 100644
--- a/lib/pinchflat_web/components/layouts/root.html.heex
+++ b/lib/pinchflat_web/components/layouts/root.html.heex
@@ -5,7 +5,7 @@
<.live_title>
- <%= assigns[:page_title] || "Pinchflat" %>
+ {assigns[:page_title] || "Pinchflat"}
@@ -21,7 +21,7 @@
class="dark text-bodydark bg-boxdark-2"
data-socket-path={Path.join(Application.get_env(:pinchflat, :base_route_path), "/live")}
>
- <%= @inner_content %>
+ {@inner_content}
<.donate_modal conn={@conn} />
diff --git a/lib/pinchflat_web/controllers/media_items/media_item_html/edit.html.heex b/lib/pinchflat_web/controllers/media_items/media_item_html/edit.html.heex
index 0924a771..c834602b 100644
--- a/lib/pinchflat_web/controllers/media_items/media_item_html/edit.html.heex
+++ b/lib/pinchflat_web/controllers/media_items/media_item_html/edit.html.heex
@@ -1,6 +1,6 @@
- Editing "<%= StringUtils.truncate(@media_item.title, 35) %>"
+ Editing "{StringUtils.truncate(@media_item.title, 35)}"
diff --git a/lib/pinchflat_web/controllers/media_items/media_item_html/show.html.heex b/lib/pinchflat_web/controllers/media_items/media_item_html/show.html.heex
index 76f8124c..881b34d3 100644
--- a/lib/pinchflat_web/controllers/media_items/media_item_html/show.html.heex
+++ b/lib/pinchflat_web/controllers/media_items/media_item_html/show.html.heex
@@ -4,7 +4,7 @@
<.icon name="hero-arrow-left" class="w-10 h-10 hover:dark:text-white" />
- <%= StringUtils.truncate(@media_item.title, 35) %>
+ {StringUtils.truncate(@media_item.title, 35)}
@@ -31,8 +31,8 @@
<.media_preview media_item={@media_item} />
- <%= @media_item.title %>
- Uploaded: <%= DateTime.to_date(@media_item.uploaded_at) %>
+ {@media_item.title}
+ Uploaded: {DateTime.to_date(@media_item.uploaded_at)}
<.subtle_link href={@media_item.original_url} target="_blank">Open Original
@@ -58,7 +58,7 @@
Source:
<.subtle_link href={~p"/sources/#{@media_item.source_id}"}>
- <%= @media_item.source.custom_name %>
+ {@media_item.source.custom_name}
<.list_items_from_map map={Map.from_struct(@media_item)} />
@@ -68,10 +68,10 @@
<%= if match?([_|_], @media_item.tasks) do %>
<.table rows={@media_item.tasks} table_class="text-black dark:text-white">
<:col :let={task} label="Worker">
- <%= task.job.worker %>
+ {task.job.worker}
<:col :let={task} label="State">
- <%= task.job.state %>
+ {task.job.state}
<:col :let={task} label="Scheduled At">
<.datetime_in_zone datetime={task.job.scheduled_at} />
diff --git a/lib/pinchflat_web/controllers/media_profiles/media_profile_html/edit.html.heex b/lib/pinchflat_web/controllers/media_profiles/media_profile_html/edit.html.heex
index a56fea89..c663f571 100644
--- a/lib/pinchflat_web/controllers/media_profiles/media_profile_html/edit.html.heex
+++ b/lib/pinchflat_web/controllers/media_profiles/media_profile_html/edit.html.heex
@@ -3,7 +3,7 @@
<.icon name="hero-arrow-left" class="w-10 h-10 hover:dark:text-white" />
- Editing "<%= @media_profile.name %>"
+ Editing "{@media_profile.name}"
diff --git a/lib/pinchflat_web/controllers/media_profiles/media_profile_html/index.html.heex b/lib/pinchflat_web/controllers/media_profiles/media_profile_html/index.html.heex
index cff9635c..fedfa741 100644
--- a/lib/pinchflat_web/controllers/media_profiles/media_profile_html/index.html.heex
+++ b/lib/pinchflat_web/controllers/media_profiles/media_profile_html/index.html.heex
@@ -16,11 +16,11 @@
<.table rows={@media_profiles} table_class="text-black dark:text-white">
<:col :let={media_profile} label="Name">
<.subtle_link href={~p"/media_profiles/#{media_profile.id}"}>
- <%= media_profile.name %>
+ {media_profile.name}
<:col :let={media_profile} label="Preferred Resolution">
- <%= media_profile.preferred_resolution %>
+ {media_profile.preferred_resolution}
<:col :let={media_profile} label="Sources">
<.subtle_link href={~p"/media_profiles/#{media_profile.id}/#tab-sources"}>
diff --git a/lib/pinchflat_web/controllers/media_profiles/media_profile_html/output_template_help.html.heex b/lib/pinchflat_web/controllers/media_profiles/media_profile_html/output_template_help.html.heex
index 10e09e36..e17e8467 100644
--- a/lib/pinchflat_web/controllers/media_profiles/media_profile_html/output_template_help.html.heex
+++ b/lib/pinchflat_web/controllers/media_profiles/media_profile_html/output_template_help.html.heex
@@ -6,7 +6,9 @@
Liquid-style:
- <.inline_code>/{{ channel }}/{{ title }} - {{ id }}.{{ ext }}
+ <.inline_code>
+ {"/#{double_brace("channel")}/#{double_brace("title")} - #{double_brace("id")}.#{double_brace("ext")}"}
+
yt-dlp
-style
@@ -17,7 +19,7 @@
Any bare words:
- <.inline_code>/videos/1080p/{{ id }}.{{ ext }}
+ <.inline_code>{"/videos/1080p/#{double_brace("id")}.#{double_brace("ext")}"}
@@ -25,7 +27,7 @@
any
single-word yt-dlp
option can be used as liquid-style and it's automatically made filepath-safe. For example, the
- <.inline_code>{{ duration }}
+ <.inline_code>{double_brace("duration")}
option is translated to
<.inline_code>%(duration)S
@@ -33,12 +35,14 @@
Major 🔑:
these syntaxes can be mixed and matched freely! I prefer to use liquid-style and bare words
but I'll include yt-dlp
-style when I need more control. For example:
- <.inline_code>/1080p/{{ channel }}/{{ title }}-(%(subtitles.en.-1.ext)s).{{ ext }}
+ <.inline_code>
+ {"/1080p/#{double_brace("channel")}/#{double_brace("title")}-(%(subtitles.en.-1.ext)s).#{double_brace("ext")}"}
+
NOTE:
Your template must
- end with an extension option (<.inline_code>.{{ ext }}
+ end with an extension option (<.inline_code>.{double_brace("ext")}
or
<.inline_code>.%(ext)S).
Downloading won't work as expected without it.
@@ -59,21 +63,21 @@
Media Center Custom Aliases
- <.inline_code>{{ <%= k %> }}
- - <%= html_escape({:safe, v}) %>
+ <.inline_code>{double_brace(k)}
+ - {html_escape({:safe, v})}
Other Custom Aliases
- <.inline_code>{{ <%= k %> }}
- - <%= html_escape({:safe, v}) %>
+ <.inline_code>{double_brace(k)}
+ - {html_escape({:safe, v})}
Common Options
- <.inline_code>{{ <%= opt %> }}
+ <.inline_code>{double_brace(opt)}
diff --git a/lib/pinchflat_web/controllers/media_profiles/media_profile_html/show.html.heex b/lib/pinchflat_web/controllers/media_profiles/media_profile_html/show.html.heex
index ef0629f2..892926a4 100644
--- a/lib/pinchflat_web/controllers/media_profiles/media_profile_html/show.html.heex
+++ b/lib/pinchflat_web/controllers/media_profiles/media_profile_html/show.html.heex
@@ -4,7 +4,7 @@
<.icon name="hero-arrow-left" class="w-10 h-10 hover:dark:text-white" />
- <%= @media_profile.name %>
+ {@media_profile.name}
@@ -33,10 +33,10 @@
<.table rows={@sources} table_class="text-black dark:text-white">
<:col :let={source} label="Name">
<.subtle_link href={~p"/sources/#{source.id}"}>
- <%= source.custom_name || source.collection_name %>
+ {source.custom_name || source.collection_name}
- <:col :let={source} label="Type"><%= source.collection_type %>
+ <:col :let={source} label="Type">{source.collection_type}
<:col :let={source} label="Should Download?">
<.icon name={if source.download_media, do: "hero-check", else: "hero-x-mark"} />
diff --git a/lib/pinchflat_web/controllers/pages/page_html.ex b/lib/pinchflat_web/controllers/pages/page_html.ex
index c96a6c93..f4f26657 100644
--- a/lib/pinchflat_web/controllers/pages/page_html.ex
+++ b/lib/pinchflat_web/controllers/pages/page_html.ex
@@ -17,7 +17,7 @@ defmodule PinchflatWeb.Pages.PageHTML do
})
~H"""
- <.localized_number number={@num} /> <%= @suffix %>
+ <.localized_number number={@num} /> {@suffix}
"""
end
end
diff --git a/lib/pinchflat_web/controllers/pages/page_html/history_table_live.ex b/lib/pinchflat_web/controllers/pages/page_html/history_table_live.ex
index 13919abe..ae4748be 100644
--- a/lib/pinchflat_web/controllers/pages/page_html/history_table_live.ex
+++ b/lib/pinchflat_web/controllers/pages/page_html/history_table_live.ex
@@ -30,21 +30,21 @@ defmodule Pinchflat.Pages.HistoryTableLive do
<.table rows={@records} table_class="text-white">
<:col :let={media_item} label="Title">
<.subtle_link href={~p"/sources/#{media_item.source_id}/media/#{media_item}"}>
- <%= StringUtils.truncate(media_item.title, 35) %>
+ {StringUtils.truncate(media_item.title, 35)}
<:col :let={media_item} label="Upload Date">
- <%= DateTime.to_date(media_item.uploaded_at) %>
+ {DateTime.to_date(media_item.uploaded_at)}
<:col :let={media_item} label="Indexed At">
- <%= format_datetime(media_item.inserted_at) %>
+ {format_datetime(media_item.inserted_at)}
<:col :let={media_item} label="Downloaded At">
- <%= format_datetime(media_item.media_downloaded_at) %>
+ {format_datetime(media_item.media_downloaded_at)}
<:col :let={media_item} label="Source">
<.subtle_link href={~p"/sources/#{media_item.source_id}"}>
- <%= StringUtils.truncate(media_item.source.custom_name, 35) %>
+ {StringUtils.truncate(media_item.source.custom_name, 35)}
diff --git a/lib/pinchflat_web/controllers/pages/page_html/home.html.heex b/lib/pinchflat_web/controllers/pages/page_html/home.html.heex
index 34a99cfd..bd744468 100644
--- a/lib/pinchflat_web/controllers/pages/page_html/home.html.heex
+++ b/lib/pinchflat_web/controllers/pages/page_html/home.html.heex
@@ -42,13 +42,13 @@
Media History
- <%= live_render(@conn, Pinchflat.Pages.HistoryTableLive) %>
+ {live_render(@conn, Pinchflat.Pages.HistoryTableLive)}
Active Tasks
- <%= live_render(@conn, Pinchflat.Pages.JobTableLive) %>
+ {live_render(@conn, Pinchflat.Pages.JobTableLive)}
diff --git a/lib/pinchflat_web/controllers/pages/page_html/job_table_live.ex b/lib/pinchflat_web/controllers/pages/page_html/job_table_live.ex
index d65f7247..4c3c4d43 100644
--- a/lib/pinchflat_web/controllers/pages/page_html/job_table_live.ex
+++ b/lib/pinchflat_web/controllers/pages/page_html/job_table_live.ex
@@ -19,18 +19,18 @@ defmodule Pinchflat.Pages.JobTableLive do
<.table rows={@tasks} table_class="text-white">
<:col :let={task} label="Task">
- <%= worker_to_task_name(task.job.worker) %>
+ {worker_to_task_name(task.job.worker)}
<:col :let={task} label="Subject">
<.subtle_link href={task_to_link(task)}>
- <%= StringUtils.truncate(task_to_record_name(task), 35) %>
+ {StringUtils.truncate(task_to_record_name(task), 35)}
<:col :let={task} label="Attempt No.">
- <%= task.job.attempt %>
+ {task.job.attempt}
<:col :let={task} label="Started At">
- <%= format_datetime(task.job.attempted_at) %>
+ {format_datetime(task.job.attempted_at)}
diff --git a/lib/pinchflat_web/controllers/searches/search_html.ex b/lib/pinchflat_web/controllers/searches/search_html.ex
index 1e049bea..eea90e36 100644
--- a/lib/pinchflat_web/controllers/searches/search_html.ex
+++ b/lib/pinchflat_web/controllers/searches/search_html.ex
@@ -14,7 +14,7 @@ defmodule PinchflatWeb.Searches.SearchHTML do
~H"""
<%= for fragment <- @split_string do %>
- <%= render_fragment(fragment) %>
+ {render_fragment(fragment)}
<% end %>
"""
end
diff --git a/lib/pinchflat_web/controllers/searches/search_html/show.html.heex b/lib/pinchflat_web/controllers/searches/search_html/show.html.heex
index 47a09fb1..310cc5cc 100644
--- a/lib/pinchflat_web/controllers/searches/search_html/show.html.heex
+++ b/lib/pinchflat_web/controllers/searches/search_html/show.html.heex
@@ -1,6 +1,6 @@
- Results for "<%= StringUtils.truncate(@search_term, 50) %>"
+ Results for "{StringUtils.truncate(@search_term, 50)}"
@@ -11,7 +11,7 @@
<.table rows={@search_results} table_class="text-black dark:text-white">
<:col :let={result} label="Title">
<.subtle_link href={~p"/sources/#{result.source_id}/media/#{result.id}"}>
- <%= StringUtils.truncate(result.title, 35) %>
+ {StringUtils.truncate(result.title, 35)}
<:col :let={result} label="Excerpt">
diff --git a/lib/pinchflat_web/controllers/settings/setting_html/setting_form.html.heex b/lib/pinchflat_web/controllers/settings/setting_html/setting_form.html.heex
index 2cf17016..7fe2c94d 100644
--- a/lib/pinchflat_web/controllers/settings/setting_html/setting_form.html.heex
+++ b/lib/pinchflat_web/controllers/settings/setting_html/setting_form.html.heex
@@ -19,11 +19,11 @@
- <%= live_render(
+ {live_render(
@conn,
Pinchflat.Settings.AppriseServerLive,
session: %{"value" => f[:apprise_server].value}
- ) %>
+ )}
diff --git a/lib/pinchflat_web/controllers/sources/source_html/edit.html.heex b/lib/pinchflat_web/controllers/sources/source_html/edit.html.heex
index e85cf1e1..1ce327a3 100644
--- a/lib/pinchflat_web/controllers/sources/source_html/edit.html.heex
+++ b/lib/pinchflat_web/controllers/sources/source_html/edit.html.heex
@@ -3,7 +3,7 @@
<.icon name="hero-arrow-left" class="w-10 h-10 hover:dark:text-white" />
- Editing "<%= @source.custom_name %>"
+ Editing "{@source.custom_name}"
diff --git a/lib/pinchflat_web/controllers/sources/source_html/index.html.heex b/lib/pinchflat_web/controllers/sources/source_html/index.html.heex
index 55cd45a0..b6be9231 100644
--- a/lib/pinchflat_web/controllers/sources/source_html/index.html.heex
+++ b/lib/pinchflat_web/controllers/sources/source_html/index.html.heex
@@ -12,7 +12,7 @@
- <%= live_render(@conn, PinchflatWeb.Sources.IndexTableLive) %>
+ {live_render(@conn, PinchflatWeb.Sources.IndexTableLive)}
diff --git a/lib/pinchflat_web/controllers/sources/source_html/index_table_live.ex b/lib/pinchflat_web/controllers/sources/source_html/index_table_live.ex
index 9c4992d1..bd2051c8 100644
--- a/lib/pinchflat_web/controllers/sources/source_html/index_table_live.ex
+++ b/lib/pinchflat_web/controllers/sources/source_html/index_table_live.ex
@@ -13,7 +13,7 @@ defmodule PinchflatWeb.Sources.IndexTableLive do
<.table rows={@sources} table_class="text-white">
<:col :let={source} label="Name">
<.subtle_link href={~p"/sources/#{source.id}"}>
- <%= StringUtils.truncate(source.custom_name || source.collection_name, 35) %>
+ {StringUtils.truncate(source.custom_name || source.collection_name, 35)}
<:col :let={source} label="Pending">
@@ -36,7 +36,7 @@ defmodule PinchflatWeb.Sources.IndexTableLive do
<:col :let={source} label="Media Profile">
<.subtle_link href={~p"/media_profiles/#{source.media_profile_id}"}>
- <%= source.media_profile.name %>
+ {source.media_profile.name}
<:col :let={source} label="Enabled?">
diff --git a/lib/pinchflat_web/controllers/sources/source_html/media_item_table_live.ex b/lib/pinchflat_web/controllers/sources/source_html/media_item_table_live.ex
index 678bf553..2f0fda56 100644
--- a/lib/pinchflat_web/controllers/sources/source_html/media_item_table_live.ex
+++ b/lib/pinchflat_web/controllers/sources/source_html/media_item_table_live.ex
@@ -48,14 +48,14 @@ defmodule PinchflatWeb.Sources.MediaItemTableLive do
<.table rows={@records} table_class="text-white">
<:col :let={media_item} label="Title">
<.subtle_link href={~p"/sources/#{@source.id}/media/#{media_item.id}"}>
- <%= StringUtils.truncate(media_item.title, 50) %>
+ {StringUtils.truncate(media_item.title, 50)}
<:col :let={media_item} :if={@media_state == "other"} label="Manually Ignored?">
<.icon name={if media_item.prevent_download, do: "hero-check", else: "hero-x-mark"} />
<:col :let={media_item} label="Upload Date">
- <%= DateTime.to_date(media_item.uploaded_at) %>
+ {DateTime.to_date(media_item.uploaded_at)}
<:col :let={media_item} label="" class="flex justify-end">
<.icon_link href={~p"/sources/#{@source.id}/media/#{media_item.id}/edit"} icon="hero-pencil-square" class="mr-4" />
diff --git a/lib/pinchflat_web/controllers/sources/source_html/show.html.heex b/lib/pinchflat_web/controllers/sources/source_html/show.html.heex
index f232f420..01ce6a0c 100644
--- a/lib/pinchflat_web/controllers/sources/source_html/show.html.heex
+++ b/lib/pinchflat_web/controllers/sources/source_html/show.html.heex
@@ -4,7 +4,7 @@
<.icon name="hero-arrow-left" class="w-10 h-10 hover:dark:text-white" />
- <%= @source.custom_name %>
+ {@source.custom_name}
@@ -29,7 +29,7 @@
Media Profile:
<.subtle_link href={~p"/media_profiles/#{@source.media_profile_id}"}>
- <%= @source.media_profile.name %>
+ {@source.media_profile.name}
@@ -37,34 +37,34 @@
<:tab title="Pending" id="pending">
- <%= live_render(
+ {live_render(
@conn,
PinchflatWeb.Sources.MediaItemTableLive,
session: %{"source_id" => @source.id, "media_state" => "pending"}
- ) %>
+ )}
<:tab title="Downloaded" id="downloaded">
- <%= live_render(
+ {live_render(
@conn,
PinchflatWeb.Sources.MediaItemTableLive,
session: %{"source_id" => @source.id, "media_state" => "downloaded"}
- ) %>
+ )}
<:tab title="Other" id="other">
- <%= live_render(
+ {live_render(
@conn,
PinchflatWeb.Sources.MediaItemTableLive,
session: %{"source_id" => @source.id, "media_state" => "other"}
- ) %>
+ )}
<:tab title="Tasks" id="tasks">
<%= if match?([_|_], @pending_tasks) do %>
<.table rows={@pending_tasks} table_class="text-black dark:text-white">
<:col :let={task} label="Worker">
- <%= task.job.worker %>
+ {task.job.worker}
<:col :let={task} label="State">
- <%= task.job.state %>
+ {task.job.state}
<:col :let={task} label="Scheduled At">
<.datetime_in_zone datetime={task.job.scheduled_at} />
diff --git a/test/pinchflat/utils/string_utils_test.exs b/test/pinchflat/utils/string_utils_test.exs
index 374b2934..e0af7cec 100644
--- a/test/pinchflat/utils/string_utils_test.exs
+++ b/test/pinchflat/utils/string_utils_test.exs
@@ -41,4 +41,10 @@ defmodule Pinchflat.Utils.StringUtilsTest do
assert StringUtils.truncate("hello", 10) == "hello"
end
end
+
+ describe "double_brace/1" do
+ test "wraps a string in double braces" do
+ assert StringUtils.double_brace("hello") == "{{ hello }}"
+ end
+ end
end