rename to memex
This commit is contained in:
		| @@ -1,8 +0,0 @@ | ||||
| defmodule LokalWeb.EmailView do | ||||
|   @moduledoc """ | ||||
|   A view for email-related helper functions | ||||
|   """ | ||||
|   alias LokalWeb.{Endpoint, HomeLive} | ||||
|  | ||||
|   use LokalWeb, :view | ||||
| end | ||||
| @@ -1,3 +0,0 @@ | ||||
| defmodule LokalWeb.PageView do | ||||
|   use LokalWeb, :view | ||||
| end | ||||
| @@ -1,4 +0,0 @@ | ||||
| defmodule LokalWeb.UserConfirmationView do | ||||
|   use LokalWeb, :view | ||||
|   alias Lokal.Accounts | ||||
| end | ||||
| @@ -1,3 +0,0 @@ | ||||
| defmodule LokalWeb.UserRegistrationView do | ||||
|   use LokalWeb, :view | ||||
| end | ||||
| @@ -1,4 +0,0 @@ | ||||
| defmodule LokalWeb.UserResetPasswordView do | ||||
|   use LokalWeb, :view | ||||
|   alias Lokal.Accounts | ||||
| end | ||||
| @@ -1,4 +0,0 @@ | ||||
| defmodule LokalWeb.UserSessionView do | ||||
|   use LokalWeb, :view | ||||
|   alias Lokal.Accounts | ||||
| end | ||||
| @@ -1,3 +0,0 @@ | ||||
| defmodule LokalWeb.UserSettingsView do | ||||
|   use LokalWeb, :view | ||||
| end | ||||
| @@ -1,6 +1,6 @@ | ||||
| defmodule Lokal do | ||||
| defmodule Memex do | ||||
|   @moduledoc """ | ||||
|   Lokal keeps the contexts that define your domain | ||||
|   Memex keeps the contexts that define your domain | ||||
|   and business logic. | ||||
| 
 | ||||
|   Contexts are also responsible for managing your data, regardless | ||||
| @@ -1,11 +1,11 @@ | ||||
| defmodule Lokal.Accounts do | ||||
| defmodule Memex.Accounts do | ||||
|   @moduledoc """ | ||||
|   The Accounts context. | ||||
|   """ | ||||
| 
 | ||||
|   import Ecto.Query, warn: false | ||||
|   alias Lokal.{Mailer, Repo} | ||||
|   alias Lokal.Accounts.{User, UserToken} | ||||
|   alias Memex.{Mailer, Repo} | ||||
|   alias Memex.Accounts.{User, UserToken} | ||||
|   alias Ecto.{Changeset, Multi} | ||||
|   alias Oban.Job | ||||
| 
 | ||||
| @@ -349,7 +349,7 @@ defmodule Lokal.Accounts do | ||||
|   """ | ||||
|   @spec allow_registration?() :: boolean() | ||||
|   def allow_registration? do | ||||
|     Application.get_env(:lokal, LokalWeb.Endpoint)[:registration] == "public" or | ||||
|     Application.get_env(:memex, MemexWeb.Endpoint)[:registration] == "public" or | ||||
|       list_users_by_role(:admin) |> Enum.empty?() | ||||
|   end | ||||
| 
 | ||||
| @@ -1,16 +1,16 @@ | ||||
| defmodule Lokal.Email do | ||||
| defmodule Memex.Email do | ||||
|   @moduledoc """ | ||||
|   Emails that can be sent using Swoosh. | ||||
| 
 | ||||
|   You can find the base email templates at | ||||
|   `lib/Lokal_web/templates/layout/email.html.heex` for html emails and | ||||
|   `lib/Lokal_web/templates/layout/email.txt.heex` for text emails. | ||||
|   `lib/memex_web/templates/layout/email.html.heex` for html emails and | ||||
|   `lib/memex_web/templates/layout/email.txt.heex` for text emails. | ||||
|   """ | ||||
| 
 | ||||
|   use Phoenix.Swoosh, view: LokalWeb.EmailView, layout: {LokalWeb.LayoutView, :email} | ||||
|   import LokalWeb.Gettext | ||||
|   alias Lokal.Accounts.User | ||||
|   alias LokalWeb.EmailView | ||||
|   use Phoenix.Swoosh, view: MemexWeb.EmailView, layout: {MemexWeb.LayoutView, :email} | ||||
|   import MemexWeb.Gettext | ||||
|   alias Memex.Accounts.User | ||||
|   alias MemexWeb.EmailView | ||||
| 
 | ||||
