Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
5 changes: 5 additions & 0 deletions Resources/Views/Admin/Form/event_form.leaf
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@
<label class="form-check-label" for="showSchedule">Show schedule?</label>
</div>

<div class="form-check form-switch">
<input type="checkbox" class="form-check-input" id="cfpClosed" name="cfpClosed" #if(event):#if(event.cfpClosed):checked#endif#endif>
<label class="form-check-label" for="cfpClosed">CFP closed?</label>
</div>

<div class="form-check form-switch">
<input type="checkbox" class="form-check-input" id="isCurrent" name="isCurrent" #if(event.isCurrent):checked disabled#endif>
<label class="form-check-label" for="isCurrent">Is current event?</label>
Expand Down
5 changes: 4 additions & 1 deletion Resources/Views/Home/home.leaf
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 2 additions & 0 deletions Sources/App/Context/HomeContext.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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? {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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)
Expand Down Expand Up @@ -107,6 +109,7 @@ struct EventRouteController: RouteCollection {
let location: String
let isCurrent: Bool?
let showSchedule: Bool?
let cfpClosed: Bool?
let checkinKey: String?
}
}
6 changes: 5 additions & 1 deletion Sources/App/Features/Events/Models/Event.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -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()
}
}
1 change: 1 addition & 0 deletions Sources/App/Migrations.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down