Update directory structure to Phoenix 1.3 layout

phx13
Marcin Kulik 7 years ago
parent f249d4a276
commit ea8d1c9b40

1
assets/.gitignore vendored

@ -0,0 +1 @@
/node_modules

@ -14,8 +14,8 @@ exports.config = {
// To change the order of concatenation of files, explicitly mention here
order: {
before: [
"web/static/vendor/js/jquery-2.2.4.min.js",
"web/static/vendor/js/bootstrap.js"
"vendor/js/jquery-2.2.4.min.js",
"vendor/js/bootstrap.js"
]
}
},
@ -23,19 +23,19 @@ exports.config = {
joinTo: "css/app.css",
order: {
before: [
"web/static/vendor/css/bootstrap.css",
"web/static/css/source-sans-pro.css",
"web/static/css/base.sass",
"web/static/css/header.sass",
"web/static/css/flash.sass",
"web/static/css/footer.sass",
"web/static/css/home.sass",
"web/static/css/asciicasts.sass",
"web/static/css/users.sass",
"web/static/css/preview.sass",
"web/static/css/player.sass",
"web/static/css/contributing.sass",
"web/static/css/simple-layout.sass",
"vendor/css/bootstrap.css",
"css/source-sans-pro.css",
"css/base.sass",
"css/header.sass",
"css/flash.sass",
"css/footer.sass",
"css/home.sass",
"css/asciicasts.sass",
"css/users.sass",
"css/preview.sass",
"css/player.sass",
"css/contributing.sass",
"css/simple-layout.sass",
]
}
},
@ -46,34 +46,31 @@ exports.config = {
conventions: {
// This option sets where we should place non-css and non-js assets in.
// By default, we set this to "/web/static/assets". Files in this directory
// By default, we set this to "/assets/static". Files in this directory
// will be copied to `paths.public`, which is "priv/static" by default.
assets: /^(web\/static\/assets)/
assets: /^(static)/
},
// Phoenix paths configuration
paths: {
// Dependencies and current project directories to watch
watched: [
"web/static",
"test/static"
],
watched: ["static", "css", "js", "vendor"],
// Where to compile files to
public: "priv/static"
public: "../priv/static"
},
// Configure your plugins
plugins: {
babel: {
// Do not use ES6 compiler in vendor code
ignore: [/web\/static\/vendor/]
ignore: [/vendor/]
}
},
modules: {
autoRequire: {
"js/app.js": ["web/static/js/app"]
"js/app.js": ["js/app"]
}
},

@ -6,16 +6,16 @@
"watch": "brunch watch --stdin"
},
"dependencies": {
"phoenix": "file:deps/phoenix",
"phoenix_html": "file:deps/phoenix_html"
"phoenix": "file:../deps/phoenix",
"phoenix_html": "file:../deps/phoenix_html"
},
"devDependencies": {
"babel-brunch": "~6.0.0",
"brunch": "2.7.4",
"clean-css-brunch": "~2.0.0",
"babel-brunch": "6.0.6",
"brunch": "2.10.7",
"clean-css-brunch": "2.10.0",
"css-brunch": "~2.0.0",
"sass-brunch": "^2.6.3",
"javascript-brunch": "~2.0.0",
"uglify-js-brunch": "~2.0.1"
"uglify-js-brunch": "2.1.1"
}
}

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

Before

Width:  |  Height:  |  Size: 768 B

After

Width:  |  Height:  |  Size: 768 B

Before

Width:  |  Height:  |  Size: 188 KiB

After

Width:  |  Height:  |  Size: 188 KiB

Before

Width:  |  Height:  |  Size: 731 B

After

Width:  |  Height:  |  Size: 731 B

Before

Width:  |  Height:  |  Size: 62 KiB

After

Width:  |  Height:  |  Size: 62 KiB

@ -10,10 +10,10 @@ config :asciinema,
ecto_repos: [Asciinema.Repo]
# Configures the endpoint
config :asciinema, Asciinema.Endpoint,
config :asciinema, AsciinemaWeb.Endpoint,
url: [host: "localhost"],
secret_key_base: System.get_env("SECRET_KEY_BASE"),
render_errors: [view: Asciinema.ErrorView, accepts: ~w(html json)],
render_errors: [view: AsciinemaWeb.ErrorView, accepts: ~w(html json)],
pubsub: [name: Asciinema.PubSub,
adapter: Phoenix.PubSub.PG2]

