Allow head to be modified in settings

This commit is contained in:
Evie Viau-Chow-Stuart 2023-02-05 03:48:23 -08:00
parent af3d8a8e6b
commit 1fdcd72719
Signed by: evie
GPG key ID: 928652CDFCEC8099
13 changed files with 34 additions and 19 deletions

View file

@ -17,10 +17,10 @@ impl MigrationTrait for Migration {
.primary_key(),
)
.col(ColumnDef::new(Page::Draft).boolean().not_null())
.col(ColumnDef::new(Page::Slug).string().not_null().unique_key())
.col(ColumnDef::new(Page::Title).string().not_null())
.col(ColumnDef::new(Page::Slug).text().not_null().unique_key())
.col(ColumnDef::new(Page::Title).text().not_null())
.col(ColumnDef::new(Page::ShowTitle).boolean().not_null())
.col(ColumnDef::new(Page::Description).string())
.col(ColumnDef::new(Page::Description).text())
.col(ColumnDef::new(Page::Published).date_time().not_null())
.col(ColumnDef::new(Page::Updated).date_time())
.to_owned(),

View file

@ -17,9 +17,9 @@ impl MigrationTrait for Migration {
.primary_key(),
)
.col(ColumnDef::new(Post::Draft).boolean().not_null())
.col(ColumnDef::new(Post::Slug).string().not_null().unique_key())
.col(ColumnDef::new(Post::Title).string().not_null())
.col(ColumnDef::new(Post::Summary).string())
.col(ColumnDef::new(Post::Slug).text().not_null().unique_key())
.col(ColumnDef::new(Post::Title).text().not_null())
.col(ColumnDef::new(Post::Summary).text())
.col(ColumnDef::new(Post::Published).date_time().not_null())
.col(ColumnDef::new(Post::Updated).date_time())
.to_owned(),

View file

@ -21,7 +21,7 @@ impl MigrationTrait for Migration {
.col(ColumnDef::new(PostBlock::Owner).string().not_null())
.col(ColumnDef::new(PostBlock::Order).integer().not_null())
.col(ColumnDef::new(PostBlock::Type).string().not_null())
.col(ColumnDef::new(PostBlock::Content).string().not_null())
.col(ColumnDef::new(PostBlock::Content).text().not_null())
.foreign_key(ForeignKey::create()
.name("fk-post_blocks-posts")
.from(PostBlock::Table, PostBlock::Owner)

View file

@ -21,7 +21,7 @@ impl MigrationTrait for Migration {
.col(ColumnDef::new(PageBlock::Owner).string().not_null())
.col(ColumnDef::new(PageBlock::Order).integer().not_null())
.col(ColumnDef::new(PageBlock::Type).string().not_null())
.col(ColumnDef::new(PageBlock::Content).string().not_null())
.col(ColumnDef::new(PageBlock::Content).text().not_null())
.foreign_key(ForeignKey::create()
.name("fk-page_blocks-posts")
.from(PageBlock::Table, PageBlock::Owner)

View file

@ -16,7 +16,7 @@ impl MigrationTrait for Migration {
.not_null()
.primary_key(),
)
.col(ColumnDef::new(Menu::Name).string().not_null())
.col(ColumnDef::new(Menu::Name).text().not_null())
.to_owned(),
)
.await

View file

@ -20,8 +20,8 @@ impl MigrationTrait for Migration {
)
.col(ColumnDef::new(MenuEntry::Owner).string().not_null())
.col(ColumnDef::new(MenuEntry::Order).integer().not_null())
.col(ColumnDef::new(MenuEntry::Text).string().not_null())
.col(ColumnDef::new(MenuEntry::ReferringSlug).string().not_null())
.col(ColumnDef::new(MenuEntry::Text).text().not_null())
.col(ColumnDef::new(MenuEntry::ReferringSlug).text().not_null())
.foreign_key(ForeignKey::create()
.name("fk-menu_entries-menus")
.from(MenuEntry::Table, MenuEntry::Owner)

View file

@ -17,9 +17,10 @@ impl MigrationTrait for Migration {
.not_null()
.primary_key(),
)
.col(ColumnDef::new(Settings::SiteName).string().not_null())
.col(ColumnDef::new(Settings::SiteHeader).string().not_null())
.col(ColumnDef::new(Settings::SiteOwner).string().not_null())
.col(ColumnDef::new(Settings::SiteName).text().not_null())
.col(ColumnDef::new(Settings::SiteHeader).text().not_null())
.col(ColumnDef::new(Settings::SiteOwner).text().not_null())
.col(ColumnDef::new(Settings::SiteAdditionalHead).text())
.to_owned(),
)
.await
@ -40,4 +41,5 @@ enum Settings {
SiteName,
SiteHeader,
SiteOwner,
SiteAdditionalHead
}

View file

@ -8,10 +8,12 @@ pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub id: String,
pub draft: bool,
#[sea_orm(unique)]
#[sea_orm(column_type = "Text", unique)]
pub slug: String,
#[sea_orm(column_type = "Text")]
pub title: String,
pub show_title: bool,
#[sea_orm(column_type = "Text", nullable)]
pub description: Option<String>,
pub published: DateTime,
pub updated: Option<DateTime>,

View file

@ -10,6 +10,7 @@ pub struct Model {
pub owner: String,
pub order: i32,
pub r#type: String,
#[sea_orm(column_type = "Text")]
pub content: String,
}

View file

@ -8,9 +8,11 @@ pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub id: String,
pub draft: bool,
#[sea_orm(unique)]
#[sea_orm(column_type = "Text", unique)]
pub slug: String,
#[sea_orm(column_type = "Text")]
pub title: String,
#[sea_orm(column_type = "Text", nullable)]
pub summary: Option<String>,
pub published: DateTime,
pub updated: Option<DateTime>,

View file

@ -10,6 +10,7 @@ pub struct Model {
pub owner: String,
pub order: i32,
pub r#type: String,
#[sea_orm(column_type = "Text")]
pub content: String,
}

View file

@ -7,9 +7,14 @@ use sea_orm::entity::prelude::*;
pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub id: String,
#[sea_orm(column_type = "Text")]
pub site_name: String,
#[sea_orm(column_type = "Text")]
pub site_header: String,
#[sea_orm(column_type = "Text")]
pub site_owner: String,
#[sea_orm(column_type = "Text", nullable)]
pub site_additional_head: Option<String>,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]

View file

@ -5,9 +5,11 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>{{ settings.site_name }} - {% block title %}{{ title }}{% endblock %}</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="/static/css/sakura-pink.css" media="screen" type="text/css">
<link rel="stylesheet" href="/static/css/sakura-vader.css" media="screen and (prefers-color-scheme: dark)" type="text/css">
<link rel="stylesheet" href="/static/css/meow.css" type="text/css">
{% match settings.site_additional_head %}
{% when Some with (site_additional_head) %}
{{ site_additional_head|safe }}
{% when Nome %}
{% endmatch %}
</head>
<body>
<h1>{{ settings.site_header }}</h1>