From dbfdd22ea9a1b010bc8afee46c8235ee5006804e Mon Sep 17 00:00:00 2001 From: "byte[]" Date: Sat, 5 Sep 2020 17:46:02 -0400 Subject: [PATCH] default to centered (can still be set to left if desired) --- lib/philomena_web/views/layout_view.ex | 4 ++-- priv/repo/migrations/20200905214139_default_centered.exs | 9 +++++++++ priv/repo/structure.sql | 5 +++-- 3 files changed, 14 insertions(+), 4 deletions(-) create mode 100644 priv/repo/migrations/20200905214139_default_centered.exs diff --git a/lib/philomena_web/views/layout_view.ex b/lib/philomena_web/views/layout_view.ex index 17e5b560..0e91f332 100644 --- a/lib/philomena_web/views/layout_view.ex +++ b/lib/philomena_web/views/layout_view.ex @@ -9,8 +9,8 @@ defmodule PhilomenaWeb.LayoutView do conn.assigns[:layout_class] || "layout--narrow" end - def container_class(%{use_centered_layout: true}), do: "layout--center-aligned" - def container_class(_user), do: nil + def container_class(%{use_centered_layout: false}), do: nil + def container_class(_user), do: "layout--center-aligned" def render_time(conn) do (Time.diff(Time.utc_now(), conn.assigns[:start_time], :microsecond) / 1000.0) diff --git a/priv/repo/migrations/20200905214139_default_centered.exs b/priv/repo/migrations/20200905214139_default_centered.exs new file mode 100644 index 00000000..035712aa --- /dev/null +++ b/priv/repo/migrations/20200905214139_default_centered.exs @@ -0,0 +1,9 @@ +defmodule Philomena.Repo.Migrations.DefaultCentered do + use Ecto.Migration + + def change do + alter table(:users) do + modify :use_centered_layout, :boolean, from: :boolean, default: true + end + end +end diff --git a/priv/repo/structure.sql b/priv/repo/structure.sql index c18baf56..12411de1 100644 --- a/priv/repo/structure.sql +++ b/priv/repo/structure.sql @@ -3,7 +3,7 @@ -- -- Dumped from database version 12.3 (Debian 12.3-1.pgdg100+1) --- Dumped by pg_dump version 12.3 (Debian 12.3-1.pgdg90+1) +-- Dumped by pg_dump version 12.4 (Debian 12.4-1.pgdg90+1) SET statement_timeout = 0; SET lock_timeout = 0; @@ -1959,7 +1959,7 @@ CREATE TABLE public.users ( images_favourited_count integer DEFAULT 0 NOT NULL, last_donation_at timestamp without time zone, scratchpad text, - use_centered_layout boolean DEFAULT false NOT NULL, + use_centered_layout boolean DEFAULT true NOT NULL, secondary_role character varying, hide_default_role boolean DEFAULT false NOT NULL, personal_title character varying, @@ -4796,3 +4796,4 @@ INSERT INTO public."schema_migrations" (version) VALUES (20200617113333); INSERT INTO public."schema_migrations" (version) VALUES (20200706171350); INSERT INTO public."schema_migrations" (version) VALUES (20200725234412); INSERT INTO public."schema_migrations" (version) VALUES (20200817213256); +INSERT INTO public."schema_migrations" (version) VALUES (20200905214139);