|   @typedoc """ | ||||
|   Represents an HTML and text body email that can be sent | ||||
| @@ -19,29 +19,29 @@ defmodule Lokal.Email do | ||||
| 
 | ||||
|   @spec base_email(User.t(), String.t()) :: t() | ||||
|   defp base_email(%User{email: email}, subject) do | ||||
|     from = Application.get_env(:Lokal, Lokal.Mailer)[:email_from] || "noreply@localhost" | ||||
|     name = Application.get_env(:Lokal, Lokal.Mailer)[:email_name] | ||||
|     from = Application.get_env(:Memex, Memex.Mailer)[:email_from] || "noreply@localhost" | ||||
|     name = Application.get_env(:Memex, Memex.Mailer)[:email_name] | ||||
|     new() |> to(email) |> from({name, from}) |> subject(subject) | ||||
|   end | ||||
| 
 | ||||
|   @spec generate_email(key :: String.t(), User.t(), attrs :: map()) :: t() | ||||
|   def generate_email("welcome", user, %{"url" => url}) do | ||||
|     user | ||||
|     |> base_email(dgettext("emails", "Confirm your Lokal account")) | ||||
|     |> base_email(dgettext("emails", "Confirm your Memex account")) | ||||
|     |> render_body("confirm_email.html", %{user: user, url: url}) | ||||
|     |> text_body(EmailView.render("confirm_email.txt", %{user: user, url: url})) | ||||
|   end | ||||
| 
 | ||||
|   def generate_email("reset_password", user, %{"url" => url}) do | ||||
|     user | ||||
|     |> base_email(dgettext("emails", "Reset your Lokal password")) | ||||
|     |> base_email(dgettext("emails", "Reset your Memex password")) | ||||
|     |> render_body("reset_password.html", %{user: user, url: url}) | ||||
|     |> text_body(EmailView.render("reset_password.txt", %{user: user, url: url})) | ||||
|   end | ||||
| 
 | ||||
|   def generate_email("update_email", user, %{"url" => url}) do | ||||
|     user | ||||
|     |> base_email(dgettext("emails", "Update your Lokal email")) | ||||
|     |> base_email(dgettext("emails", "Update your Memex email")) | ||||
|     |> render_body("update_email.html", %{user: user, url: url}) | ||||
|     |> text_body(EmailView.render("update_email.txt", %{user: user, url: url})) | ||||
|   end | ||||
| @@ -1,10 +1,10 @@ | ||||
| defmodule Lokal.EmailWorker do | ||||
| defmodule Memex.EmailWorker do | ||||
|   @moduledoc """ | ||||
|   Oban worker that dispatches emails | ||||
|   """ | ||||
| 
 | ||||
|   use Oban.Worker, queue: :mailers, tags: ["email"] | ||||
|   alias Lokal.{Accounts, Email, Mailer} | ||||
|   alias Memex.{Accounts, Email, Mailer} | ||||
| 
 | ||||
|   @impl Oban.Worker | ||||
|   def perform(%Oban.Job{args: %{"email" => email, "user_id" => user_id, "attrs" => attrs}}) do | ||||
| @@ -1,13 +1,13 @@ | ||||
| defmodule Lokal.Accounts.User do | ||||
| defmodule Memex.Accounts.User do | ||||
|   @moduledoc """ | ||||
|   A Lokal user | ||||
|   A Memex user | ||||
|   """ | ||||
| 
 | ||||
|   use Ecto.Schema | ||||
|   import Ecto.Changeset | ||||
|   import LokalWeb.Gettext | ||||
|   import MemexWeb.Gettext | ||||
|   alias Ecto.{Changeset, UUID} | ||||
|   alias Lokal.{Accounts.User, Invites.Invite} | ||||
|   alias Memex.{Accounts.User, Invites.Invite} | ||||
| 
 | ||||
|   @derive {Inspect, except: [:password]} | ||||
|   @primary_key {:id, :binary_id, autogenerate: true} | ||||
| @@ -84,7 +84,7 @@ defmodule Lokal.Accounts.User do | ||||
|       message: dgettext("errors", "must have the @ sign and no spaces") | ||||
|     ) | ||||
|     |> validate_length(:email, max: 160) | ||||
|     |> unsafe_validate_unique(:email, Lokal.Repo) | ||||
|     |> unsafe_validate_unique(:email, Memex.Repo) | ||||
|     |> unique_constraint(:email) | ||||
|   end | ||||
| 
 | ||||
| @@ -1,4 +1,4 @@ | ||||
| defmodule Lokal.Accounts.UserNotifier do | ||||
| defmodule Memex.Accounts.UserNotifier do | ||||
|   @moduledoc """ | ||||
|   Contains templates and messages for user messages | ||||
|   """ | ||||
| @@ -1,4 +1,4 @@ | ||||
| defmodule Lokal.Accounts.UserToken do | ||||
| defmodule Memex.Accounts.UserToken do | ||||
|   @moduledoc """ | ||||
|   Schema for a user's session token | ||||
|   """ | ||||
| @@ -22,7 +22,7 @@ defmodule Lokal.Accounts.UserToken do | ||||
|     field :token, :binary | ||||
|     field :context, :string | ||||
|     field :sent_to, :string | ||||
|     belongs_to :user, Lokal.Accounts.User | ||||
|     belongs_to :user, Memex.Accounts.User | ||||
| 
 | ||||
|     timestamps(updated_at: false) | ||||
|   end | ||||
| @@ -34,7 +34,7 @@ defmodule Lokal.Accounts.UserToken do | ||||
|   """ | ||||
|   def build_session_token(user) do | ||||
|     token = :crypto.strong_rand_bytes(@rand_size) | ||||
|     {token, %Lokal.Accounts.UserToken{token: token, context: "session", user_id: user.id}} | ||||
|     {token, %Memex.Accounts.UserToken{token: token, context: "session", user_id: user.id}} | ||||
|   end | ||||
| 
 | ||||
|   @doc """ | ||||
| @@ -69,7 +69,7 @@ defmodule Lokal.Accounts.UserToken do | ||||
|     hashed_token = :crypto.hash(@hash_algorithm, token) | ||||
| 
 | ||||
|     {Base.url_encode64(token, padding: false), | ||||
|      %Lokal.Accounts.UserToken{ | ||||
|      %Memex.Accounts.UserToken{ | ||||
|        token: hashed_token, | ||||
|        context: context, | ||||
|        sent_to: sent_to, | ||||
| @@ -129,17 +129,17 @@ defmodule Lokal.Accounts.UserToken do | ||||
|   Returns the given token with the given context. | ||||
|   """ | ||||
|   def token_and_context_query(token, context) do | ||||
|     from Lokal.Accounts.UserToken, where: [token: ^token, context: ^context] | ||||
|     from Memex.Accounts.UserToken, where: [token: ^token, context: ^context] | ||||
|   end | ||||
| 
 | ||||
|   @doc """ | ||||
|   Gets all tokens for the given user for the given contexts. | ||||
|   """ | ||||
|   def user_and_contexts_query(user, :all) do | ||||
|     from t in Lokal.Accounts.UserToken, where: t.user_id == ^user.id | ||||
|     from t in Memex.Accounts.UserToken, where: t.user_id == ^user.id | ||||
|   end | ||||
| 
 | ||||
|   def user_and_contexts_query(user, [_ | _] = contexts) do | ||||
|     from t in Lokal.Accounts.UserToken, where: t.user_id == ^user.id and t.context in ^contexts | ||||
|     from t in Memex.Accounts.UserToken, where: t.user_id == ^user.id and t.context in ^contexts | ||||
|   end | ||||
| end | ||||
| @@ -1,4 +1,4 @@ | ||||
| defmodule Lokal.Application do | ||||
| defmodule Memex.Application do | ||||
|   # See https://hexdocs.pm/elixir/Application.html | ||||
|   # for more information on OTP Applications | ||||
|   @moduledoc false | ||||
| @@ -9,28 +9,28 @@ defmodule Lokal.Application do | ||||
|   def start(_type, _args) do | ||||
|     children = [ | ||||
|       # Start the Ecto repository | ||||
|       Lokal.Repo, | ||||
|       Memex.Repo, | ||||
|       # Start the Telemetry supervisor | ||||
|       LokalWeb.Telemetry, | ||||
|       MemexWeb.Telemetry, | ||||
|       # Start the PubSub system | ||||
|       {Phoenix.PubSub, name: Lokal.PubSub}, | ||||
|       {Phoenix.PubSub, name: Memex.PubSub}, | ||||
|       # Start the Endpoint (http/https) | ||||
|       LokalWeb.Endpoint, | ||||
|       MemexWeb.Endpoint, | ||||
|       # Add Oban | ||||
|       {Oban, oban_config()} | ||||
|       # Start a worker by calling: Lokal.Worker.start_link(arg) | ||||
|       # {Lokal.Worker, arg} | ||||
|       # Start a worker by calling: Memex.Worker.start_link(arg) | ||||
|       # {Memex.Worker, arg} | ||||
|     ] | ||||
| 
 | ||||
|     # Automatically migrate on start in prod | ||||
|     children = | ||||
|       if Application.get_env(:lokal, Lokal.Application, automigrate: false)[:automigrate], | ||||
|         do: children ++ [Lokal.Repo.Migrator], | ||||
|       if Application.get_env(:memex, Memex.Application, automigrate: false)[:automigrate], | ||||
|         do: children ++ [Memex.Repo.Migrator], | ||||
|         else: children | ||||
| 
 | ||||
