Individual tweets are now viewable in their own pages
This commit is contained in:
@@ -6,6 +6,14 @@ defmodule MixerWeb.PageController do
|
||||
end
|
||||
|
||||
def index(conn, _params) do
|
||||
render_spa(conn, nil)
|
||||
end
|
||||
|
||||
def show(conn, %{"tweet_id" => tweet_id}) do
|
||||
render_spa(conn, tweet_id)
|
||||
end
|
||||
|
||||
defp render_spa(conn, tweet_id) do
|
||||
asset_host = Application.get_env(:waffle, :asset_host, "http://localhost:3900")
|
||||
bucket = Application.get_env(:waffle, :bucket, "mixer-bucket")
|
||||
|
||||
@@ -13,7 +21,8 @@ defmodule MixerWeb.PageController do
|
||||
|> put_root_layout(html: {MixerWeb.Layouts, :spa_root})
|
||||
|> render(:index,
|
||||
current_user: conn.assigns[:current_user],
|
||||
media_host: "#{asset_host}/#{bucket}"
|
||||
media_host: "#{asset_host}/#{bucket}",
|
||||
tweet_id: tweet_id
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<div id="app"
|
||||
data-current-user-id={if @current_user, do: @current_user.id, else: ""}
|
||||
data-current-user-email={if @current_user, do: @current_user.email, else: ""}
|
||||
data-asset-host={@media_host}>
|
||||
data-asset-host={@media_host}
|
||||
data-tweet-id={@tweet_id || ""}>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user