-
-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// | ||
// File.swift | ||
// | ||
// | ||
// Created by Rahaf Aljerwi on 9/16/24. | ||
// | ||
|
||
import Foundation |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// | ||
// PortalController.swift | ||
// | ||
// | ||
|
||
|
||
import Fluent | ||
import Plot | ||
import Vapor | ||
|
||
enum PortalController { | ||
@Sendable | ||
static func show(req: Request) async throws -> HTML { | ||
return Portal.View(path: req.url.path).document() | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// | ||
// File.swift | ||
// | ||
// | ||
// Created by Rahaf Aljerwi on 9/14/24. | ||
// | ||
|
||
import Foundation |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// | ||
// File.swift | ||
// | ||
// | ||
// Created by Rahaf Aljerwi on 9/15/24. | ||
// | ||
|
||
import Foundation |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
// | ||
// PortalView.swift | ||
// | ||
// | ||
|
||
import Plot | ||
import Foundation | ||
|
||
enum Portal { | ||
|
||
class View: PublicPage { | ||
|
||
// let model: Model | ||
|
||
// init(path: String, model: Model) { | ||
// self.model = model | ||
// super.init(path: path) | ||
// } | ||
|
||
override func pageTitle() -> String? { | ||
"Portal" | ||
} | ||
|
||
override func content() -> Node<HTML.BodyContext> { | ||
.div( | ||
.h2("Login"), | ||
.loginForm(), | ||
.h2("Dont have an account?"), | ||
.signupButton() | ||
) | ||
} | ||
} | ||
} | ||
|
||
// move to other file later | ||
extension Portal { | ||
struct Model { | ||
var email: String | ||
var password: String | ||
} | ||
} | ||
|
||
// move to plot extensions later | ||
extension Node where Context: HTML.BodyContext { | ||
static func loginForm(email: String = "", password: String = "") -> Self { | ||
.form( | ||
.action(SiteURL.portal.relativeURL()), | ||
Check failure on line 47 in Sources/App/Views/Authentication/Login+View.swift GitHub Actions / Test
Check failure on line 47 in Sources/App/Views/Authentication/Login+View.swift GitHub Actions / Test
Check failure on line 47 in Sources/App/Views/Authentication/Login+View.swift GitHub Actions / Test
Check failure on line 47 in Sources/App/Views/Authentication/Login+View.swift GitHub Actions / Test
|
||
.loginField(email: email), | ||
.passwordField(password: password), | ||
.button( | ||
.type(.submit) | ||
) | ||
) | ||
} | ||
|
||
static func signupButton() -> Self { | ||
.form( | ||
.action(SiteURL.signup.relativeURL()), | ||
Check failure on line 58 in Sources/App/Views/Authentication/Login+View.swift GitHub Actions / Test
Check failure on line 58 in Sources/App/Views/Authentication/Login+View.swift GitHub Actions / Test
Check failure on line 58 in Sources/App/Views/Authentication/Login+View.swift GitHub Actions / Test
Check failure on line 58 in Sources/App/Views/Authentication/Login+View.swift GitHub Actions / Test
|
||
.button( | ||
.type(.submit) | ||
) | ||
) | ||
} | ||
} | ||
|
||
extension Node where Context == HTML.FormContext { | ||
static func loginField(email: String = "") -> Self { | ||
.input( | ||
.id("email"), | ||
.name("email"), | ||
.type(.email), | ||
.placeholder("Enter email"), | ||
.spellcheck(false), | ||
.autocomplete(false), | ||
.value(email) | ||
) | ||
} | ||
|
||
static func passwordField(password: String = "") -> Self { | ||
.input( | ||
.id("password"), | ||
.name("password"), | ||
.type(.password), | ||
.placeholder("Enter password"), | ||
.spellcheck(false), | ||
.autocomplete(false), | ||
.value(password) | ||
) | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// | ||
// File.swift | ||
// | ||
// | ||
// Created by Rahaf Aljerwi on 9/16/24. | ||
// | ||
|
||
import Foundation |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// | ||
// File 2.swift | ||
// | ||
// | ||
// Created by Rahaf Aljerwi on 9/14/24. | ||
// | ||
|
||
import Foundation |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// | ||
// File 2.swift | ||
// | ||
// | ||
// Created by Rahaf Aljerwi on 9/16/24. | ||
// | ||
|
||
import Foundation |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// | ||
// File.swift | ||
// | ||
// | ||
// Created by Rahaf Aljerwi on 9/15/24. | ||
// | ||
|
||
import Foundation |