|     # See https://hexdocs.pm/elixir/Supervisor.html | ||||
|     # for other strategies and supported options | ||||
|     opts = [strategy: :one_for_one, name: Lokal.Supervisor] | ||||
|     opts = [strategy: :one_for_one, name: Memex.Supervisor] | ||||
|     Supervisor.start_link(children, opts) | ||||
|   end | ||||
| 
 | ||||
| @@ -38,11 +38,11 @@ defmodule Lokal.Application do | ||||
|   # whenever the application is updated. | ||||
|   @impl true | ||||
|   def config_change(changed, _new, removed) do | ||||
|     LokalWeb.Endpoint.config_change(changed, removed) | ||||
|     MemexWeb.Endpoint.config_change(changed, removed) | ||||
|     :ok | ||||
|   end | ||||
| 
 | ||||
|   defp oban_config do | ||||
|     Application.fetch_env!(:lokal, Oban) | ||||
|     Application.fetch_env!(:memex, Oban) | ||||
|   end | ||||
| end | ||||
| @@ -1,11 +1,11 @@ | ||||
| defmodule Lokal.Invites do | ||||
| defmodule Memex.Invites do | ||||
|   @moduledoc """ | ||||
|   The Invites context. | ||||
|   """ | ||||
| 
 | ||||
|   import Ecto.Query, warn: false | ||||
|   alias Ecto.Changeset | ||||
|   alias Lokal.{Accounts.User, Invites.Invite, Repo} | ||||
|   alias Memex.{Accounts.User, Invites.Invite, Repo} | ||||
| 
 | ||||
|   @invite_token_length 20 | ||||
| 
 | ||||
| @@ -1,4 +1,4 @@ | ||||
| defmodule Lokal.Invites.Invite do | ||||
| defmodule Memex.Invites.Invite do | ||||
|   @moduledoc """ | ||||
|   An invite, created by an admin to allow someone to join their instance. An | ||||
|   invite can be enabled or disabled, and can have an optional number of uses if | ||||
| @@ -8,7 +8,7 @@ defmodule Lokal.Invites.Invite do | ||||
|   use Ecto.Schema | ||||
|   import Ecto.Changeset | ||||
|   alias Ecto.{Changeset, UUID} | ||||
|   alias Lokal.{Accounts.User, Invites.Invite} | ||||
|   alias Memex.{Accounts.User, Invites.Invite} | ||||
| 
 | ||||
|   @primary_key {:id, :binary_id, autogenerate: true} | ||||
|   @foreign_key_type :binary_id | ||||
| @@ -1,4 +1,4 @@ | ||||
| defmodule Lokal.Mailer do | ||||
| defmodule Memex.Mailer do | ||||
|   @moduledoc """ | ||||
|   Mailer adapter for emails | ||||
| 
 | ||||
| @@ -6,8 +6,8 @@ defmodule Lokal.Mailer do | ||||
|   json with Jason, which restricts the use of structs. | ||||
|   """ | ||||
| 
 | ||||
|   use Swoosh.Mailer, otp_app: :lokal | ||||
|   alias Lokal.{Accounts.User, EmailWorker} | ||||
|   use Swoosh.Mailer, otp_app: :memex | ||||
|   alias Memex.{Accounts.User, EmailWorker} | ||||
|   alias Oban.Job | ||||
| 
 | ||||
|   @doc """ | ||||
| @@ -1,9 +1,9 @@ | ||||
| defmodule Lokal.Release do | ||||
| defmodule Memex.Release do | ||||
|   @moduledoc """ | ||||
|   Contains mix tasks that can used in generated releases | ||||
|   """ | ||||
| 
 | ||||
|   @app :lokal | ||||
|   @app :memex | ||||
| 
 | ||||
|   def rollback(repo, version) do | ||||
|     load_app() | ||||
| @@ -1,5 +1,5 @@ | ||||
| defmodule Lokal.Repo do | ||||
| defmodule Memex.Repo do | ||||
|   use Ecto.Repo, | ||||
|     otp_app: :lokal, | ||||
|     otp_app: :memex, | ||||
|     adapter: Ecto.Adapters.Postgres | ||||
| end | ||||
| @@ -1,4 +1,4 @@ | ||||
| defmodule Lokal.Repo.Migrator do | ||||
| defmodule Memex.Repo.Migrator do | ||||
|   @moduledoc """ | ||||
|   Genserver to automatically perform all migration on app start | ||||
|   """ | ||||
| @@ -16,7 +16,7 @@ defmodule Lokal.Repo.Migrator do | ||||
|   end | ||||
| 
 | ||||
|   def migrate! do | ||||
|     path = Application.app_dir(:lokal, "priv/repo/migrations") | ||||
|     Ecto.Migrator.run(Lokal.Repo, path, :up, all: true) | ||||
|     path = Application.app_dir(:memex, "priv/repo/migrations") | ||||
|     Ecto.Migrator.run(Memex.Repo, path, :up, all: true) | ||||
|   end | ||||
| end | ||||
| @@ -1,12 +1,12 @@ | ||||
| defmodule LokalWeb do | ||||
| defmodule MemexWeb do | ||||
|   @moduledoc """ | ||||
|   The entrypoint for defining your web interface, such | ||||
|   as controllers, views, channels and so on. | ||||
| 
 | ||||
|   This can be used in your application as: | ||||
| 
 | ||||
|       use LokalWeb, :controller | ||||
|       use LokalWeb, :view | ||||
|       use MemexWeb, :controller | ||||
|       use MemexWeb, :view | ||||
| 
 | ||||
|   The definitions below will be executed for every view, | ||||
|   controller, etc, so keep them short and clean, focused | ||||
| @@ -19,19 +19,19 @@ defmodule LokalWeb do | ||||
| 
 | ||||
|   def controller do | ||||
|     quote do | ||||
|       use Phoenix.Controller, namespace: LokalWeb | ||||
|       use Phoenix.Controller, namespace: MemexWeb | ||||
| 
 | ||||
|       import Plug.Conn | ||||
|       import LokalWeb.Gettext | ||||
|       alias LokalWeb.Router.Helpers, as: Routes | ||||
|       import MemexWeb.Gettext | ||||
|       alias MemexWeb.Router.Helpers, as: Routes | ||||
|     end | ||||
|   end | ||||
| 
 | ||||
|   def view do | ||||
|     quote do | ||||
|       use Phoenix.View, | ||||
|         root: "lib/lokal_web/templates", | ||||
|         namespace: LokalWeb | ||||
|         root: "lib/memex_web/templates", | ||||
|         namespace: MemexWeb | ||||
| 
 | ||||
|       # Import convenience functions from controllers | ||||
|       import Phoenix.Controller, | ||||
| @@ -45,9 +45,9 @@ defmodule LokalWeb do | ||||
|   def live_view do | ||||
|     quote do | ||||
|       use Phoenix.LiveView, | ||||
|         layout: {LokalWeb.LayoutView, "live.html"} | ||||
|         layout: {MemexWeb.LayoutView, "live.html"} | ||||
| 
 | ||||
|       on_mount LokalWeb.InitAssigns | ||||
|       on_mount MemexWeb.InitAssigns | ||||
|       unquote(view_helpers()) | ||||
|     end | ||||
|   end | ||||
| @@ -81,7 +81,7 @@ defmodule LokalWeb do | ||||
|   def channel do | ||||
|     quote do | ||||
|       use Phoenix.Channel | ||||
|       import LokalWeb.Gettext | ||||
|       import MemexWeb.Gettext | ||||
|     end | ||||
|   end | ||||
| 
 | ||||
| @@ -96,8 +96,8 @@ defmodule LokalWeb do | ||||
|       # Import basic rendering functionality (render, render_layout, etc) | ||||
|       import Phoenix.View | ||||
| 
 | ||||
|       import LokalWeb.{ErrorHelpers, Gettext, LiveHelpers, ViewHelpers} | ||||
|       alias LokalWeb.Router.Helpers, as: Routes | ||||
|       import MemexWeb.{ErrorHelpers, Gettext, LiveHelpers, ViewHelpers} | ||||
|       alias MemexWeb.Router.Helpers, as: Routes | ||||
|     end | ||||
|   end | ||||
| 
 | ||||
| @@ -1,10 +1,10 @@ | ||||
| defmodule LokalWeb.Components.InviteCard do | ||||
| defmodule MemexWeb.Components.InviteCard do | ||||
|   @moduledoc """ | ||||
|   Display card for an invite | ||||
|   """ | ||||
| 
 | ||||
|   use LokalWeb, :component | ||||
|   alias LokalWeb.Endpoint | ||||
|   use MemexWeb, :component | ||||
|   alias MemexWeb.Endpoint | ||||
| 
 | ||||
|   def invite_card(assigns) do | ||||
|     ~H""" | ||||
| @@ -1,4 +1,4 @@ | ||||
| defmodule LokalWeb.Components.TableComponent do | ||||
| defmodule MemexWeb.Components.TableComponent do | ||||
|   @moduledoc """ | ||||
|   Livecomponent that presents a resortable table | ||||
| 
 | ||||
| @@ -19,7 +19,7 @@ defmodule LokalWeb.Components.TableComponent do | ||||
|         content. | ||||
|   """ | ||||
| 
 | ||||
