diff --git a/server/templates/account.rs.html b/server/templates/account.rs.html index 431ef7f..833e22e 100644 --- a/server/templates/account.rs.html +++ b/server/templates/account.rs.html @@ -5,14 +5,14 @@ @(user: &User, uname_state: &UpdateUsernameState, pass_state: &UpdatePasswordState) @:layout(&format!("Account Settings for {}", user.username()), "Update account information", {}, { - @:update_username(Card::new().full_width().classes(&["account-page"]), uname_state) - @:update_password(Card::new().full_width().classes(&["account-page"]), pass_state) - @:card(Card::new().full_width().classes(&["account-page"]), { Danger }, { + @:update_username(Card::full_width().classes(&["account-page"]), uname_state) + @:update_password(Card::full_width().classes(&["account-page"]), pass_state) + @:card(Card::full_width().classes(&["account-page"]), { Danger }, { @:card_body({ @:button(Button::primary("Delete Account").href("/session/account/delete")) }) }) - @:card(Card::new().full_width().classes(&["account-page"]), { Nav }, { + @:card(Card::full_width().classes(&["account-page"]), { Nav }, { @:card_body({ @:link(&Link::current_tab("/"), { Return Home }) }) diff --git a/server/templates/cookies.rs.html b/server/templates/cookies.rs.html index 173af67..3d7187d 100644 --- a/server/templates/cookies.rs.html +++ b/server/templates/cookies.rs.html @@ -5,6 +5,6 @@ @(cookie_state: &CookiesState) @:layout("Accept Cookies", "Review the cookie policy", {}, { - @:cookies(Card::new().full_width(), cookie_state) + @:cookies(&Card::full_width(), cookie_state) }) diff --git a/server/templates/delete_account.rs.html b/server/templates/delete_account.rs.html index 5720590..4dd530e 100644 --- a/server/templates/delete_account.rs.html +++ b/server/templates/delete_account.rs.html @@ -5,5 +5,5 @@ @(state: &DeleteUserState) @:layout("Delete Account", "Are you sure you want to delete your account?", {}, { - @:delete_user(Card::new().full_width(), state) + @:delete_user(&Card::full_width(), state) }) diff --git a/server/templates/error.rs.html b/server/templates/error.rs.html index 4e24b31..e9de84c 100644 --- a/server/templates/error.rs.html +++ b/server/templates/error.rs.html @@ -4,7 +4,7 @@ @(error: String) @:layout("Error", "There was an error processing your request", {}, { - @:card(&Card::new().full_width(), { + @:card(&Card::full_width(), { There was an error processing your request }, { @:card_body({ @error }) diff --git a/server/templates/index.rs.html b/server/templates/index.rs.html index ebf035f..b45ca31 100644 --- a/server/templates/index.rs.html +++ b/server/templates/index.rs.html @@ -6,7 +6,7 @@ @:layout("Hyaenidae", "A simple website", {}, { @if let Some((user, logout_state)) = logout_opt { - @:card(Card::new().full_width(), { Welcome, @user.username() }, { + @:card(&Card::full_width(), { Welcome, @user.username() }, { @:card_body({ @:link(&Link::current_tab("/session/account"), { Account Settings }) }) @@ -17,7 +17,7 @@ }) }) } else { - @:card(Card::new().full_width(), { Home... }, { + @:card(&Card::full_width(), { Home... }, { @:card_body({ @:button(&Button::primary_outline("Login").href("/session/auth/login")) }) diff --git a/server/templates/login.rs.html b/server/templates/login.rs.html index 77719b3..749b398 100644 --- a/server/templates/login.rs.html +++ b/server/templates/login.rs.html @@ -5,5 +5,5 @@ @(login_state: &LoginState) @:layout("Login", "Log into Hyaenidae", {}, { - @:login(Card::new().full_width(), login_state) + @:login(&Card::full_width(), login_state) }) diff --git a/server/templates/not_found.rs.html b/server/templates/not_found.rs.html index 98ab51a..281b953 100644 --- a/server/templates/not_found.rs.html +++ b/server/templates/not_found.rs.html @@ -4,7 +4,7 @@ @() @:layout("404", "Not Found", {}, { - @:card(&Card::new().full_width(), { We couldn't find that }, { + @:card(&Card::full_width(), { We couldn't find that }, { @:card_body({ @:link(&Link::current_tab("/"), { Return Home }) }) diff --git a/server/templates/register.rs.html b/server/templates/register.rs.html index 91ea71b..43c1a59 100644 --- a/server/templates/register.rs.html +++ b/server/templates/register.rs.html @@ -5,5 +5,5 @@ @(register_state: &RegisterState) @:layout("Register", "Register for Hyaenidae", {}, { - @:register(Card::new().full_width(), register_state) + @:register(&Card::full_width(), register_state) }) diff --git a/toolkit-examples/templates/demo.rs.html b/toolkit-examples/templates/demo.rs.html index 1ef9add..a141e03 100644 --- a/toolkit-examples/templates/demo.rs.html +++ b/toolkit-examples/templates/demo.rs.html @@ -4,7 +4,7 @@
  • @:centered(false, { - @:card(Card::new().full_width(), { + @:card(&Card::full_width(), {

    @title

    }, { @:card_body({ diff --git a/toolkit-examples/templates/index.rs.html b/toolkit-examples/templates/index.rs.html index 796fa33..1e551c3 100644 --- a/toolkit-examples/templates/index.rs.html +++ b/toolkit-examples/templates/index.rs.html @@ -168,7 +168,7 @@ }) }) @:demo("Card", "Create a full-width card with a Title and Body. This card loses its border radius and left & right borders when the viewport width is under 700px", &[ - "@:card(Card::new().full_width(), {", + "@:card(&Card::full_width(), {", "
    ", "

    Title

    ", "
    ", @@ -180,7 +180,7 @@ " })", "})", ], { - @:card(Card::new().full_width(), { + @:card(&Card::full_width(), {

    Title

    diff --git a/toolkit/src/card.rs b/toolkit/src/card.rs index efac00f..2925661 100644 --- a/toolkit/src/card.rs +++ b/toolkit/src/card.rs @@ -9,9 +9,11 @@ impl Card { Default::default() } - pub fn full_width(&mut self) -> &mut Self { - self.full_width = true; - self + pub fn full_width() -> Self { + Card { + full_width: true, + ..Default::default() + } } pub fn centered(&mut self) -> &mut Self {