init SlideLife
This commit is contained in:
@ -1,3 +0,0 @@
|
||||
defmodule ModernBase.Mailer do
|
||||
use Swoosh.Mailer, otp_app: :modern_base
|
||||
end
|
@ -1,6 +1,6 @@
|
||||
defmodule ModernBase do
|
||||
defmodule SlideLife do
|
||||
@moduledoc """
|
||||
ModernBase keeps the contexts that define your domain
|
||||
SlideLife keeps the contexts that define your domain
|
||||
and business logic.
|
||||
|
||||
Contexts are also responsible for managing your data, regardless
|
@ -1,4 +1,4 @@
|
||||
defmodule ModernBase.Application do
|
||||
defmodule SlideLife.Application do
|
||||
# See https://hexdocs.pm/elixir/Application.html
|
||||
# for more information on OTP Applications
|
||||
@moduledoc false
|
||||
@ -8,21 +8,21 @@ defmodule ModernBase.Application do
|
||||
@impl true
|
||||
def start(_type, _args) do
|
||||
children = [
|
||||
ModernBaseWeb.Telemetry,
|
||||
ModernBase.Repo,
|
||||
{DNSCluster, query: Application.get_env(:modern_base, :dns_cluster_query) || :ignore},
|
||||
{Phoenix.PubSub, name: ModernBase.PubSub},
|
||||
SlideLifeWeb.Telemetry,
|
||||
SlideLife.Repo,
|
||||
{DNSCluster, query: Application.get_env(:slide_life, :dns_cluster_query) || :ignore},
|
||||
{Phoenix.PubSub, name: SlideLife.PubSub},
|
||||
# Start the Finch HTTP client for sending emails
|
||||
{Finch, name: ModernBase.Finch},
|
||||
# Start a worker by calling: ModernBase.Worker.start_link(arg)
|
||||
# {ModernBase.Worker, arg},
|
||||
{Finch, name: SlideLife.Finch},
|
||||
# Start a worker by calling: SlideLife.Worker.start_link(arg)
|
||||
# {SlideLife.Worker, arg},
|
||||
# Start to serve requests, typically the last entry
|
||||
ModernBaseWeb.Endpoint
|
||||
SlideLifeWeb.Endpoint
|
||||
]
|
||||
|
||||
# See https://hexdocs.pm/elixir/Supervisor.html
|
||||
# for other strategies and supported options
|
||||
opts = [strategy: :one_for_one, name: ModernBase.Supervisor]
|
||||
opts = [strategy: :one_for_one, name: SlideLife.Supervisor]
|
||||
Supervisor.start_link(children, opts)
|
||||
end
|
||||
|
||||
@ -30,7 +30,7 @@ defmodule ModernBase.Application do
|
||||
# whenever the application is updated.
|
||||
@impl true
|
||||
def config_change(changed, _new, removed) do
|
||||
ModernBaseWeb.Endpoint.config_change(changed, removed)
|
||||
SlideLifeWeb.Endpoint.config_change(changed, removed)
|
||||
:ok
|
||||
end
|
||||
end
|
3
lib/slide_life/mailer.ex
Normal file
3
lib/slide_life/mailer.ex
Normal file
@ -0,0 +1,3 @@
|
||||
defmodule SlideLife.Mailer do
|
||||
use Swoosh.Mailer, otp_app: :slide_life
|
||||
end
|
@ -1,5 +1,5 @@
|
||||
defmodule ModernBase.Repo do
|
||||
defmodule SlideLife.Repo do
|
||||
use Ecto.Repo,
|
||||
otp_app: :modern_base,
|
||||
otp_app: :slide_life,
|
||||
adapter: Ecto.Adapters.Postgres
|
||||
end
|
@ -1,12 +1,12 @@
|
||||
defmodule ModernBaseWeb do
|
||||
defmodule SlideLifeWeb do
|
||||
@moduledoc """
|
||||
The entrypoint for defining your web interface, such
|
||||
as controllers, components, channels, and so on.
|
||||
|
||||
This can be used in your application as:
|
||||
|
||||
use ModernBaseWeb, :controller
|
||||
use ModernBaseWeb, :html
|
||||
use SlideLifeWeb, :controller
|
||||
use SlideLifeWeb, :html
|
||||
|
||||
The definitions below will be executed for every controller,
|
||||
component, etc, so keep them short and clean, focused
|
||||
@ -40,10 +40,10 @@ defmodule ModernBaseWeb do
|
||||
quote do
|
||||
use Phoenix.Controller,
|
||||
formats: [:html, :json],
|
||||
layouts: [html: ModernBaseWeb.Layouts]
|
||||
layouts: [html: SlideLifeWeb.Layouts]
|
||||
|
||||
import Plug.Conn
|
||||
import ModernBaseWeb.Gettext
|
||||
import SlideLifeWeb.Gettext
|
||||
|
||||
unquote(verified_routes())
|
||||
end
|
||||
@ -52,7 +52,7 @@ defmodule ModernBaseWeb do
|
||||
def live_view do
|
||||
quote do
|
||||
use Phoenix.LiveView,
|
||||
layout: {ModernBaseWeb.Layouts, :app}
|
||||
layout: {SlideLifeWeb.Layouts, :app}
|
||||
|
||||
unquote(html_helpers())
|
||||
end
|
||||
@ -84,8 +84,8 @@ defmodule ModernBaseWeb do
|
||||
# HTML escaping functionality
|
||||
import Phoenix.HTML
|
||||
# Core UI components and translation
|
||||
import ModernBaseWeb.CoreComponents
|
||||
import ModernBaseWeb.Gettext
|
||||
import SlideLifeWeb.CoreComponents
|
||||
import SlideLifeWeb.Gettext
|
||||
|
||||
# Shortcut for generating JS commands
|
||||
alias Phoenix.LiveView.JS
|
||||
@ -98,9 +98,9 @@ defmodule ModernBaseWeb do
|
||||
def verified_routes do
|
||||
quote do
|
||||
use Phoenix.VerifiedRoutes,
|
||||
endpoint: ModernBaseWeb.Endpoint,
|
||||
router: ModernBaseWeb.Router,
|
||||
statics: ModernBaseWeb.static_paths()
|
||||
endpoint: SlideLifeWeb.Endpoint,
|
||||
router: SlideLifeWeb.Router,
|
||||
statics: SlideLifeWeb.static_paths()
|
||||
end
|
||||
end
|
||||
|
@ -1,4 +1,4 @@
|
||||
defmodule ModernBaseWeb.CoreComponents do
|
||||
defmodule SlideLifeWeb.CoreComponents do
|
||||
@moduledoc """
|
||||
Provides core UI components.
|
||||
|
||||
@ -17,7 +17,7 @@ defmodule ModernBaseWeb.CoreComponents do
|
||||
use Phoenix.Component
|
||||
|
||||
alias Phoenix.LiveView.JS
|
||||
import ModernBaseWeb.Gettext
|
||||
import SlideLifeWeb.Gettext
|
||||
|
||||
@doc """
|
||||
Renders a modal.
|
||||
@ -661,9 +661,9 @@ defmodule ModernBaseWeb.CoreComponents do
|
||||
# with our gettext backend as first argument. Translations are
|
||||
# available in the errors.po file (as we use the "errors" domain).
|
||||
if count = opts[:count] do
|
||||
Gettext.dngettext(ModernBaseWeb.Gettext, "errors", msg, msg, count, opts)
|
||||
Gettext.dngettext(SlideLifeWeb.Gettext, "errors", msg, msg, count, opts)
|
||||
else
|
||||
Gettext.dgettext(ModernBaseWeb.Gettext, "errors", msg, opts)
|
||||
Gettext.dgettext(SlideLifeWeb.Gettext, "errors", msg, opts)
|
||||
end
|
||||
end
|
||||
|
@ -1,14 +1,14 @@
|
||||
defmodule ModernBaseWeb.Layouts do
|
||||
defmodule SlideLifeWeb.Layouts do
|
||||
@moduledoc """
|
||||
This module holds different layouts used by your application.
|
||||
|
||||
See the `layouts` directory for all templates available.
|
||||
The "root" layout is a skeleton rendered as part of the
|
||||
application router. The "app" layout is set as the default
|
||||
layout on both `use ModernBaseWeb, :controller` and
|
||||
`use ModernBaseWeb, :live_view`.
|
||||
layout on both `use SlideLifeWeb, :controller` and
|
||||
`use SlideLifeWeb, :live_view`.
|
||||
"""
|
||||
use ModernBaseWeb, :html
|
||||
use SlideLifeWeb, :html
|
||||
|
||||
embed_templates "layouts/*"
|
||||
end
|
@ -5,7 +5,7 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<meta name="csrf-token" content={get_csrf_token()} />
|
||||
<.live_title suffix=" · Phoenix Framework">
|
||||
<%= assigns[:page_title] || "ModernBase" %>
|
||||
<%= assigns[:page_title] || "SlideLife" %>
|
||||
</.live_title>
|
||||
<link phx-track-static rel="stylesheet" href={~p"/assets/app.css"} />
|
||||
<script defer phx-track-static type="text/javascript" src={~p"/assets/app.js"}>
|
@ -1,17 +1,17 @@
|
||||
defmodule ModernBaseWeb.ErrorHTML do
|
||||
defmodule SlideLifeWeb.ErrorHTML do
|
||||
@moduledoc """
|
||||
This module is invoked by your endpoint in case of errors on HTML requests.
|
||||
|
||||
See config/config.exs.
|
||||
"""
|
||||
use ModernBaseWeb, :html
|
||||
use SlideLifeWeb, :html
|
||||
|
||||
# If you want to customize your error pages,
|
||||
# uncomment the embed_templates/1 call below
|
||||
# and add pages to the error directory:
|
||||
#
|
||||
# * lib/modern_base_web/controllers/error_html/404.html.heex
|
||||
# * lib/modern_base_web/controllers/error_html/500.html.heex
|
||||
# * lib/slide_life_web/controllers/error_html/404.html.heex
|
||||
# * lib/slide_life_web/controllers/error_html/500.html.heex
|
||||
#
|
||||
# embed_templates "error_html/*"
|
||||
|
@ -1,4 +1,4 @@
|
||||
defmodule ModernBaseWeb.ErrorJSON do
|
||||
defmodule SlideLifeWeb.ErrorJSON do
|
||||
@moduledoc """
|
||||
This module is invoked by your endpoint in case of errors on JSON requests.
|
||||
|
@ -1,5 +1,5 @@
|
||||
defmodule ModernBaseWeb.PageController do
|
||||
use ModernBaseWeb, :controller
|
||||
defmodule SlideLifeWeb.PageController do
|
||||
use SlideLifeWeb, :controller
|
||||
|
||||
def home(conn, _params) do
|
||||
# The home page is often custom made,
|
@ -1,10 +1,10 @@
|
||||
defmodule ModernBaseWeb.PageHTML do
|
||||
defmodule SlideLifeWeb.PageHTML do
|
||||
@moduledoc """
|
||||
This module contains pages rendered by PageController.
|
||||
|
||||
See the `page_html` directory for all templates available.
|
||||
"""
|
||||
use ModernBaseWeb, :html
|
||||
use SlideLifeWeb, :html
|
||||
|
||||
embed_templates "page_html/*"
|
||||
end
|
@ -1,12 +1,12 @@
|
||||
defmodule ModernBaseWeb.Endpoint do
|
||||
use Phoenix.Endpoint, otp_app: :modern_base
|
||||
defmodule SlideLifeWeb.Endpoint do
|
||||
use Phoenix.Endpoint, otp_app: :slide_life
|
||||
|
||||
# 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: "_modern_base_key",
|
||||
key: "_slide_life_key",
|
||||
signing_salt: "ExhFLciv",
|
||||
same_site: "Lax"
|
||||
]
|
||||
@ -21,9 +21,9 @@ defmodule ModernBaseWeb.Endpoint do
|
||||
# when deploying your static files in production.
|
||||
plug Plug.Static,
|
||||
at: "/",
|
||||
from: :modern_base,
|
||||
from: :slide_life,
|
||||
gzip: false,
|
||||
only: ModernBaseWeb.static_paths()
|
||||
only: SlideLifeWeb.static_paths()
|
||||
|
||||
# Code reloading can be explicitly enabled under the
|
||||
# :code_reloader configuration of your endpoint.
|
||||
@ -31,7 +31,7 @@ defmodule ModernBaseWeb.Endpoint do
|
||||
socket "/phoenix/live_reload/socket", Phoenix.LiveReloader.Socket
|
||||
plug Phoenix.LiveReloader
|
||||
plug Phoenix.CodeReloader
|
||||
plug Phoenix.Ecto.CheckRepoStatus, otp_app: :modern_base
|
||||
plug Phoenix.Ecto.CheckRepoStatus, otp_app: :slide_life
|
||||
end
|
||||
|
||||
plug Phoenix.LiveDashboard.RequestLogger,
|
||||
@ -49,5 +49,5 @@ defmodule ModernBaseWeb.Endpoint do
|
||||
plug Plug.MethodOverride
|
||||
plug Plug.Head
|
||||
plug Plug.Session, @session_options
|
||||
plug ModernBaseWeb.Router
|
||||
plug SlideLifeWeb.Router
|
||||
end
|
@ -1,11 +1,11 @@
|
||||
defmodule ModernBaseWeb.Gettext do
|
||||
defmodule SlideLifeWeb.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 ModernBaseWeb.Gettext
|
||||
import SlideLifeWeb.Gettext
|
||||
|
||||
# Simple translation
|
||||
gettext("Here is the string to translate")
|
||||
@ -20,5 +20,5 @@ defmodule ModernBaseWeb.Gettext do
|
||||
|
||||
See the [Gettext Docs](https://hexdocs.pm/gettext) for detailed usage.
|
||||
"""
|
||||
use Gettext, otp_app: :modern_base
|
||||
use Gettext, otp_app: :slide_life
|
||||
end
|
@ -1,11 +1,11 @@
|
||||
defmodule ModernBaseWeb.Router do
|
||||
use ModernBaseWeb, :router
|
||||
defmodule SlideLifeWeb.Router do
|
||||
use SlideLifeWeb, :router
|
||||
|
||||
pipeline :browser do
|
||||
plug :accepts, ["html"]
|
||||
plug :fetch_session
|
||||
plug :fetch_live_flash
|
||||
plug :put_root_layout, html: {ModernBaseWeb.Layouts, :root}
|
||||
plug :put_root_layout, html: {SlideLifeWeb.Layouts, :root}
|
||||
plug :protect_from_forgery
|
||||
plug :put_secure_browser_headers
|
||||
end
|
||||
@ -14,19 +14,19 @@ defmodule ModernBaseWeb.Router do
|
||||
plug :accepts, ["json"]
|
||||
end
|
||||
|
||||
scope "/", ModernBaseWeb do
|
||||
scope "/", SlideLifeWeb do
|
||||
pipe_through :browser
|
||||
|
||||
get "/", PageController, :home
|
||||
end
|
||||
|
||||
# Other scopes may use custom stacks.
|
||||
# scope "/api", ModernBaseWeb do
|
||||
# scope "/api", SlideLifeWeb do
|
||||
# pipe_through :api
|
||||
# end
|
||||
|
||||
# Enable LiveDashboard and Swoosh mailbox preview in development
|
||||
if Application.compile_env(:modern_base, :dev_routes) do
|
||||
if Application.compile_env(:slide_life, :dev_routes) do
|
||||
# If you want to use the LiveDashboard in production, you should put
|
||||
# it behind authentication and allow only admins to access it.
|
||||
# If your application does not have an admins-only section yet,
|
||||
@ -37,7 +37,7 @@ defmodule ModernBaseWeb.Router do
|
||||
scope "/dev" do
|
||||
pipe_through :browser
|
||||
|
||||
live_dashboard "/dashboard", metrics: ModernBaseWeb.Telemetry
|
||||
live_dashboard "/dashboard", metrics: SlideLifeWeb.Telemetry
|
||||
forward "/mailbox", Plug.Swoosh.MailboxPreview
|
||||
end
|
||||
end
|
@ -1,4 +1,4 @@
|
||||
defmodule ModernBaseWeb.Telemetry do
|
||||
defmodule SlideLifeWeb.Telemetry do
|
||||
use Supervisor
|
||||
import Telemetry.Metrics
|
||||
|
||||
@ -52,23 +52,23 @@ defmodule ModernBaseWeb.Telemetry do
|
||||
),
|
||||
|
||||
# Database Metrics
|
||||
summary("modern_base.repo.query.total_time",
|
||||
summary("slide_life.repo.query.total_time",
|
||||
unit: {:native, :millisecond},
|
||||
description: "The sum of the other measurements"
|
||||
),
|
||||
summary("modern_base.repo.query.decode_time",
|
||||
summary("slide_life.repo.query.decode_time",
|
||||
unit: {:native, :millisecond},
|
||||
description: "The time spent decoding the data received from the database"
|
||||
),
|
||||
summary("modern_base.repo.query.query_time",
|
||||
summary("slide_life.repo.query.query_time",
|
||||
unit: {:native, :millisecond},
|
||||
description: "The time spent executing the query"
|
||||
),
|
||||
summary("modern_base.repo.query.queue_time",
|
||||
summary("slide_life.repo.query.queue_time",
|
||||
unit: {:native, :millisecond},
|
||||
description: "The time spent waiting for a database connection"
|
||||
),
|
||||
summary("modern_base.repo.query.idle_time",
|
||||
summary("slide_life.repo.query.idle_time",
|
||||
unit: {:native, :millisecond},
|
||||
description:
|
||||
"The time the connection spent waiting before being checked out for the query"
|
||||
@ -86,7 +86,7 @@ defmodule ModernBaseWeb.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.
|
||||
# {ModernBaseWeb, :count_users, []}
|
||||
# {SlideLifeWeb, :count_users, []}
|
||||
]
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user