|   use LokalWeb, :live_component | ||||
|   use MemexWeb, :live_component | ||||
|   alias Phoenix.LiveView.Socket | ||||
| 
 | ||||
|   @impl true | ||||
| @@ -1,12 +1,12 @@ | ||||
| defmodule LokalWeb.Components.Topbar do | ||||
| defmodule MemexWeb.Components.Topbar do | ||||
|   @moduledoc """ | ||||
|   Component that renders a topbar with user functions/links | ||||
|   """ | ||||
| 
 | ||||
|   use LokalWeb, :component | ||||
|   use MemexWeb, :component | ||||
| 
 | ||||
|   alias Lokal.Accounts | ||||
|   alias LokalWeb.{Endpoint, HomeLive} | ||||
|   alias Memex.Accounts | ||||
|   alias MemexWeb.{Endpoint, HomeLive} | ||||
| 
 | ||||
|   def topbar(assigns) do | ||||
|     assigns = | ||||
| @@ -16,7 +16,7 @@ defmodule LokalWeb.Components.Topbar do | ||||
|     <nav role="navigation" class="mb-8 px-8 py-4 w-full bg-primary-400"> | ||||
|       <div class="flex flex-col sm:flex-row justify-between items-center"> | ||||
|         <div class="mb-4 sm:mb-0 sm:mr-8 flex flex-row justify-start items-center space-x-2"> | ||||
|           <%= live_redirect("Lokal", | ||||
|           <%= live_redirect("Memex", | ||||
|             to: Routes.live_path(Endpoint, HomeLive), | ||||
|             class: "mx-2 my-1 leading-5 text-xl text-white hover:underline" | ||||
|           ) %> | ||||
| @@ -1,9 +1,9 @@ | ||||
| defmodule LokalWeb.Components.UserCard do | ||||
| defmodule MemexWeb.Components.UserCard do | ||||
|   @moduledoc """ | ||||
|   Display card for a user | ||||
|   """ | ||||
| 
 | ||||
|   use LokalWeb, :component | ||||
|   use MemexWeb, :component | ||||
| 
 | ||||
|   def user_card(assigns) do | ||||
|     ~H""" | ||||
| @@ -1,16 +1,16 @@ | ||||
| defmodule LokalWeb.EmailController do | ||||
| defmodule MemexWeb.EmailController do | ||||
|   @moduledoc """ | ||||
|   A dev controller used to develop on emails | ||||
|   """ | ||||
| 
 | ||||
|   use LokalWeb, :controller | ||||
|   alias Lokal.Accounts.User | ||||
|   use MemexWeb, :controller | ||||
|   alias Memex.Accounts.User | ||||
| 
 | ||||
|   plug :put_layout, {LokalWeb.LayoutView, :email} | ||||
|   plug :put_layout, {MemexWeb.LayoutView, :email} | ||||
| 
 | ||||
|   @sample_assigns %{ | ||||
|     email: %{subject: "Example subject"}, | ||||
|     url: "https://lokal.bubbletea.dev/sample_url", | ||||
|     url: "https://memex.bubbletea.dev/sample_url", | ||||
|     user: %User{email: "sample@email.com"} | ||||
|   } | ||||
| 
 | ||||
| @@ -1,9 +1,9 @@ | ||||
| defmodule LokalWeb.HomeController do | ||||
| defmodule MemexWeb.HomeController do | ||||
|   @moduledoc """ | ||||
|   Controller for home page | ||||
|   """ | ||||
| 
 | ||||
|   use LokalWeb, :controller | ||||
|   use MemexWeb, :controller | ||||
| 
 | ||||
|   def index(conn, _params) do | ||||
|     render(conn, "index.html") | ||||
| @@ -1,20 +1,20 @@ | ||||
| defmodule LokalWeb.UserAuth do | ||||
| defmodule MemexWeb.UserAuth do | ||||
|   @moduledoc """ | ||||
|   Functions for user session and authentication | ||||
|   """ | ||||
| 
 | ||||
|   import Plug.Conn | ||||
|   import Phoenix.Controller | ||||
|   import LokalWeb.Gettext | ||||
|   alias Lokal.{Accounts, Accounts.User} | ||||
|   alias LokalWeb.HomeLive | ||||
|   alias LokalWeb.Router.Helpers, as: Routes | ||||
|   import MemexWeb.Gettext | ||||
|   alias Memex.{Accounts, Accounts.User} | ||||
|   alias MemexWeb.HomeLive | ||||
|   alias MemexWeb.Router.Helpers, as: Routes | ||||
| 
 | ||||
|   # Make the remember me cookie valid for 60 days. | ||||
|   # If you want bump or reduce this value, also change | ||||
|   # the token expiry itself in UserToken. | ||||
|   @max_age 60 * 60 * 24 * 60 | ||||
|   @remember_me_cookie "_lokal_web_user_remember_me" | ||||
|   @remember_me_cookie "_memex_web_user_remember_me" | ||||
|   @remember_me_options [sign: true, max_age: @max_age, same_site: "Lax"] | ||||
| 
 | ||||
|   @doc """ | ||||
| @@ -99,7 +99,7 @@ defmodule LokalWeb.UserAuth do | ||||
|     user_token && Accounts.delete_session_token(user_token) | ||||
| 
 | ||||
|     if live_socket_id = get_session(conn, :live_socket_id) do | ||||
|       LokalWeb.Endpoint.broadcast(live_socket_id, "disconnect", %{}) | ||||
|       MemexWeb.Endpoint.broadcast(live_socket_id, "disconnect", %{}) | ||||
|     end | ||||
| 
 | ||||
|     conn | ||||
| @@ -1,8 +1,8 @@ | ||||
| defmodule LokalWeb.UserConfirmationController do | ||||
|   use LokalWeb, :controller | ||||
| defmodule MemexWeb.UserConfirmationController do | ||||
|   use MemexWeb, :controller | ||||
| 
 | ||||
|   import LokalWeb.Gettext | ||||
|   alias Lokal.Accounts | ||||
|   import MemexWeb.Gettext | ||||
|   alias Memex.Accounts | ||||
| 
 | ||||
|   def new(conn, _params) do | ||||
|     render(conn, "new.html", page_title: gettext("Confirm your account")) | ||||
| @@ -1,9 +1,9 @@ | ||||
| defmodule LokalWeb.UserRegistrationController do | ||||
|   use LokalWeb, :controller | ||||
|   import LokalWeb.Gettext | ||||
|   alias Lokal.{Accounts, Invites} | ||||
|   alias Lokal.Accounts.User | ||||
|   alias LokalWeb.{Endpoint, HomeLive} | ||||
| defmodule MemexWeb.UserRegistrationController do | ||||
|   use MemexWeb, :controller | ||||
|   import MemexWeb.Gettext | ||||
|   alias Memex.{Accounts, Invites} | ||||
|   alias Memex.Accounts.User | ||||
|   alias MemexWeb.{Endpoint, HomeLive} | ||||
| 
 | ||||
|   def new(conn, %{"invite" => invite_token}) do | ||||
|     invite = Invites.get_invite_by_token(invite_token) | ||||
| @@ -1,7 +1,7 @@ | ||||
| defmodule LokalWeb.UserResetPasswordController do | ||||
|   use LokalWeb, :controller | ||||
| defmodule MemexWeb.UserResetPasswordController do | ||||
|   use MemexWeb, :controller | ||||
| 
 | ||||
|   alias Lokal.Accounts | ||||
|   alias Memex.Accounts | ||||
| 
 | ||||
|   plug :get_user_by_reset_password_token when action in [:edit, :update] | ||||
| 
 | ||||
| @@ -1,8 +1,8 @@ | ||||
| defmodule LokalWeb.UserSessionController do | ||||
|   use LokalWeb, :controller | ||||
| defmodule MemexWeb.UserSessionController do | ||||
|   use MemexWeb, :controller | ||||
| 
 | ||||
|   alias Lokal.Accounts | ||||
|   alias LokalWeb.UserAuth | ||||
|   alias Memex.Accounts | ||||
|   alias MemexWeb.UserAuth | ||||
| 
 | ||||
|   def new(conn, _params) do | ||||
|     render(conn, "new.html", error_message: nil, page_title: gettext("Log in")) | ||||
| @@ -1,8 +1,8 @@ | ||||
| defmodule LokalWeb.UserSettingsController do | ||||
|   use LokalWeb, :controller | ||||
|   import LokalWeb.Gettext | ||||
|   alias Lokal.Accounts | ||||
|   alias LokalWeb.{HomeLive, UserAuth} | ||||
| defmodule MemexWeb.UserSettingsController do | ||||
|   use MemexWeb, :controller | ||||
|   import MemexWeb.Gettext | ||||
|   alias Memex.Accounts | ||||
|   alias MemexWeb.{HomeLive, UserAuth} | ||||
| 
 | ||||
|   plug :assign_email_and_password_changesets | ||||
| 
 | ||||
| @@ -1,12 +1,12 @@ | ||||
| defmodule LokalWeb.Endpoint do | ||||
|   use Phoenix.Endpoint, otp_app: :lokal | ||||
| defmodule MemexWeb.Endpoint do | ||||
|   use Phoenix.Endpoint, otp_app: :memex | ||||
| 
 | ||||
|   # The session will be stored in the cookie and signed, | ||||
|   # this means its contents can be read but not tampered with. | ||||
|   # Set :encryption_salt if you would also like to encrypt it. | ||||
|   @session_options [ | ||||
|     store: :cookie, | ||||
|     key: "_lokal_key", | ||||
|     key: "_memex_key", | ||||
|     signing_salt: "fxAnJltS" | ||||
|   ] | ||||
| 
 | ||||
| @@ -18,7 +18,7 @@ defmodule LokalWeb.Endpoint do | ||||
|   # when deploying your static files in production. | ||||
|   plug Plug.Static, | ||||
|     at: "/", | ||||
|     from: :lokal, | ||||
|     from: :memex, | ||||
|     gzip: false, | ||||
|     only: ~w(css fonts images js favicon.ico robots.txt) | ||||
| 
 | ||||
| @@ -28,7 +28,7 @@ defmodule LokalWeb.Endpoint do | ||||
|     socket "/phoenix/live_reload/socket", Phoenix.LiveReloader.Socket | ||||
|     plug Phoenix.LiveReloader | ||||
|     plug Phoenix.CodeReloader | ||||
|     plug Phoenix.Ecto.CheckRepoStatus, otp_app: :lokal | ||||
|     plug Phoenix.Ecto.CheckRepoStatus, otp_app: :memex | ||||
|   end | ||||
| 
 | ||||
|   plug Phoenix.LiveDashboard.RequestLogger, | ||||
| @@ -46,5 +46,5 @@ defmodule LokalWeb.Endpoint do | ||||
|   plug Plug.MethodOverride | ||||
|   plug Plug.Head | ||||
|   plug Plug.Session, @session_options | ||||
|   plug LokalWeb.Router | ||||
|   plug MemexWeb.Router | ||||
| end | ||||
| @@ -1,11 +1,11 @@ | ||||
| defmodule LokalWeb.Gettext do | ||||
| defmodule MemexWeb.Gettext do | ||||
|   @moduledoc """ | ||||
|   A module providing Internationalization with a gettext-based API. | ||||
| 
 | ||||
|   By using [Gettext](https://hexdocs.pm/gettext), | ||||
|   your module gains a set of macros for translations, for example: | ||||
| 
 | ||||
|       import LokalWeb.Gettext | ||||
|       import MemexWeb.Gettext | ||||
| 
 | ||||
|       # Simple translation | ||||
|       gettext("Here is the string to translate") | ||||
| @@ -20,5 +20,5 @@ defmodule LokalWeb.Gettext do | ||||
| 
 | ||||
|   See the [Gettext Docs](https://hexdocs.pm/gettext) for detailed usage. | ||||
|   """ | ||||
|   use Gettext, otp_app: :lokal | ||||
|   use Gettext, otp_app: :memex | ||||
| end | ||||
| @@ -1,9 +1,9 @@ | ||||
| defmodule LokalWeb.HomeLive do | ||||
| defmodule MemexWeb.HomeLive do | ||||
|   @moduledoc """ | ||||
|   Liveview for the main home page | ||||
|   """ | ||||
| 
 | ||||
|   use LokalWeb, :live_view | ||||
|   use MemexWeb, :live_view | ||||
| 
 | ||||
|   @impl true | ||||
|   def mount(_params, _session, socket) do | ||||
| @@ -30,7 +30,7 @@ defmodule LokalWeb.HomeLive do | ||||
|   end | ||||
| 
 | ||||
|   defp search(query) do | ||||
|     if not LokalWeb.Endpoint.config(:code_reloader) do | ||||
|     if not MemexWeb.Endpoint.config(:code_reloader) do | ||||
|       raise "action disabled when not in development" | ||||
|     end | ||||
| 
 | ||||
| @@ -1,9 +1,9 @@ | ||||
| <div class="flex flex-col justify-center items-center text-center space-y-4"> | ||||
|   <h1 class="title text-primary-500 text-2xl"> | ||||
|     <%= gettext("Welcome to Lokal") %> | ||||
|     <%= gettext("memex") %> | ||||
|   </h1> | ||||
| 
 | ||||
|   <p class="title  text-primary-500 text-lg"> | ||||
|     <%= gettext("Shop from your community") %> | ||||
|     <%= gettext("filling this out later") %> | ||||
|   </p> | ||||
| </div> | ||||
| @@ -1,9 +1,9 @@ | ||||
| defmodule LokalWeb.InitAssigns do | ||||
| defmodule MemexWeb.InitAssigns do | ||||
|   @moduledoc """ | ||||
|   Ensures common `assigns` are applied to all LiveViews attaching this hook. | ||||
|   """ | ||||
|   import Phoenix.LiveView | ||||
|   alias Lokal.Accounts | ||||
|   alias Memex.Accounts | ||||
| 
 | ||||
|   def on_mount(:default, _params, %{"locale" => locale, "user_token" => user_token}, socket) do | ||||
|     Gettext.put_locale(locale) | ||||
| @@ -1,11 +1,11 @@ | ||||
| defmodule LokalWeb.InviteLive.FormComponent do | ||||
| defmodule MemexWeb.InviteLive.FormComponent do | ||||
|   @moduledoc """ | ||||
|   Livecomponent that can update or create an Lokal.Invites.Invite | ||||
|   Livecomponent that can update or create an Memex.Invites.Invite | ||||
|   """ | ||||
| 
 | ||||
|   use LokalWeb, :live_component | ||||
|   use MemexWeb, :live_component | ||||
|   alias Ecto.Changeset | ||||
|   alias Lokal.{Accounts.User, Invites, Invites.Invite} | ||||
|   alias Memex.{Accounts.User, Invites, Invites.Invite} | ||||
|   alias Phoenix.LiveView.Socket | ||||
| 
 | ||||
|   @impl true | ||||
| @@ -1,12 +1,12 @@ | ||||
| defmodule LokalWeb.InviteLive.Index do | ||||
| defmodule MemexWeb.InviteLive.Index do | ||||
|   @moduledoc """ | ||||
|   Liveview to show a Lokal.Invites.Invite index | ||||
|   Liveview to show a Memex.Invites.Invite index | ||||
|   """ | ||||
| 
 | ||||
|   use LokalWeb, :live_view | ||||
|   import LokalWeb.Components.{InviteCard, UserCard} | ||||
|   alias Lokal.{Accounts, Invites, Invites.Invite} | ||||
|   alias LokalWeb.{Endpoint, HomeLive} | ||||
|   use MemexWeb, :live_view | ||||
|   import MemexWeb.Components.{InviteCard, UserCard} | ||||
|   alias Memex.{Accounts, Invites, Invites.Invite} | ||||
|   alias MemexWeb.{Endpoint, HomeLive} | ||||
|   alias Phoenix.LiveView.JS | ||||
| 
 | ||||
|   @impl true | ||||
| @@ -27,7 +27,7 @@ | ||||
|             <button | ||||
|               type="submit" | ||||
|               class="mx-2 my-1 btn btn-primary" | ||||
|               phx-click={JS.dispatch("lokal:clipcopy", to: "#code-#{invite.id}")} | ||||
|               phx-click={JS.dispatch("memex:clipcopy", to: "#code-#{invite.id}")} | ||||
|             > | ||||
|               <%= dgettext("actions", "Copy to clipboard") %> | ||||
|             </button> | ||||
| @@ -144,7 +144,7 @@ | ||||
| <%= if @live_action in [:new, :edit] do %> | ||||
|   <.modal return_to={Routes.invite_index_path(Endpoint, :index)}> | ||||
|     <.live_component | ||||
|       module={LokalWeb.InviteLive.FormComponent} | ||||
|       module={MemexWeb.InviteLive.FormComponent} | ||||
|       id={@invite.id || :new} | ||||
|       title={@page_title} | ||||
|       action={@live_action} | ||||
| @@ -1,4 +1,4 @@ | ||||
| defmodule LokalWeb.LiveHelpers do | ||||
| defmodule MemexWeb.LiveHelpers do | ||||
|   @moduledoc """ | ||||
|   Contains resuable methods for all liveviews | ||||
|   """ | ||||
| @@ -1,13 +1,13 @@ | ||||
| defmodule LokalWeb.Router do | ||||
|   use LokalWeb, :router | ||||
| defmodule MemexWeb.Router do | ||||
|   use MemexWeb, :router | ||||
|   import Phoenix.LiveDashboard.Router | ||||
|   import LokalWeb.UserAuth | ||||
|   import MemexWeb.UserAuth | ||||
| 
 | ||||
|   pipeline :browser do | ||||
|     plug :accepts, ["html"] | ||||
|     plug :fetch_session | ||||
|     plug :fetch_live_flash | ||||
|     plug :put_root_layout, {LokalWeb.LayoutView, :root} | ||||
|     plug :put_root_layout, {MemexWeb.LayoutView, :root} | ||||
|     plug :protect_from_forgery | ||||
|     plug :put_secure_browser_headers | ||||
|     plug :fetch_current_user | ||||
| @@ -32,7 +32,7 @@ defmodule LokalWeb.Router do | ||||
|     plug :accepts, ["json"] | ||||
|   end | ||||
| 
 | ||||
|   scope "/", LokalWeb do | ||||
|   scope "/", MemexWeb do | ||||
|     pipe_through :browser | ||||
| 
 | ||||
|     live "/", HomeLive | ||||
| @@ -40,7 +40,7 @@ defmodule LokalWeb.Router do | ||||
| 
 | ||||
|   ## Authentication routes | ||||
| 
 | ||||
|   scope "/", LokalWeb do | ||||
|   scope "/", MemexWeb do | ||||
|     pipe_through [:browser, :redirect_if_user_is_authenticated] | ||||
| 
 | ||||
|     get "/users/register", UserRegistrationController, :new | ||||
| @@ -53,7 +53,7 @@ defmodule LokalWeb.Router do | ||||
|     put "/users/reset_password/:token", UserResetPasswordController, :update | ||||
|   end | ||||
| 
 | ||||
|   scope "/", LokalWeb do | ||||
|   scope "/", MemexWeb do | ||||
|     pipe_through [:browser, :require_authenticated_user] | ||||
| 
 | ||||
|     get "/users/settings", UserSettingsController, :edit | ||||
| @@ -62,17 +62,17 @@ defmodule LokalWeb.Router do | ||||
|     get "/users/settings/confirm_email/:token", UserSettingsController, :confirm_email | ||||
|   end | ||||
| 
 | ||||
|   scope "/", LokalWeb do | ||||
|   scope "/", MemexWeb do | ||||
|     pipe_through [:browser, :require_authenticated_user, :require_admin] | ||||
| 
 | ||||
|     live_dashboard "/dashboard", metrics: LokalWeb.Telemetry, ecto_repos: [Lokal.Repo] | ||||
|     live_dashboard "/dashboard", metrics: MemexWeb.Telemetry, ecto_repos: [Memex.Repo] | ||||
| 
 | ||||
|     live "/invites", InviteLive.Index, :index | ||||
|     live "/invites/new", InviteLive.Index, :new | ||||
|     live "/invites/:id/edit", InviteLive.Index, :edit | ||||
|   end | ||||
| 
 | ||||
|   scope "/", LokalWeb do | ||||
|   scope "/", MemexWeb do | ||||
|     pipe_through [:browser] | ||||
| 
 | ||||
|     delete "/users/log_out", UserSessionController, :delete | ||||
| @@ -93,7 +93,7 @@ defmodule LokalWeb.Router do | ||||
|     end | ||||
| 
 | ||||
|     scope "/dev" do | ||||
|       get "/preview/:id", LokalWeb.EmailController, :preview | ||||
|       get "/preview/:id", MemexWeb.EmailController, :preview | ||||
|     end | ||||
|   end | ||||
| end | ||||
| @@ -1,4 +1,4 @@ | ||||
| defmodule LokalWeb.Telemetry do | ||||
| defmodule MemexWeb.Telemetry do | ||||
|   @moduledoc """ | ||||
|   Collects telemetry | ||||
|   """ | ||||
| @@ -35,23 +35,23 @@ defmodule LokalWeb.Telemetry do | ||||
|       ), | ||||
| 
 | ||||
