Skip to content
This repository was archived by the owner on Apr 20, 2024. It is now read-only.

Commit b8ef53b

Browse files
Merge pull request #124 from nodes-vapor/feature/remove-mutable-leaf-tag-config
Remove MutableLeafTagConfig
2 parents 39a4090 + 288e8d4 commit b8ef53b

File tree

2 files changed

+17
-10
lines changed

2 files changed

+17
-10
lines changed

Package.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version:4.2
1+
// swift-tools-version:4.1
22
// The swift-tools-version declares the minimum version of Swift required to build this package.
33

44
import PackageDescription
@@ -17,12 +17,12 @@ let package = Package(
1717
.package(url: "https://github.com/vapor/leaf.git", from: "3.0.0"),
1818
.package(url: "https://github.com/vapor/auth.git", from: "2.0.0"),
1919

20-
.package(url: "https://github.com/nodes-vapor/sugar.git", from: "3.0.0-rc"),
21-
.package(url: "https://github.com/nodes-vapor/flash.git", from: "3.0.0"),
22-
.package(url: "https://github.com/nodes-vapor/bootstrap.git", from: "2.0.0"),
20+
.package(url: "https://github.com/nodes-vapor/sugar.git", from: "3.0.0"),
21+
.package(url: "https://github.com/nodes-vapor/flash.git", from: "4.0.0"),
22+
.package(url: "https://github.com/nodes-vapor/bootstrap.git", from: "3.0.0"),
2323
.package(url: "https://github.com/nodes-vapor/reset.git", from: "1.0.0-rc"),
2424
.package(url: "https://github.com/nodes-vapor/submissions.git", from: "1.0.0-beta"),
25-
.package(url: "https://github.com/nodes-vapor/paginator.git", from: "3.0.0-rc"),
25+
.package(url: "https://github.com/nodes-vapor/paginator.git", from: "3.0.0"),
2626

2727
.package(url: "https://github.com/twof/VaporMailgunService.git", from: "1.1.0"),
2828
],

Sources/AdminPanel/Providers/AdminPanelProvider.swift

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ public final class AdminPanelProvider<U: AdminPanelUserType>: Provider {
5353
try services.register(CurrentURLProvider())
5454
try services.register(CurrentUserProvider<U>())
5555
try services.register(FlashProvider())
56-
try services.register(MutableLeafTagConfigProvider())
5756
try services.register(LeafProvider())
5857

5958
try services.register(ResetProvider<U>(
@@ -85,8 +84,18 @@ public final class AdminPanelProvider<U: AdminPanelUserType>: Provider {
8584

8685
/// See Service.Provider.boot
8786
public func didBoot(_ container: Container) throws -> Future<Void> {
88-
let tags: MutableLeafTagConfig = try container.make()
89-
tags.use([
87+
return .done(on: container)
88+
}
89+
}
90+
91+
public extension LeafTagConfig {
92+
public mutating func useAdminPanelLeafTags<U: AdminPanelUserType>(
93+
_ type: U.Type,
94+
on container: Container
95+
) throws {
96+
let config: AdminPanelConfig<U> = try container.make()
97+
98+
use([
9099
"adminPanel:avatarURL": AvatarURLTag(),
91100
"adminPanel:config": AdminPanelConfigTag<U>(),
92101
"adminPanel:sidebar:heading": SidebarHeadingTag(),
@@ -97,7 +106,5 @@ public final class AdminPanelProvider<U: AdminPanelUserType>: Provider {
97106
"submissions:WYSIWYG": InputTag(templatePath: config.tagTemplatePaths.wysiwygField),
98107
"offsetPaginator": OffsetPaginatorTag(templatePath: "Paginator/offsetpaginator")
99108
])
100-
101-
return .done(on: container)
102109
}
103110
}

0 commit comments

Comments
 (0)