feat: Begins vendor views, working form, and table. Styles need some updates.
This commit is contained in:
@@ -2,7 +2,7 @@ import Vapor
|
||||
|
||||
/// Represents a generic form context that is used to generate form templates
|
||||
/// that are handled by htmx.
|
||||
struct HtmxFormCTX<C: Content>: Content {
|
||||
struct HtmxFormCTX<Context: Content>: Content {
|
||||
let formClass: String?
|
||||
let formId: String
|
||||
let htmxPostTargetUrl: String?
|
||||
@@ -12,7 +12,7 @@ struct HtmxFormCTX<C: Content>: Content {
|
||||
let htmxResetAfterRequest: Bool
|
||||
let htmxSwapOob: String?
|
||||
let htmxSwap: String?
|
||||
let context: C
|
||||
let context: Context
|
||||
|
||||
init(
|
||||
formClass: String? = nil,
|
||||
@@ -23,7 +23,7 @@ struct HtmxFormCTX<C: Content>: Content {
|
||||
htmxResetAfterRequest: Bool = true,
|
||||
htmxSwapOob: HtmxSwap? = nil,
|
||||
htmxSwap: HtmxSwap? = nil,
|
||||
context: C
|
||||
context: Context
|
||||
) {
|
||||
self.formClass = formClass
|
||||
self.formId = formId
|
||||
@@ -65,3 +65,33 @@ struct HtmxFormCTX<C: Content>: Content {
|
||||
}
|
||||
|
||||
struct EmptyContent: Content {}
|
||||
|
||||
struct ButtonLabelContext: Content {
|
||||
let buttonLabel: String
|
||||
}
|
||||
|
||||
extension HtmxFormCTX where Context == ButtonLabelContext {
|
||||
init(
|
||||
formClass: String? = nil,
|
||||
formId: String,
|
||||
htmxTargetUrl: TargetUrl,
|
||||
htmxTarget: String,
|
||||
htmxPushUrl: Bool,
|
||||
htmxResetAfterRequest: Bool = true,
|
||||
htmxSwapOob: HtmxSwap? = nil,
|
||||
htmxSwap: HtmxSwap? = nil,
|
||||
buttonLabel: String
|
||||
) {
|
||||
self.init(
|
||||
formClass: formClass,
|
||||
formId: formId,
|
||||
htmxTargetUrl: htmxTargetUrl,
|
||||
htmxTarget: htmxTarget,
|
||||
htmxPushUrl: htmxPushUrl,
|
||||
htmxResetAfterRequest: htmxResetAfterRequest,
|
||||
htmxSwapOob: htmxSwapOob,
|
||||
htmxSwap: htmxSwapOob,
|
||||
context: .init(buttonLabel: buttonLabel)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user