|       # Database Metrics | ||||
|       summary("lokal.repo.query.total_time", | ||||
|       summary("memex.repo.query.total_time", | ||||
|         unit: {:native, :millisecond}, | ||||
|         description: "The sum of the other measurements" | ||||
|       ), | ||||
|       summary("lokal.repo.query.decode_time", | ||||
|       summary("memex.repo.query.decode_time", | ||||
|         unit: {:native, :millisecond}, | ||||
|         description: "The time spent decoding the data received from the database" | ||||
|       ), | ||||
|       summary("lokal.repo.query.query_time", | ||||
|       summary("memex.repo.query.query_time", | ||||
|         unit: {:native, :millisecond}, | ||||
|         description: "The time spent executing the query" | ||||
|       ), | ||||
|       summary("lokal.repo.query.queue_time", | ||||
|       summary("memex.repo.query.queue_time", | ||||
|         unit: {:native, :millisecond}, | ||||
|         description: "The time spent waiting for a database connection" | ||||
|       ), | ||||
|       summary("lokal.repo.query.idle_time", | ||||
|       summary("memex.repo.query.idle_time", | ||||
|         unit: {:native, :millisecond}, | ||||
|         description: | ||||
|           "The time the connection spent waiting before being checked out for the query" | ||||
| @@ -69,7 +69,7 @@ defmodule LokalWeb.Telemetry do | ||||
|     [ | ||||
|       # A module, function and arguments to be invoked periodically. | ||||
|       # This function must call :telemetry.execute/3 and a metric must be added above. | ||||
|       # {LokalWeb, :count_users, []} | ||||
|       # {MemexWeb, :count_users, []} | ||||
|     ] | ||||
|   end | ||||
| end | ||||
| @@ -6,7 +6,7 @@ | ||||
|   <br /> | ||||
| 
 | ||||
|   <span style="margin-bottom: 1em; font-size: 1.25em;"> | ||||
|     <%= dgettext("emails", "Welcome to Lokal") %> | ||||
|     <%= dgettext("emails", "Welcome to Memex") %> | ||||
|   </span> | ||||
| 
 | ||||
|   <br /> | ||||
| @@ -19,5 +19,5 @@ | ||||
| 
 | ||||
|   <br /> | ||||
| 
 | ||||
|   <%= dgettext("emails", "If you didn't create an account at Lokal, please ignore this.") %> | ||||
|   <%= dgettext("emails", "If you didn't create an account at Memex, please ignore this.") %> | ||||
| </div> | ||||
| @@ -1,7 +1,7 @@ | ||||
| 
 | ||||
| <%= dgettext("emails", "Hi %{email},", email: @user.email) %> | ||||
| 
 | ||||
| <%= dgettext("emails", "Welcome to Lokal") %> | ||||
| <%= dgettext("emails", "Welcome to Memex") %> | ||||
| 
 | ||||
| <%= dgettext("emails", "You can confirm your account by visiting the URL below:") %> | ||||
| 
 | ||||
| @@ -13,5 +13,5 @@ | ||||
| 
 | ||||
|   <br /> | ||||
| 
 | ||||
|   <%= dgettext("emails", "If you didn't request this change from Lokal, please ignore this.") %> | ||||
|   <%= dgettext("emails", "If you didn't request this change from Memex, please ignore this.") %> | ||||
| </div> | ||||
| @@ -15,6 +15,6 @@ | ||||
| 
 | ||||
|   <%= dgettext( | ||||
|     "emails", | ||||
|     "If you didn't request this change from Lokal, please ignore this." | ||||
|     "If you didn't request this change from Memex, please ignore this." | ||||
|   ) %> | ||||
| </div> | ||||
| @@ -5,7 +5,7 @@ | ||||
|     <meta http-equiv="X-UA-Compatible" content="IE=edge" /> | ||||
|     <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||||
|     <title> | ||||
|       <%= dgettext("errors", "Error") %>| Lokal | ||||
|       <%= dgettext("errors", "Error") %>| Memex | ||||
|     </title> | ||||
|     <link rel="stylesheet" href="/css/app.css" /> | ||||
|     <script defer type="text/javascript" src="/js/app.js"> | ||||
| @@ -12,7 +12,7 @@ | ||||
|     <a style="color: rgb(31, 31, 31);" href={Routes.live_url(Endpoint, HomeLive)}> | ||||
|       <%= dgettext( | ||||
|         "emails", | ||||
|         "This email was sent from Lokal, the self-hosted firearm tracker website." | ||||
|         "This email was sent from Memex, the self-hosted firearm tracker website." | ||||
|       ) %> | ||||
|     </a> | ||||
|   </body> | ||||
| @@ -7,5 +7,5 @@ | ||||
| ===================== | ||||
| 
 | ||||
| <%= dgettext("emails", | ||||
|   "This email was sent from Lokal at %{url}, the self-hosted firearm tracker website.", | ||||
|   "This email was sent from Memex at %{url}, the self-hosted firearm tracker website.", | ||||
|   url: Routes.live_url(Endpoint, HomeLive)) %> | ||||
| @@ -5,8 +5,8 @@ | ||||
|     <meta http-equiv="X-UA-Compatible" content="IE=edge" /> | ||||
|     <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||||
|     <%= csrf_meta_tag() %> | ||||
|     <%= if(assigns |> Map.has_key?(:page_title), do: @page_title, else: "Lokal") | ||||
|     |> live_title_tag(suffix: " | Lokal") %> | ||||
|     <%= if(assigns |> Map.has_key?(:page_title), do: @page_title, else: "Memex") | ||||
|     |> live_title_tag(suffix: " | Memex") %> | ||||
|     <link phx-track-static rel="stylesheet" href={Routes.static_path(@conn, "/css/app.css")} /> | ||||
|     <script | ||||
|       defer | ||||
							
								
								
									
										8
									
								
								lib/memex_web/views/email_view.ex
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								lib/memex_web/views/email_view.ex
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,8 @@ | ||||
| defmodule MemexWeb.EmailView do | ||||
|   @moduledoc """ | ||||
|   A view for email-related helper functions | ||||
|   """ | ||||
|   alias MemexWeb.{Endpoint, HomeLive} | ||||
|  | ||||
|   use MemexWeb, :view | ||||
| end | ||||
| @@ -1,4 +1,4 @@ | ||||
| defmodule LokalWeb.ErrorHelpers do | ||||
| defmodule MemexWeb.ErrorHelpers do | ||||
|   @moduledoc """ | ||||
|   Conveniences for translating and building error messages. | ||||
|   """ | ||||
| @@ -48,9 +48,9 @@ defmodule LokalWeb.ErrorHelpers do | ||||
|     # should be written to the errors.po file. The :count option is | ||||
|     # set by Ecto and indicates we should also apply plural rules. | ||||
|     if count = opts[:count] do | ||||
|       Gettext.dngettext(LokalWeb.Gettext, "errors", msg, msg, count, opts) | ||||
|       Gettext.dngettext(MemexWeb.Gettext, "errors", msg, msg, count, opts) | ||||
|     else | ||||
|       Gettext.dgettext(LokalWeb.Gettext, "errors", msg, opts) | ||||
|       Gettext.dgettext(MemexWeb.Gettext, "errors", msg, opts) | ||||
|     end | ||||
|   end | ||||
| 
 | ||||
| @@ -1,7 +1,7 @@ | ||||
| defmodule LokalWeb.ErrorView do | ||||
|   use LokalWeb, :view | ||||
|   import LokalWeb.Components.Topbar | ||||
|   alias LokalWeb.{Endpoint, HomeLive} | ||||
| defmodule MemexWeb.ErrorView do | ||||
|   use MemexWeb, :view | ||||
|   import MemexWeb.Components.Topbar | ||||
|   alias MemexWeb.{Endpoint, HomeLive} | ||||
| 
 | ||||
|   def template_not_found(error_path, _assigns) do | ||||
|     error_string = | ||||
							
								
								
									
										3
									
								
								lib/memex_web/views/home_view.ex
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								lib/memex_web/views/home_view.ex
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,3 @@ | ||||
| defmodule MemexWeb.PageView do | ||||
|   use MemexWeb, :view | ||||
| end | ||||
| @@ -1,7 +1,7 @@ | ||||
| defmodule LokalWeb.LayoutView do | ||||
|   use LokalWeb, :view | ||||
|   import LokalWeb.Components.Topbar | ||||
|   alias LokalWeb.{Endpoint, HomeLive} | ||||
| defmodule MemexWeb.LayoutView do | ||||
|   use MemexWeb, :view | ||||
|   import MemexWeb.Components.Topbar | ||||
|   alias MemexWeb.{Endpoint, HomeLive} | ||||
| 
 | ||||
|   # Phoenix LiveDashboard is available only in development by default, | ||||
|   # so we instruct Elixir to not warn if the dashboard route is missing. | ||||
| @@ -9,9 +9,9 @@ defmodule LokalWeb.LayoutView do | ||||
| 
 | ||||
|   def get_title(conn) do | ||||
|     if conn.assigns |> Map.has_key?(:title) do | ||||
|       "Lokal | #{conn.assigns.title}" | ||||
|       "Memex | #{conn.assigns.title}" | ||||
|     else | ||||
|       "Lokal" | ||||
|       "Memex" | ||||
|     end | ||||
|   end | ||||
| end | ||||
							
								
								
									
										4
									
								
								lib/memex_web/views/user_confirmation_view.ex
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								lib/memex_web/views/user_confirmation_view.ex
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,4 @@ | ||||
| defmodule MemexWeb.UserConfirmationView do | ||||
|   use MemexWeb, :view | ||||
|   alias Memex.Accounts | ||||
| end | ||||
							
								
								
									
										3
									
								
								lib/memex_web/views/user_registration_view.ex
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								lib/memex_web/views/user_registration_view.ex
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,3 @@ | ||||
| defmodule MemexWeb.UserRegistrationView do | ||||
|   use MemexWeb, :view | ||||
| end | ||||
							
								
								
									
										4
									
								
								lib/memex_web/views/user_reset_password_view.ex
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								lib/memex_web/views/user_reset_password_view.ex
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,4 @@ | ||||
| defmodule MemexWeb.UserResetPasswordView do | ||||
|   use MemexWeb, :view | ||||
|   alias Memex.Accounts | ||||
| end | ||||
							
								
								
									
										4
									
								
								lib/memex_web/views/user_session_view.ex
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								lib/memex_web/views/user_session_view.ex
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,4 @@ | ||||
| defmodule MemexWeb.UserSessionView do | ||||
|   use MemexWeb, :view | ||||
|   alias Memex.Accounts | ||||
| end | ||||
							
								
								
									
										3
									
								
								lib/memex_web/views/user_settings_view.ex
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								lib/memex_web/views/user_settings_view.ex
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,3 @@ | ||||
| defmodule MemexWeb.UserSettingsView do | ||||
|   use MemexWeb, :view | ||||
| end | ||||
| @@ -1,7 +1,7 @@ | ||||
| defmodule LokalWeb.ViewHelpers do | ||||
| defmodule MemexWeb.ViewHelpers do | ||||
|   @moduledoc """ | ||||
|   Contains common helpers that can be used in liveviews and regular views. These | ||||
|   are automatically imported into any Phoenix View using `use LokalWeb, | ||||
|   are automatically imported into any Phoenix View using `use MemexWeb, | ||||
|   :view` | ||||
|   """ | ||||
| 
 | ||||
		Reference in New Issue
	
	Block a user