forked from shibao/cannery
update viewhelpers
This commit is contained in:
parent
2ac379adaf
commit
d80b80ea22
@ -12,6 +12,9 @@ if System.get_env("PHX_SERVER") && System.get_env("RELEASE_NAME") do
|
|||||||
config :cannery, CanneryWeb.Endpoint, server: true
|
config :cannery, CanneryWeb.Endpoint, server: true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
config :cannery, CanneryWeb.ViewHelpers,
|
||||||
|
shibao_mode: System.get_env("SHIBAO_MODE") == "true"
|
||||||
|
|
||||||
# Set locale
|
# Set locale
|
||||||
Gettext.put_locale(System.get_env("LOCALE") || "en_US")
|
Gettext.put_locale(System.get_env("LOCALE") || "en_US")
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
<%= if @containers |> Enum.empty?() do %>
|
<%= if @containers |> Enum.empty?() do %>
|
||||||
<h2 class="title text-xl text-primary-500">
|
<h2 class="title text-xl text-primary-500">
|
||||||
<%= gettext("No other containers") %> 😔
|
<%= gettext("No other containers") %> <%= display_emoji("😔") %>
|
||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
<%= live_patch(dgettext("actions", "Add another container!"),
|
<%= live_patch(dgettext("actions", "Add another container!"),
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
<%= if @ammo_groups |> Enum.empty?() do %>
|
<%= if @ammo_groups |> Enum.empty?() do %>
|
||||||
<h2 class="title text-xl text-primary-500">
|
<h2 class="title text-xl text-primary-500">
|
||||||
<%= gettext("No Ammo") %> 😔
|
<%= gettext("No Ammo") %> <%= display_emoji("😔") %>
|
||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
<%= live_patch(dgettext("actions", "Add your first box!"),
|
<%= live_patch(dgettext("actions", "Add your first box!"),
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
<%= if @ammo_types |> Enum.empty?() do %>
|
<%= if @ammo_types |> Enum.empty?() do %>
|
||||||
<h2 class="title text-xl text-primary-500">
|
<h2 class="title text-xl text-primary-500">
|
||||||
<%= gettext("No Ammo Types") %> 😔
|
<%= gettext("No Ammo Types") %> <%= display_emoji("😔") %>
|
||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
<%= live_patch(dgettext("actions", "Add your first type!"),
|
<%= live_patch(dgettext("actions", "Add your first type!"),
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
<%= if @containers |> Enum.empty?() do %>
|
<%= if @containers |> Enum.empty?() do %>
|
||||||
<h2 class="title text-xl text-primary-500">
|
<h2 class="title text-xl text-primary-500">
|
||||||
<%= gettext("No containers") %> 😔
|
<%= gettext("No containers") %> <%= display_emoji("😔") %>
|
||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
<%= live_patch(dgettext("actions", "Add your first container!"),
|
<%= live_patch(dgettext("actions", "Add your first container!"),
|
||||||
|
@ -44,7 +44,7 @@
|
|||||||
<%= if @container.tags |> Enum.empty?() do %>
|
<%= if @container.tags |> Enum.empty?() do %>
|
||||||
<div class="flex flex-row justify-center items-center space-x-4">
|
<div class="flex flex-row justify-center items-center space-x-4">
|
||||||
<h2 class="title text-lg text-primary-500">
|
<h2 class="title text-lg text-primary-500">
|
||||||
<%= gettext("No tags for this container") %> 😔
|
<%= gettext("No tags for this container") %> <%= display_emoji("😔") %>
|
||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
<%= live_patch(dgettext("actions", "Why not add one?"),
|
<%= live_patch(dgettext("actions", "Why not add one?"),
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
<%= if @invites |> Enum.empty?() do %>
|
<%= if @invites |> Enum.empty?() do %>
|
||||||
<h1 class="title text-xl text-primary-500">
|
<h1 class="title text-xl text-primary-500">
|
||||||
<%= gettext("No invites") %> 😔
|
<%= gettext("No invites") %> <%= display_emoji("😔") %>
|
||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
<%= live_patch(dgettext("actions", "Invite someone new!"),
|
<%= live_patch(dgettext("actions", "Invite someone new!"),
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
<%= if @ammo_groups |> Enum.empty?() do %>
|
<%= if @ammo_groups |> Enum.empty?() do %>
|
||||||
<h1 class="title text-xl text-primary-500">
|
<h1 class="title text-xl text-primary-500">
|
||||||
<%= gettext("No ammo staged") %> 😔
|
<%= gettext("No ammo staged") %> <%= display_emoji("😔") %>
|
||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
<%= live_patch(dgettext("actions", "Why not get some ready to shoot?"),
|
<%= live_patch(dgettext("actions", "Why not get some ready to shoot?"),
|
||||||
@ -42,7 +42,7 @@
|
|||||||
|
|
||||||
<%= if @shot_groups |> Enum.empty?() do %>
|
<%= if @shot_groups |> Enum.empty?() do %>
|
||||||
<h1 class="title text-xl text-primary-500">
|
<h1 class="title text-xl text-primary-500">
|
||||||
<%= gettext("No shots recorded") %> 😔
|
<%= gettext("No shots recorded") %> <%= display_emoji("😔") %>
|
||||||
</h1>
|
</h1>
|
||||||
<% else %>
|
<% else %>
|
||||||
<h1 class="title text-2xl text-primary-500">
|
<h1 class="title text-2xl text-primary-500">
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
</p>
|
</p>
|
||||||
<%= if @tags |> Enum.empty?() do %>
|
<%= if @tags |> Enum.empty?() do %>
|
||||||
<h2 class="title text-xl text-primary-500">
|
<h2 class="title text-xl text-primary-500">
|
||||||
<%= gettext("No tags") %> 😔
|
<%= gettext("No tags") %> <%= display_emoji("😔") %>
|
||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
<%= live_patch(dgettext("actions", "Make your first tag!"),
|
<%= live_patch(dgettext("actions", "Make your first tag!"),
|
||||||
|
@ -53,4 +53,11 @@ defmodule CanneryWeb.ViewHelpers do
|
|||||||
</time>
|
</time>
|
||||||
"""
|
"""
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@doc """
|
||||||
|
Displays emoji as text emoji if SHIBAO_MODE is set to true :)
|
||||||
|
"""
|
||||||
|
@spec display_emoji(String.t()) :: String.t()
|
||||||
|
def display_emoji("😔"), do: if Application.get_env(:cannery, CanneryWeb.ViewHelpers)[:shibao_mode], do: "q_q", else: "😔"
|
||||||
|
def display_emoji(other_emoji), do: other_emoji
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user