default to centered (can still be set to left if desired)

This commit is contained in:
byte[] 2020-09-05 17:46:02 -04:00
parent fefd73f3bd
commit dbfdd22ea9
3 changed files with 14 additions and 4 deletions

View file

@ -9,8 +9,8 @@ defmodule PhilomenaWeb.LayoutView do
conn.assigns[:layout_class] || "layout--narrow" conn.assigns[:layout_class] || "layout--narrow"
end end
def container_class(%{use_centered_layout: true}), do: "layout--center-aligned" def container_class(%{use_centered_layout: false}), do: nil
def container_class(_user), do: nil def container_class(_user), do: "layout--center-aligned"
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)

View file

@ -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

View file

@ -3,7 +3,7 @@
-- --
-- Dumped from database version 12.3 (Debian 12.3-1.pgdg100+1) -- 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 statement_timeout = 0;
SET lock_timeout = 0; SET lock_timeout = 0;
@ -1959,7 +1959,7 @@ CREATE TABLE public.users (
images_favourited_count integer DEFAULT 0 NOT NULL, images_favourited_count integer DEFAULT 0 NOT NULL,
last_donation_at timestamp without time zone, last_donation_at timestamp without time zone,
scratchpad text, scratchpad text,
use_centered_layout boolean DEFAULT false NOT NULL, use_centered_layout boolean DEFAULT true NOT NULL,
secondary_role character varying, secondary_role character varying,
hide_default_role boolean DEFAULT false NOT NULL, hide_default_role boolean DEFAULT false NOT NULL,
personal_title character varying, 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 (20200706171350);
INSERT INTO public."schema_migrations" (version) VALUES (20200725234412); INSERT INTO public."schema_migrations" (version) VALUES (20200725234412);
INSERT INTO public."schema_migrations" (version) VALUES (20200817213256); INSERT INTO public."schema_migrations" (version) VALUES (20200817213256);
INSERT INTO public."schema_migrations" (version) VALUES (20200905214139);