Import old content, load from disk
This commit is contained in:
@ -6,13 +6,32 @@ extension Page {
|
||||
.init(
|
||||
id: "my-id",
|
||||
isDraft: true,
|
||||
metadata: [
|
||||
.init(language: .english, headline: "Title"),
|
||||
.init(language: .german, headline: "Titel")
|
||||
],
|
||||
externalFiles: [],
|
||||
requiredFiles: [],
|
||||
images: [])
|
||||
createdDate: Date(),
|
||||
startDate: Date().addingTimeInterval(-86400),
|
||||
endDate: nil,
|
||||
german: .german,
|
||||
english: .english,
|
||||
tags: [.mock])
|
||||
}
|
||||
}
|
||||
|
||||
extension LocalizedPage {
|
||||
|
||||
static let english = LocalizedPage(
|
||||
urlString: "my-project",
|
||||
title: "My First Project",
|
||||
lastModified: nil,
|
||||
originalUrl: "projects/electronics/my-first-project/en.html",
|
||||
files: [],
|
||||
externalFiles: [],
|
||||
requiredFiles: [])
|
||||
|
||||
static let german = LocalizedPage(
|
||||
urlString: "mein-projekt",
|
||||
title: "Mein Erstes Projekt",
|
||||
lastModified: nil,
|
||||
originalUrl: "projects/electronics/my-first-project/de.html",
|
||||
files: [],
|
||||
externalFiles: [],
|
||||
requiredFiles: [])
|
||||
}
|
||||
|
@ -2,52 +2,46 @@
|
||||
extension Post {
|
||||
|
||||
static var empty: Post {
|
||||
.init(id: 0,
|
||||
.init(id: "empty",
|
||||
isDraft: true,
|
||||
createdDate: .now,
|
||||
startDate: .now,
|
||||
title: .init(en: "The title", de: "Der Titel"),
|
||||
text: .init(en: "", de: ""),
|
||||
endDate: nil,
|
||||
tags: [],
|
||||
images: [])
|
||||
german: .init(content: "Text"),
|
||||
english: .init(content: "Text"),
|
||||
linkedPage: nil)
|
||||
}
|
||||
|
||||
static var mock: Post {
|
||||
Post(
|
||||
id: 1,
|
||||
id: "mock",
|
||||
isDraft: false,
|
||||
createdDate: .now,
|
||||
startDate: .now,
|
||||
endDate: nil,
|
||||
title: .init(en: "The title", de: "Der Titel"),
|
||||
text: .init(
|
||||
en: "Very nice and solitary hike from Oberau to Krottenkopf. Challenging and rewarding, due to the length and height.",
|
||||
de: "Sehr schöne und einsame Tour von Oberau zum Krottenkopf. Abwechslungsreich und stellenweise fordernd, aufgrund der Länge und der Höhenmeter auch anstrengend."
|
||||
),
|
||||
tags: [
|
||||
Tag(en: "Nature", de: "Natur"),
|
||||
Tag(en: "Sports", de: "Sport"),
|
||||
Tag(en: "Hiking", de: "Wandern")
|
||||
],
|
||||
images: []
|
||||
tags: [.nature, .sports, .hiking],
|
||||
german: .init(title: "Der Titel", content: "Sehr schöne und einsame Tour von Oberau zum Krottenkopf. Abwechslungsreich und stellenweise fordernd, aufgrund der Länge und der Höhenmeter auch anstrengend."),
|
||||
english: .init(title: "The title", content: "Very nice and solitary hike from Oberau to Krottenkopf. Challenging and rewarding, due to the length and height")
|
||||
)
|
||||
}
|
||||
|
||||
static var fullMock: Post {
|
||||
.init(
|
||||
id: 2,
|
||||
id: "full",
|
||||
isDraft: true,
|
||||
createdDate: .now,
|
||||
startDate: .now.addingTimeInterval(-86400), endDate: .now,
|
||||
title: .init(en: "A longer title", de: "Ein langer Titel"),
|
||||
text: .init(
|
||||
en: "Very nice and solitary hike from Oberau to Krottenkopf. Challenging and rewarding, due to the length and height.",
|
||||
de: "Sehr schöne und einsame Tour von Oberau zum Krottenkopf. Abwechslungsreich und stellenweise fordernd, aufgrund der Länge und der Höhenmeter auch anstrengend."
|
||||
),
|
||||
tags: [
|
||||
Tag(en: "Nature", de: "Natur"),
|
||||
Tag(en: "Sports", de: "Sport"),
|
||||
Tag(en: "Hiking", de: "Wandern"),
|
||||
Tag(en: "Mountains", de: "Berge")
|
||||
],
|
||||
images: MockImage.images
|
||||
tags: [.nature, .sports, .hiking, .mountains],
|
||||
german: .init(
|
||||
title: "Ein langer Titel",
|
||||
content: "Sehr schöne und einsame Tour von Oberau zum Krottenkopf. Abwechslungsreich und stellenweise fordernd, aufgrund der Länge und der Höhenmeter auch anstrengend.",
|
||||
images: MockImage.images),
|
||||
english: .init(
|
||||
title: "A longer title",
|
||||
content: "Very nice and solitary hike from Oberau to Krottenkopf. Challenging and rewarding, due to the length and height.",
|
||||
images: MockImage.images)
|
||||
|
||||
)
|
||||
}
|
||||
}
|
||||
|
47
CHDataManagement/Preview Content/Tag+Mock.swift
Normal file
47
CHDataManagement/Preview Content/Tag+Mock.swift
Normal file
@ -0,0 +1,47 @@
|
||||
import Foundation
|
||||
|
||||
extension Tag {
|
||||
|
||||
static let mock = Tag(
|
||||
german: .german,
|
||||
english: .english)
|
||||
|
||||
static let nature = Tag(
|
||||
german: .init(urlComponent: "natur", name: "Natur"),
|
||||
english: .init(urlComponent: "nature", name: "Nature")
|
||||
)
|
||||
|
||||
static let sports = Tag(
|
||||
german: .init(urlComponent: "sport", name: "Sport"),
|
||||
english: .init(urlComponent: "sports", name: "Sports")
|
||||
)
|
||||
|
||||
static let hiking = Tag(
|
||||
german: .init(urlComponent: "wandern", name: "Wandern"),
|
||||
english: .init(urlComponent: "hiking", name: "Hiking")
|
||||
)
|
||||
|
||||
static let mountains = Tag(
|
||||
german: .init(urlComponent: "berge", name: "Berge"),
|
||||
english: .init(urlComponent: "mountains", name: "Mountains")
|
||||
)
|
||||
}
|
||||
|
||||
extension LocalizedTag {
|
||||
|
||||
static let english = LocalizedTag(
|
||||
urlComponent: "electronics",
|
||||
name: "Electronics",
|
||||
subtitle: "Projects with electronics",
|
||||
description: "Some description of the tag",
|
||||
thumbnail: "electronic-thumbnail.jpg",
|
||||
originalUrl: "projects/electronics")
|
||||
|
||||
static let german = LocalizedTag(
|
||||
urlComponent: "elektronik",
|
||||
name: "Elektronik",
|
||||
subtitle: "Projekte mit Elektronik",
|
||||
description: "Eine Beschreibung des Tags",
|
||||
thumbnail: "electronic-thumbnail.jpg",
|
||||
originalUrl: "projects/electronics")
|
||||
}
|
Reference in New Issue
Block a user