add appropriate layout classes

This commit is contained in:
byte[] 2019-11-17 17:51:14 -05:00
parent 5c4b19edff
commit 8619726d9e
10 changed files with 20 additions and 16 deletions

View file

@ -132,7 +132,8 @@ defmodule PhilomenaWeb.ActivityController do
featured_image: featured_image, featured_image: featured_image,
streams: streams, streams: streams,
topics: topics, topics: topics,
interactions: interactions interactions: interactions,
layout_class: "layout--wide"
) )
end end
end end

View file

@ -28,7 +28,7 @@ defmodule PhilomenaWeb.CommentController do
comments = comments =
%{comments | entries: Enum.zip(comments.entries, rendered)} %{comments | entries: Enum.zip(comments.entries, rendered)}
render(conn, "index.html", comments: comments) render(conn, "index.html", comments: comments, layout_class: "layout--wide")
end end
defp parse_search(conn, %{"comment" => comment_params}) do defp parse_search(conn, %{"comment" => comment_params}) do

View file

@ -25,7 +25,7 @@ defmodule PhilomenaWeb.ImageController do
interactions = interactions =
Interactions.user_interactions(images, conn.assigns.current_user) Interactions.user_interactions(images, conn.assigns.current_user)
render(conn, "index.html", images: images, interactions: interactions) render(conn, "index.html", layout_class: "layout--wide", images: images, interactions: interactions)
end end
def show(conn, %{"id" => _id}) do def show(conn, %{"id" => _id}) do
@ -68,7 +68,8 @@ defmodule PhilomenaWeb.ImageController do
comment_changeset: comment_changeset, comment_changeset: comment_changeset,
description: description, description: description,
interactions: interactions, interactions: interactions,
watching: watching watching: watching,
layout_class: "layout--wide"
) )
end end
end end

View file

@ -38,7 +38,7 @@ defmodule PhilomenaWeb.PostController do
forums = [{"-", ""} | forums] forums = [{"-", ""} | forums]
render(conn, "index.html", posts: posts, forums: forums) render(conn, "index.html", posts: posts, forums: forums, layout_class: "layout--wide")
end end
defp parse_search(conn, %{"post" => post_params}) do defp parse_search(conn, %{"post" => post_params}) do

View file

@ -25,7 +25,7 @@ defmodule PhilomenaWeb.SearchController do
Interactions.user_interactions(images, user) Interactions.user_interactions(images, user)
conn conn
|> render("index.html", images: images, search_query: params["q"], interactions: interactions) |> render("index.html", images: images, search_query: params["q"], interactions: interactions, layout_class: "layout--wide")
else else
{:error, msg} -> {:error, msg} ->
conn conn

View file

@ -41,6 +41,6 @@ defmodule PhilomenaWeb.TagController do
Image |> preload([:tags, :user]) Image |> preload([:tags, :user])
) )
render(conn, "show.html", tag: tag, images: images) render(conn, "show.html", tag: tag, images: images, layout_class: "layout--wide")
end end
end end

View file

