Skip to content

Commit 80ed4b2

Browse files
author
Wazabii
committed
Example and frontend improvements
1 parent f03b43b commit 80ed4b2

File tree

16 files changed

+233
-71
lines changed

16 files changed

+233
-71
lines changed

app/Http/Controllers/Examples/ExampleForm.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,12 @@ public function __construct(Provider $provider, ContactForm $form, Validate $val
2929
public function contactFrom(ResponseInterface $response, RequestInterface $request)
3030
{
3131
$this->form->build();
32-
3332
$url = $this->url()->withType(["page"])->add(["modal"])->getUrl();
3433
$this->view()->setPartial("form", [
3534
"tagline" => getenv("APP_NAME"),
3635
"name" => "Contact us",
3736
"content" => "You can use regular form like bellow or place form in a modal: " .
38-
"<a class=\"domer-get-btn\" href=\"#\" data-href=\"" . $url . "\">Click here</a>",
37+
"<a class=\"maple-get-btn\" href=\"#\" data-href=\"" . $url . "\">Click here</a>",
3938
"form" => [
4039
"method" => "post",
4140
"action" => $this->url()->getUrl(),
@@ -104,7 +103,8 @@ public function contactFormModal(): object
104103
*/
105104
public function post(ResponseInterface $response, RequestInterface $request): object
106105
{
107-
if ($_requests = $this->validate->validate($this->form, $request->getParsedBody())) {
106+
if ($requests = $this->validate->validate($this->form, $request->getParsedBody())) {
107+
// The $requests variable will contain all "expected" form fields post values
108108
$this->responder()->message("Completed!");
109109
}
110110
// Responder will pass response to frontend and Stratox.js

app/Http/Controllers/Examples/Pages.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ public function __construct(Provider $provider)
2525
*/
2626
public function start(ResponseInterface $response, RequestInterface $request): ResponseInterface
2727
{
28+
2829
$this->provider->view()->setPartial("main.ingress", [
2930
"tagline" => "Ingress view partial",
3031
"name" => "Welcome to MaplePHP",
@@ -43,7 +44,6 @@ public function start(ResponseInterface $response, RequestInterface $request): R
4344
"content" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam id sapien dui. Nullam gravida bibendum finibus. Pellentesque a elementum augue. Aliquam malesuada et neque ac varius. Nam id eros eros. Ut ut mattis ex. Aliquam molestie tortor quis ultrices euismod. Quisque blandit pellentesque purus, in posuere ex mollis ac."
4445
]);
4546

46-
4747
// Auto clear cache on update and on a future pulish date!
4848
// withLastModified will only work with the middleware "LastModifiedHandler"
4949
// It will tho automatically be turned off IF session is open to make sure no important

app/Http/Controllers/Private/Login.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function form(ResponseInterface $response, RequestInterface $request): Re
3939
$this->view()->setPartial("form", [
4040
"name" => $this->local("auth")->get("signIn", "Sign in"),
4141
"content" => "You can use regular form like bellow or place form in a modal: " .
42-
"<a class=\"domer-get-btn\" href=\"#\" data-href=\"" . $url . "\">Click here</a>",
42+
"<a class=\"maple-get-btn\" href=\"#\" data-href=\"" . $url . "\">Click here</a>",
4343
"form" => [
4444
"method" => "post",
4545
"action" => $this->url()->reset()->add(["login"])->getUrl(),

app/Libraries/Output

Submodule Output updated 1 file

app/Models/Forms/ContactForm.php

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?php
2+
3+
namespace Models\Forms;
4+
5+
use MaplePHP\Foundation\Form\Forms\AbstractForm;
6+
7+
class ContactForm extends AbstractForm
8+
{
9+
/**
10+
* createForm method is an required, abstract method used to build form
11+
* @return void
12+
*/
13+
protected function createForm(): void
14+
{
15+
$this->form->add([
16+
"firstname" => [
17+
"type" => "text",
18+
"label" => "First name",
19+
"validate" => [
20+
"length" => [1, 60]
21+
]
22+
],
23+
"lastname" => [
24+
"type" => "text",
25+
"label" => "Last name",
26+
"validate" => [
27+
"length" => [1, 80]
28+
]
29+
],
30+
"email" => [
31+
"type" => "text",
32+
"label" => "Email",
33+
"attr" => [
34+
"type" => "email"
35+
],
36+
"validate" => [
37+
"length" => [1, 160]
38+
]
39+
],
40+
"message" => [
41+
"type" => "textarea",
42+
"label" => "Message",
43+
"validate" => [
44+
"length" => [1, 2000]
45+
]
46+
]
47+
]);
48+
}
49+
}

node_modules/frontresponder/package.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/frontresponder/src/Responder.js

Lines changed: 6 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/stratoxcomponents/package.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)