@ -6,24 +6,24 @@ use Mix.Config
# The watchers configuration can be used to run external
# watchers to your application. For example, we use it
# with brunch.io to recompile .js and .css sources.
config :asciinema, Asciinema.Endpoint,
config :asciinema, AsciinemaWeb.Endpoint,
http: [port: 4000],
debug_errors: true,
code_reloader: true,
check_origin: false,
secret_key_base: System.get_env("SECRET_KEY_BASE") || "60BnXnzGGwwiZj91YA9XYKF9BCiM7lQ/1um8VXcWWLSdUp9OcPZV6YnQv7eFTYSY",
watchers: [node: ["node_modules/brunch/bin/brunch", "watch", "--stdin",
cd: Path.expand("../", __DIR__)]]
cd: Path.expand("../assets", __DIR__)]]
# Watch static and templates for browser reloading.
config :asciinema, Asciinema.Endpoint,
config :asciinema, AsciinemaWeb.Endpoint,
live_reload: [
patterns: [
~r{priv/static/.*(js|css|png|jpeg|jpg|gif|svg)$},
~r{priv/gettext/.*(po)$},
~r{web/views/.*(ex)$},
~r{web/templates/.*(eex|md)$}
~r{lib/asciinema_web/views/.*(ex)$},
~r{lib/asciinema_web/templates/.*(eex|md)$}
]
]