@ -23,12 +23,9 @@ header.header
.flex.flex--centered.flex--no-wrap.header__force-right .flex.flex--centered.flex--no-wrap.header__force-right
= if @current_user do = if @current_user do
- notification_count = @conn.assigns.notification_count
- conversation_count = @conn.assigns.conversation_count
a.header__link href="/notifications" title="Notifications" a.header__link href="/notifications" title="Notifications"
i.fa-embedded--notification> i.fa-embedded--notification>
span.js-notification-ticker.fa__text.header__counter data-notification-count=notification_count = notification_count span.js-notification-ticker.fa__text.header__counter data-notification-count=@notification_count = @notification_count
a.header__link href="/conversations" title="Conversations" a.header__link href="/conversations" title="Conversations"
= if @conversation_count > 0 do = if @conversation_count > 0 do
@ -44,11 +41,11 @@ header.header
i.fa.fa-filter i.fa.fa-filter
span.hide-limited-desktop< Filters span.hide-limited-desktop< Filters
= form_for @conn.assigns.user_changeset, Routes.filter_current_path(@conn, :update), [class: "header__filter-form", id: "filter-quick-form"], fn f -> = form_for @user_changeset, Routes.filter_current_path(@conn, :update), [class: "header__filter-form", id: "filter-quick-form"], fn f ->
= select f, :current_filter_id, @conn.assigns.available_filters, name: "id", id: "filter-quick-menu", class: "input header__input", data: [change_submit: "#filter-quick-form"], autocomplete: "off" = select f, :current_filter_id, @available_filters, name: "id", id: "filter-quick-menu", class: "input header__input", data: [change_submit: "#filter-quick-form"], autocomplete: "off"
= form_for @conn.assigns.user_changeset, Routes.filter_spoiler_type_path(@conn, :update), [class: "header__filter-form hide-mobile hide-limited-desktop", id: "spoiler-quick-form"], fn f -> = form_for @user_changeset, Routes.filter_spoiler_type_path(@conn, :update), [class: "header__filter-form hide-mobile hide-limited-desktop", id: "spoiler-quick-form"], fn f ->
= select f, :spoiler_type, @conn.assigns.spoiler_types, id: "spoiler-quick-menu", class: "input header__input", data: [change_submit: "#spoiler-quick-form"], autocomplete: "off" = select f, :spoiler_type, @spoiler_types, id: "spoiler-quick-menu", class: "input header__input", data: [change_submit: "#spoiler-quick-form"], autocomplete: "off"
.dropdown.header__dropdown .dropdown.header__dropdown
a.header__link.header__link-user href="/" a.header__link.header__link-user href="/"

View file

@ -24,7 +24,7 @@ html lang="en"
#container #container
= render PhilomenaWeb.LayoutView, "_header.html", assigns = render PhilomenaWeb.LayoutView, "_header.html", assigns
= render PhilomenaWeb.LayoutView, "_flash_warnings.html", assigns = render PhilomenaWeb.LayoutView, "_flash_warnings.html", assigns
main#content class="layout--wide" main#content class=layout_class(@conn)
= render @view_module, @view_template, assigns = render @view_module, @view_template, assigns
= render PhilomenaWeb.LayoutView, "_footer.html", assigns = render PhilomenaWeb.LayoutView, "_footer.html", assigns
= clientside_data(@conn) = clientside_data(@conn)

View file

@ -8,5 +8,6 @@ h1 Notification Area
= for notification <- @notifications do = for notification <- @notifications do
= render PhilomenaWeb.NotificationView, "_notification.html", notification: notification, conn: @conn = render PhilomenaWeb.NotificationView, "_notification.html", notification: notification, conn: @conn
br
p To get notifications on new comments and forum posts, click the 'Subscribe' button in the bar at the top of an image or forum topic. You'll get notifications here for any new posts or comments. p To get notifications on new comments and forum posts, click the 'Subscribe' button in the bar at the top of an image or forum topic. You'll get notifications here for any new posts or comments.
p By default you'll be subscribed to any images or topics you reply to. You can configure this in your user settings page. p By default you'll be subscribed to any images or topics you reply to. You can configure this in your user settings page.

View file

@ -1,6 +1,10 @@
defmodule PhilomenaWeb.LayoutView do defmodule PhilomenaWeb.LayoutView do
use PhilomenaWeb, :view use PhilomenaWeb, :view
def layout_class(conn) do
conn.assigns[:layout_class] || "layout--narrow"
end
def render_time(conn) do def render_time(conn) do
(Time.diff(Time.utc_now(), conn.assigns[:start_time], :microsecond) / 1000.0) (Time.diff(Time.utc_now(), conn.assigns[:start_time], :microsecond) / 1000.0)
|> Float.round(3) |> Float.round(3)