diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4830301f..823eb837 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -82,8 +82,8 @@ jobs: tags: europe-west1-docker.pkg.dev/swiftleeds-website/swiftleeds-web/web:${{ github.head_ref || github.ref_name }}-latest deploy: - if: github.repository_owner == 'SwiftLeeds' runs-on: ubuntu-latest + if: github.repository_owner == 'SwiftLeeds' needs: build strategy: diff --git a/Resources/Views/Admin/Form/event_form.leaf b/Resources/Views/Admin/Form/event_form.leaf index ffac12fb..92794d7b 100644 --- a/Resources/Views/Admin/Form/event_form.leaf +++ b/Resources/Views/Admin/Form/event_form.leaf @@ -34,6 +34,11 @@ +
+ + +
+
diff --git a/Resources/Views/Home/home.leaf b/Resources/Views/Home/home.leaf index 71425b1d..42aa2669 100644 --- a/Resources/Views/Home/home.leaf +++ b/Resources/Views/Home/home.leaf @@ -25,7 +25,10 @@ #if(count(speakers) > 0): #extend("Home/_speakers") #else: - #extend("Home/_cfp") + #if(event.cfpClosed): + #else: + #extend("Home/_cfp") + #endif #endif #if(event.year == 2024): diff --git a/Sources/App/Context/HomeContext.swift b/Sources/App/Context/HomeContext.swift index abed4701..e096a66d 100644 --- a/Sources/App/Context/HomeContext.swift +++ b/Sources/App/Context/HomeContext.swift @@ -37,6 +37,7 @@ struct EventContext: Codable { let isFuture: Bool let isPast: Bool let isHidden: Bool + let cfpClosed: Bool init(event: Event) { name = event.name @@ -59,6 +60,7 @@ struct EventContext: Codable { isFuture = event.date > Date() && !isKnownDate isPast = event.date <= Date() && isKnownDate isHidden = isKnownDate != true + cfpClosed = event.cfpClosed } private static func buildConferenceDateString(for event: Event) -> String? { diff --git a/Sources/App/Features/Events/Controllers/EventRouteController.swift b/Sources/App/Features/Events/Controllers/EventRouteController.swift index 80017134..3628dd55 100644 --- a/Sources/App/Features/Events/Controllers/EventRouteController.swift +++ b/Sources/App/Features/Events/Controllers/EventRouteController.swift @@ -59,6 +59,7 @@ struct EventRouteController: RouteCollection { event.location = input.location event.isCurrent = isCurrent event.showSchedule = input.showSchedule ?? false + event.cfpClosed = input.cfpClosed ?? false event.checkinKey = input.checkinKey ?? event.checkinKey event.conference = request.application.conference.rawValue @@ -75,6 +76,7 @@ struct EventRouteController: RouteCollection { ) event.conference = request.application.conference.rawValue + event.cfpClosed = input.cfpClosed ?? false eventID = try event.requireID() try await event.create(on: request.db) @@ -107,6 +109,7 @@ struct EventRouteController: RouteCollection { let location: String let isCurrent: Bool? let showSchedule: Bool? + let cfpClosed: Bool? let checkinKey: String? } } diff --git a/Sources/App/Features/Events/Models/Event.swift b/Sources/App/Features/Events/Models/Event.swift index 4c6a65d5..e50c3e59 100644 --- a/Sources/App/Features/Events/Models/Event.swift +++ b/Sources/App/Features/Events/Models/Event.swift @@ -37,17 +37,21 @@ final class Event: Model, Content, @unchecked Sendable { @Field(key: "conference") var conference: String + @Field(key: "cfp_closed") + var cfpClosed: Bool + @Children(for: \.$event) var days: [EventDay] init() {} - init(id: IDValue?, name: String, date: Date, location: String, isCurrent: Bool) { + init(id: IDValue?, name: String, date: Date, location: String, isCurrent: Bool, cfpClosed: Bool = true) { self.id = id self.name = name self.date = date self.location = location self.isCurrent = isCurrent + self.cfpClosed = cfpClosed } } diff --git a/Sources/App/Features/Events/Models/Migrations/Event+Migration+V7.swift b/Sources/App/Features/Events/Models/Migrations/Event+Migration+V7.swift new file mode 100644 index 00000000..d9fa9e89 --- /dev/null +++ b/Sources/App/Features/Events/Models/Migrations/Event+Migration+V7.swift @@ -0,0 +1,15 @@ +import Fluent + +final class EventMigrationV7: AsyncMigration { + func prepare(on database: any Database) async throws { + try await database.schema(Schema.event) + .field("cfp_closed", .bool, .sql(.default(true)), .required) + .update() + } + + func revert(on database: any Database) async throws { + try await database.schema(Schema.event) + .deleteField("cfp_closed") + .update() + } +} diff --git a/Sources/App/Migrations.swift b/Sources/App/Migrations.swift index 035c33c2..b4309569 100644 --- a/Sources/App/Migrations.swift +++ b/Sources/App/Migrations.swift @@ -87,6 +87,7 @@ class Migrations { app.migrations.add(EventMigrationV5()) // Add `checkin_key` to event app.migrations.add(UserMigrationV2()) // Add `permissions` to user app.migrations.add(EventMigrationV6()) // Add `conference` to event ("swiftleeds" - default, or "kotlinleeds") + app.migrations.add(EventMigrationV7()) // Add `cfp_closed` to event do { guard let url = Environment.get("DATABASE_URL") else {