@ -11,7 +11,7 @@ use Mix.Config
# containing the digested version of static files. This
# manifest is generated by the mix phoenix.digest task
# which you typically run after static files are built.
config :asciinema, Asciinema.Endpoint,
config :asciinema, AsciinemaWeb.Endpoint,
http: [port: {:system, "PORT"}],
url: [scheme: System.get_env("URL_SCHEME") || "https",
host: System.get_env("URL_HOST") || "asciinema.org",
@ -26,7 +26,7 @@ config :logger, level: :info
# To get SSL working, you will need to add the `https` key
# to the previous section and set your `:url` port to 443:
#
# config :asciinema, Asciinema.Endpoint,
# config :asciinema, AsciinemaWeb.Endpoint,
# ...
# url: [host: "example.com", port: 443],
# https: [port: 443,
@ -40,7 +40,7 @@ config :logger, level: :info
# We also recommend setting `force_ssl`, ensuring no data is
# ever sent via http, always redirecting to https:
#
# config :asciinema, Asciinema.Endpoint,
# config :asciinema, AsciinemaWeb.Endpoint,
# force_ssl: [hsts: true]
#
# Check `Plug.SSL` for all available options in `force_ssl`.
@ -55,7 +55,7 @@ config :logger, level: :info
# Alternatively, you can configure exactly which server to
# start per endpoint:
#
# config :asciinema, Asciinema.Endpoint, server: true
# config :asciinema, AsciinemaWeb.Endpoint, server: true
#
config :asciinema, Asciinema.Repo,

@ -2,7 +2,7 @@ use Mix.Config
# We don't run a server during test. If one is required,
# you can enable the server option below.
config :asciinema, Asciinema.Endpoint,
config :asciinema, AsciinemaWeb.Endpoint,
http: [port: 4001],
secret_key_base: "ssecretkeybasesecretkeybasesecretkeybasesecretkeybaseecretkeybase",
server: false

@ -1,4 +1,4 @@
defmodule Asciinema do
defmodule Asciinema.Application do
use Application
# See http://elixir-lang.org/docs/stable/elixir/Application.html
@ -13,7 +13,7 @@ defmodule Asciinema do
# Start the Ecto repository
supervisor(Asciinema.Repo, []),
# Start the endpoint when the application starts
supervisor(Asciinema.Endpoint, []),
supervisor(AsciinemaWeb.Endpoint, []),
# Start your own worker by calling: Asciinema.Worker.start_link(arg1, arg2, arg3)
# worker(Asciinema.Worker, [arg1, arg2, arg3]),
:poolboy.child_spec(:worker, Asciinema.PngGenerator.A2png.poolboy_config(), []),
@ -27,11 +27,4 @@ defmodule Asciinema do
opts = [strategy: :one_for_one, name: Asciinema.Supervisor]
Supervisor.start_link(children, opts)
end
# Tell Phoenix to update the endpoint configuration
# whenever the application is updated.
def config_change(changed, _new, removed) do
Asciinema.Endpoint.config_change(changed, removed)
:ok
end
end

@ -1,6 +1,8 @@
defmodule Asciinema.Asciicast do
use Asciinema.Web, :model
alias Asciinema.{User, Asciicast}
defmodule Asciinema.Asciicasts.Asciicast do
use Ecto.Schema
import Ecto.Changeset
alias Asciinema.Users.User
alias Asciinema.Asciicasts.Asciicast
alias Asciinema.PngGenerator.PngParams
@default_png_scale 2

@ -1,7 +1,7 @@
defmodule Asciinema.Asciicasts do
import Ecto.Query, warn: false
alias Asciinema.{Repo, Asciicast, FileStore, StringUtils, Vt}
alias Asciinema.Asciicasts.{SnapshotUpdater, FramesGenerator}
alias Asciinema.{Repo, FileStore, StringUtils, Vt}
alias Asciinema.Asciicasts.{Asciicast, SnapshotUpdater, FramesGenerator}
def get_asciicast!(id) when is_integer(id) do
Repo.get!(Asciicast, id)

@ -1,5 +1,5 @@
defmodule Asciinema.Asciicasts.FramesGenerator do
alias Asciinema.Asciicast
alias Asciinema.Asciicasts.Asciicast
@doc "Generates frames file for given asciicast"
@callback generate_frames(asciicast :: %Asciicast{}) :: :ok | {:error, term}

@ -1,5 +1,5 @@
defmodule Asciinema.Asciicasts.FramesGenerator.Sidekiq do
alias Asciinema.Asciicast
alias Asciinema.Asciicasts.Asciicast
alias Asciinema.SidekiqClient
def generate_frames(%Asciicast{id: id}) do

@ -1,5 +1,5 @@
defmodule Asciinema.Asciicasts.SnapshotUpdater do
alias Asciinema.Asciicast
alias Asciinema.Asciicasts.Asciicast
@doc "Generates poster for given asciicast"
@callback update_snapshot(asciicast :: %Asciicast{}) :: :ok | {:error, term}

@ -1,5 +1,6 @@
defmodule Asciinema.Asciicasts.SnapshotUpdater.Exq do
alias Asciinema.{Repo, Asciicasts, Asciicast}
alias Asciinema.{Repo, Asciicasts}
alias Asciinema.Asciicasts.Asciicast
def update_snapshot(%Asciicast{id: id}) do
{:ok, _jid} = Exq.enqueue(Exq, "default", __MODULE__, [id])

@ -1,5 +1,6 @@
defmodule Asciinema.Asciicasts.SnapshotUpdater.Sync do
alias Asciinema.{Asciicast, Asciicasts}
alias Asciinema.Asciicasts
alias Asciinema.Asciicasts.Asciicast
def update_snapshot(%Asciicast{} = asciicast) do
{:ok, _} = Asciicasts.update_snapshot(asciicast)

@ -1,5 +1,5 @@
defmodule Asciinema.Email do
use Bamboo.Phoenix, view: Asciinema.EmailView
use Bamboo.Phoenix, view: AsciinemaWeb.EmailView
import Bamboo.Email
def signup_email(email_address, signup_url) do

@ -1,5 +1,5 @@
defmodule Asciinema.PngGenerator do
alias Asciinema.Asciicast
alias Asciinema.Asciicasts.Asciicast
alias Asciinema.PngGenerator.PngParams
@doc "Generates PNG image from asciicast and returns path to it"

@ -1,7 +1,7 @@
defmodule Asciinema.PngGenerator.A2png do
@behaviour Asciinema.PngGenerator
use GenServer
alias Asciinema.Asciicast
alias Asciinema.Asciicasts.Asciicast
alias Asciinema.PngGenerator.PngParams
@pool_name :worker

@ -1,6 +1,7 @@
defmodule Asciinema.ApiToken do
use Asciinema.Web, :model
alias Asciinema.{ApiToken, User}
defmodule Asciinema.Users.ApiToken do
use Ecto.Schema
import Ecto.Changeset
alias Asciinema.Users.{ApiToken, User}
schema "api_tokens" do
field :token, :string
@ -8,7 +9,7 @@ defmodule Asciinema.ApiToken do
timestamps(inserted_at: :created_at)
belongs_to :user, Asciinema.User
belongs_to :user, User
end
@uuid4 ~r/\A[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}\z/

@ -1,6 +1,7 @@
defmodule Asciinema.User do
use Asciinema.Web, :model
alias Asciinema.User
defmodule Asciinema.Users.User do
use Ecto.Schema
import Ecto.Changeset
alias Asciinema.Users.User
@valid_email_re ~r/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i
@ -16,8 +17,8 @@ defmodule Asciinema.User do
timestamps(inserted_at: :created_at)
has_many :asciicasts, Asciinema.Asciicast
has_many :api_tokens, Asciinema.ApiToken
has_many :asciicasts, Asciinema.Asciicasts.Asciicast
has_many :api_tokens, Asciinema.Users.ApiToken
end
def changeset(struct, params \\ %{}) do

@ -1,7 +1,8 @@
defmodule Asciinema.Users do
import Ecto.Query, warn: false
import Ecto, only: [assoc: 2]
alias Asciinema.{Repo, User, ApiToken, Asciicasts, Email, Mailer, Auth}
alias Asciinema.Users.{User, ApiToken}
alias Asciinema.{Repo, Asciicasts, Email, Mailer}
def create_asciinema_user!() do
attrs = %{username: "asciinema",
@ -80,20 +81,20 @@ defmodule Asciinema.Users do
end
defp signup_url(email) do
token = Phoenix.Token.sign(Asciinema.Endpoint, "signup", email)
Asciinema.Router.Helpers.users_url(Asciinema.Endpoint, :new, t: token)
token = Phoenix.Token.sign(AsciinemaWeb.Endpoint, "signup", email)
AsciinemaWeb.Router.Helpers.users_url(AsciinemaWeb.Endpoint, :new, t: token)
end
defp login_url(%User{id: id, last_login_at: last_login_at}) do
last_login_at = last_login_at && Timex.to_unix(last_login_at)
token = Phoenix.Token.sign(Asciinema.Endpoint, "login", {id, last_login_at})
Asciinema.Router.Helpers.session_url(Asciinema.Endpoint, :new, t: token)
token = Phoenix.Token.sign(AsciinemaWeb.Endpoint, "login", {id, last_login_at})
AsciinemaWeb.Router.Helpers.session_url(AsciinemaWeb.Endpoint, :new, t: token)
end
@login_token_max_age 15 * 60 # 15 minutes
alias Phoenix.Token
alias Asciinema.Endpoint
alias AsciinemaWeb.Endpoint
def verify_signup_token(token) do
with {:ok, email} <- Token.verify(Endpoint, "signup", token, max_age: @login_token_max_age),
@ -124,11 +125,6 @@ defmodule Asciinema.Users do
end
end
def log_in(conn, %User{} = user) do
user = user |> User.login_changeset |> Repo.update!
Auth.login(conn, user)
end
def authenticate(api_token) do
q = from u in User,
join: at in ApiToken,

@ -1,12 +1,12 @@
defmodule Asciinema.Web do
defmodule AsciinemaWeb do
@moduledoc """
A module that keeps using definitions for controllers,
views and so on.
This can be used in your application as:
use Asciinema.Web, :controller
use Asciinema.Web, :view
use AsciinemaWeb, :controller
use AsciinemaWeb, :view
The definitions below will be executed for every view,
controller, etc, so keep them short and clean, focused
@ -16,35 +16,25 @@ defmodule Asciinema.Web do
below.
"""
def model do
quote do
use Ecto.Schema
@timestamps_opts inserted_at: :created_at
import Ecto
import Ecto.Changeset
import Ecto.Query
end
end
def controller do
quote do
use Phoenix.Controller
use Phoenix.Controller, namespace: AsciinemaWeb
alias Asciinema.Repo
import Ecto
import Ecto.Query
import Asciinema.Router.Helpers
import Asciinema.Router.Helpers.Extra
import Asciinema.Gettext
import Asciinema.Rails.Flash
import AsciinemaWeb.Router.Helpers
import AsciinemaWeb.Router.Helpers.Extra
import AsciinemaWeb.Gettext
import AsciinemaWeb.Rails.Flash
end
end
def view do
quote do
use Phoenix.View, root: "web/templates"
use Phoenix.View, root: "lib/asciinema_web/templates",
namespace: AsciinemaWeb
# Import convenience functions from controllers
import Phoenix.Controller, only: [get_csrf_token: 0, get_flash: 2, view_module: 1]
@ -52,10 +42,10 @@ defmodule Asciinema.Web do
# Use all HTML functionality (forms, tags, etc)
use Phoenix.HTML
import Asciinema.Router.Helpers
import Asciinema.Router.Helpers.Extra
import Asciinema.ErrorHelpers
import Asciinema.Gettext
import AsciinemaWeb.Router.Helpers
import AsciinemaWeb.Router.Helpers.Extra
import AsciinemaWeb.ErrorHelpers
import AsciinemaWeb.Gettext
end
end
@ -73,7 +63,7 @@ defmodule Asciinema.Web do
alias Asciinema.Repo
import Ecto
import Ecto.Query
import Asciinema.Gettext
import AsciinemaWeb.Gettext
end
end

@ -1,6 +1,7 @@
defmodule Asciinema.Auth do
defmodule AsciinemaWeb.Auth do
import Plug.Conn
alias Asciinema.{Repo, User}
alias Asciinema.Users.User
alias Asciinema.Repo
@user_key "warden.user.user.key"
@one_year_in_secs 31557600
@ -18,10 +19,12 @@ defmodule Asciinema.Auth do
assign(conn, :current_user, user)
end
def login(conn, %User{id: id, auth_token: auth_token} = user) do
def log_in(conn, %User{} = user) do
user = user |> User.login_changeset |> Repo.update!
conn
|> put_session(@user_key, id)
|> put_resp_cookie("auth_token", auth_token, max_age: @one_year_in_secs)
|> put_session(@user_key, user.id)
|> put_resp_cookie("auth_token", user.auth_token, max_age: @one_year_in_secs)
|> assign(:current_user, user)
end

@ -1,4 +1,4 @@
defmodule Asciinema.UserSocket do
defmodule AsciinemaWeb.UserSocket do
use Phoenix.Socket
## Channels
@ -30,7 +30,7 @@ defmodule Asciinema.UserSocket do
# Would allow you to broadcast a "disconnect" event and terminate
# all active sockets and channels for a given user:
#
# Asciinema.Endpoint.broadcast("users_socket:#{user.id}", "disconnect", %{})
# AsciinemaWeb.Endpoint.broadcast("users_socket:#{user.id}", "disconnect", %{})
#
# Returning `nil` makes this socket anonymous.
def id(_socket), do: nil

@ -1,7 +1,8 @@
defmodule Asciinema.Api.AsciicastController do
use Asciinema.Web, :controller
import Asciinema.Auth, only: [get_basic_auth: 1, put_basic_auth: 3]
alias Asciinema.{Asciicasts, Users, User}
defmodule AsciinemaWeb.Api.AsciicastController do
use AsciinemaWeb, :controller
import AsciinemaWeb.Auth, only: [get_basic_auth: 1, put_basic_auth: 3]
alias Asciinema.{Asciicasts, Users}
alias Asciinema.Users.User
plug :parse_v0_params
plug :authenticate

@ -1,5 +1,5 @@
defmodule Asciinema.AsciicastAnimationController do
use Asciinema.Web, :controller
defmodule AsciinemaWeb.AsciicastAnimationController do
use AsciinemaWeb, :controller
alias Asciinema.Asciicasts
def show(conn, %{"id" => id}) do

@ -1,5 +1,5 @@
defmodule Asciinema.AsciicastEmbedController do
use Asciinema.Web, :controller
defmodule AsciinemaWeb.AsciicastEmbedController do
use AsciinemaWeb, :controller
@max_age 60

@ -1,6 +1,7 @@
defmodule Asciinema.AsciicastFileController do
use Asciinema.Web, :controller
alias Asciinema.{Asciicasts, Asciicast}
defmodule AsciinemaWeb.AsciicastFileController do
use AsciinemaWeb, :controller
alias Asciinema.Asciicasts
alias Asciinema.Asciicasts.Asciicast
def show(conn, %{"id" => id} = params) do
asciicast = Asciicasts.get_asciicast!(id)

@ -1,6 +1,7 @@
defmodule Asciinema.AsciicastImageController do
use Asciinema.Web, :controller
alias Asciinema.{Asciicasts, Asciicast, PngGenerator}
defmodule AsciinemaWeb.AsciicastImageController do
use AsciinemaWeb, :controller
alias Asciinema.{Asciicasts, PngGenerator}
alias Asciinema.Asciicasts.Asciicast
alias Plug.MIME
@max_age 604800 # 7 days

@ -1,6 +1,6 @@
defmodule Asciinema.DocController do
use Asciinema.Web, :controller
alias Asciinema.{DocView, ErrorView}
defmodule AsciinemaWeb.DocController do
use AsciinemaWeb, :controller
alias AsciinemaWeb.{DocView, ErrorView}
@topics ["how-it-works", "getting-started", "installation", "usage", "config", "embedding", "faq"]

@ -1,5 +1,5 @@
defmodule Asciinema.LoginController do
use Asciinema.Web, :controller
defmodule AsciinemaWeb.LoginController do
use AsciinemaWeb, :controller
alias Asciinema.Users
def new(conn, _params) do

@ -1,7 +1,9 @@
defmodule Asciinema.SessionController do
use Asciinema.Web, :controller
import Asciinema.UserView, only: [profile_path: 1]
alias Asciinema.{Users, User}
defmodule AsciinemaWeb.SessionController do
use AsciinemaWeb, :controller
import AsciinemaWeb.UserView, only: [profile_path: 1]
alias Asciinema.Users
alias AsciinemaWeb.Auth
alias Asciinema.Users.User
def new(conn, %{"t" => login_token}) do
conn
@ -34,7 +36,7 @@ defmodule Asciinema.SessionController do
case Users.verify_login_token(login_token) do
{:ok, user} ->
conn
|> Users.log_in(user)
|> Auth.log_in(user)
|> put_rails_flash(:notice, "Welcome back!")
|> redirect_to_profile
{:error, :token_invalid} ->
@ -58,12 +60,12 @@ defmodule Asciinema.SessionController do
case {current_user, logging_user} do
{nil, %User{email: nil}} ->
conn
|> Users.log_in(logging_user)
|> Auth.log_in(logging_user)
|> put_rails_flash(:notice, "Welcome! Setting username and email will help you with logging in later.")
|> redirect_to_edit_profile
{nil, %User{}} ->
conn
|> Users.log_in(logging_user)
|> Auth.log_in(logging_user)
|> put_rails_flash(:notice, "Welcome back!")
|> redirect_to_profile
{%User{id: id, email: nil}, %User{id: id}} ->
@ -78,7 +80,7 @@ defmodule Asciinema.SessionController do
{%User{email: nil}, %User{}} ->
Users.merge!(logging_user, current_user)
conn
|> Users.log_in(logging_user)
|> Auth.log_in(logging_user)
|> put_rails_flash(:notice, "Recorder token has been added to your account.")
|> redirect_to_profile
{%User{}, %User{email: nil}} ->

@ -1,6 +1,7 @@
defmodule Asciinema.UserController do
use Asciinema.Web, :controller
defmodule AsciinemaWeb.UserController do
use AsciinemaWeb, :controller
alias Asciinema.Users
alias AsciinemaWeb.Auth
def new(conn, %{"t" => signup_token}) do
conn
@ -18,7 +19,7 @@ defmodule Asciinema.UserController do
case Users.verify_signup_token(signup_token) do
{:ok, user} ->
conn
|> Users.log_in(user)
|> Auth.log_in(user)
|> put_rails_flash(:info, "Welcome to asciinema!")
|> redirect(to: "/username/new")
{:error, :token_invalid} ->

@ -1,7 +1,7 @@
defmodule Asciinema.Endpoint do
defmodule AsciinemaWeb.Endpoint do
use Phoenix.Endpoint, otp_app: :asciinema
socket "/socket", Asciinema.UserSocket
socket "/socket", AsciinemaWeb.UserSocket
# Serve at "/" the static files from "priv/static" directory.
#
@ -41,7 +41,7 @@ defmodule Asciinema.Endpoint do
key_digest: :sha,
serializer: Poison
plug Asciinema.TrailingFormat
plug AsciinemaWeb.TrailingFormat
plug Asciinema.Router
plug AsciinemaWeb.Router
end

@ -1,4 +1,4 @@
defmodule Asciinema.Gettext do
defmodule AsciinemaWeb.Gettext do
@moduledoc """
A module providing Internationalization with a gettext-based API.

@ -1,4 +1,4 @@
defmodule Asciinema.Rails.Flash do
defmodule AsciinemaWeb.Rails.Flash do
import Plug.Conn
def put_rails_flash(conn, key, value) do

@ -1,5 +1,5 @@
defmodule Asciinema.Router do
use Asciinema.Web, :router
defmodule AsciinemaWeb.Router do
use AsciinemaWeb, :router
pipeline :browser do
plug :accepts, ["html"]
@ -7,14 +7,14 @@ defmodule Asciinema.Router do
plug :fetch_flash
plug :protect_from_forgery
plug :put_secure_browser_headers
plug Asciinema.Auth
plug AsciinemaWeb.Auth
end
pipeline :asciicast_embed_script do
plug :accepts, ["js"]
end
scope "/", Asciinema do
scope "/", AsciinemaWeb do
pipe_through :asciicast_embed_script
# rewritten by TrailingFormat from /a/123.js to /a/123/js
@ -25,7 +25,7 @@ defmodule Asciinema.Router do
plug :accepts, ["json"]
end
scope "/", Asciinema do
scope "/", AsciinemaWeb do
pipe_through :asciicast_file
# rewritten by TrailingFormat from /a/123.json to /a/123/json
@ -36,7 +36,7 @@ defmodule Asciinema.Router do
plug :accepts, ["png"]
end
scope "/", Asciinema do
scope "/", AsciinemaWeb do
pipe_through :asciicast_image
# rewritten by TrailingFormat from /a/123.png to /a/123/png
@ -47,14 +47,14 @@ defmodule Asciinema.Router do
plug :accepts, ["html"]
end
scope "/", Asciinema do
scope "/", AsciinemaWeb do
pipe_through :asciicast_animation
# rewritten by TrailingFormat from /a/123.gif to /a/123/gif
get "/a/:id/gif", AsciicastAnimationController, :show
end
scope "/", Asciinema do
scope "/", AsciinemaWeb do
pipe_through :browser # Use the default browser stack
get "/a/:id", AsciicastController, :show
@ -71,7 +71,7 @@ defmodule Asciinema.Router do
get "/connect/:api_token", SessionController, :create, as: :connect
end
scope "/api", Asciinema.Api, as: :api do
scope "/api", AsciinemaWeb.Api, as: :api do
post "/asciicasts", AsciicastController, :create
end
@ -81,8 +81,8 @@ defmodule Asciinema.Router do
# end
end
defmodule Asciinema.Router.Helpers.Extra do
alias Asciinema.Router.Helpers, as: H
defmodule AsciinemaWeb.Router.Helpers.Extra do
alias AsciinemaWeb.Router.Helpers, as: H
def user_path(_conn, :edit) do
"/user/edit"

@ -0,0 +1 @@
<%= render @view_module, "wrapper.html", Map.merge(assigns, %{layout: {AsciinemaWeb.LayoutView, "app.html"}, topic_template: @view_template}) %>

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save