Add navigation settings, fix page generation
This commit is contained in:
@ -7,7 +7,7 @@ final class Settings: ObservableObject {
|
||||
|
||||
/// The items to show in the navigation bar
|
||||
@Published
|
||||
var navigationItems: [Item]
|
||||
var navigation: NavigationSettings
|
||||
|
||||
@Published
|
||||
var posts: PostSettings
|
||||
@ -21,9 +21,9 @@ final class Settings: ObservableObject {
|
||||
@Published
|
||||
var english: LocalizedPostSettings
|
||||
|
||||
init(paths: PathSettings, navigationItems: [Item], posts: PostSettings, pages: PageSettings, german: LocalizedPostSettings, english: LocalizedPostSettings) {
|
||||
init(paths: PathSettings, navigation: NavigationSettings, posts: PostSettings, pages: PageSettings, german: LocalizedPostSettings, english: LocalizedPostSettings) {
|
||||
self.paths = paths
|
||||
self.navigationItems = navigationItems
|
||||
self.navigation = navigation
|
||||
self.posts = posts
|
||||
self.pages = pages
|
||||
self.german = german
|
||||
@ -36,4 +36,48 @@ final class Settings: ObservableObject {
|
||||
case .german: return german
|
||||
}
|
||||
}
|
||||
|
||||
init(file: SettingsFile,
|
||||
tags: [String : Tag],
|
||||
pages: [String : Page],
|
||||
files: [String : FileResource],
|
||||
posts: [String : Post],
|
||||
tagOverview: TagOverviewPage?) {
|
||||
|
||||
self.navigation = NavigationSettings(
|
||||
file: file.navigation,
|
||||
tags: tags,
|
||||
pages: pages,
|
||||
files: files,
|
||||
posts: posts,
|
||||
tagOverview: tagOverview)
|
||||
|
||||
self.posts = PostSettings(file: file.posts, files: files)
|
||||
self.pages = PageSettings(file: file.pages, files: files)
|
||||
self.paths = PathSettings(file: file.paths)
|
||||
|
||||
self.german = .init(file: file.german)
|
||||
self.english = .init(file: file.english)
|
||||
}
|
||||
|
||||
var file: SettingsFile {
|
||||
.init(
|
||||
paths: paths.file,
|
||||
navigation: navigation.file,
|
||||
posts: posts.file,
|
||||
pages: pages.file,
|
||||
german: german.file,
|
||||
english: english.file)
|
||||
}
|
||||
}
|
||||
|
||||
extension Settings {
|
||||
|
||||
static let `default`: Settings = .init(
|
||||
paths: .default,
|
||||
navigation: .default,
|
||||
posts: .default,
|
||||
pages: .default,
|
||||
german: .german,
|
||||
english: .english)
|
||||
}
|
||||
|
Reference in New Issue
Block a user