Skip to content

Commit

Permalink
Making websites with October CMS - Part 18 - Creating contact form
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivan Doric committed Oct 25, 2016
1 parent 146095f commit 6a50a20
Show file tree
Hide file tree
Showing 13 changed files with 359 additions and 35 deletions.
13 changes: 8 additions & 5 deletions config/mail.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
|
*/

'driver' => 'mail',
'driver' => 'smtp',

/*
|--------------------------------------------------------------------------
Expand All @@ -28,7 +28,7 @@
|
*/

'host' => 'smtp.mailgun.org',
'host' => 'smtp.gmail.com',

/*
|--------------------------------------------------------------------------
Expand Down Expand Up @@ -80,7 +80,7 @@
|
*/

'username' => null,
'username' => '[email protected]',

/*
|--------------------------------------------------------------------------
Expand All @@ -93,7 +93,7 @@
|
*/

'password' => null,
'password' => 'yourpassword',

/*
|--------------------------------------------------------------------------
Expand All @@ -107,7 +107,10 @@
*/

'sendmail' => '/usr/sbin/sendmail -bs',

'to' => [
'address' => '[email protected]',
'name' => 'Catch all email'
],
/*
|--------------------------------------------------------------------------
| Mail "Pretend"
Expand Down
217 changes: 188 additions & 29 deletions octobermovies.sublime-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -520,10 +520,46 @@
"buffers":
[
{
"file": "plugins/watchlearn/movies/components/Actors.php",
"file": "plugins/watchlearn/contact/Plugin.php",
"settings":
{
"buffer_size": 1634,
"buffer_size": 312,
"encoding": "UTF-8",
"line_ending": "Unix"
}
},
{
"file": "plugins/watchlearn/contact/views/mail/message.htm",
"settings":
{
"buffer_size": 120,
"encoding": "UTF-8",
"line_ending": "Unix"
}
},
{
"file": "plugins/watchlearn/contact/components/ContactForm.php",
"settings":
{
"buffer_size": 692,
"encoding": "UTF-8",
"line_ending": "Unix"
}
},
{
"file": "config/mail.php",
"settings":
{
"buffer_size": 4432,
"encoding": "UTF-8",
"line_ending": "Unix"
}
},
{
"file": "plugins/watchlearn/contact/components/contactform/default.htm",
"settings":
{
"buffer_size": 290,
"encoding": "UTF-8",
"line_ending": "Unix"
}
Expand Down Expand Up @@ -795,20 +831,19 @@
"expanded_folders":
[
"/Users/ivan/Development/public/octobermovies",
"/Users/ivan/Development/public/octobermovies/_assets_",
"/Users/ivan/Development/public/octobermovies/config",
"/Users/ivan/Development/public/octobermovies/plugins",
"/Users/ivan/Development/public/octobermovies/plugins/october",
"/Users/ivan/Development/public/octobermovies/plugins/watchlearn",
"/Users/ivan/Development/public/octobermovies/plugins/watchlearn/movies",
"/Users/ivan/Development/public/octobermovies/plugins/watchlearn/movies/components",
"/Users/ivan/Development/public/octobermovies/plugins/watchlearn/movies/components/actors",
"/Users/ivan/Development/public/octobermovies/plugins/watchlearn/movies/formwidgets",
"/Users/ivan/Development/public/octobermovies/plugins/watchlearn/movies/formwidgets/actorbox",
"/Users/ivan/Development/public/octobermovies/themes",
"/Users/ivan/Development/public/octobermovies/themes/olympos",
"/Users/ivan/Development/public/octobermovies/themes/olympos/pages"
"/Users/ivan/Development/public/octobermovies/plugins/watchlearn/contact",
"/Users/ivan/Development/public/octobermovies/plugins/watchlearn/contact/classes",
"/Users/ivan/Development/public/octobermovies/plugins/watchlearn/contact/views",
"/Users/ivan/Development/public/octobermovies/plugins/watchlearn/contact/views/mail"
],
"file_history":
[
"/Users/ivan/Development/public/octobermovies/config/mail.php",
"/Users/ivan/Development/public/octobermovies/plugins/watchlearn/movies/components/Actors.php",
"/Users/ivan/Development/public/octobermovies/plugins/watchlearn/movies/components/actors/default.htm",
"/Users/ivan/Development/public/octobermovies/plugins/watchlearn/movies/Plugin.php",
"/Users/ivan/components/Actors.php",
Expand Down Expand Up @@ -934,9 +969,7 @@
"/Users/ivan/Development/public/springfall/app/Http/Controllers/Auth/AuthController.php",
"/Users/ivan/Development/public/springfall/database/migrations/2016_05_31_101837_add_additional_fields_to_users_table.php",
"/Users/ivan/Development/public/springfall/vendor/laravel/framework/src/Illuminate/Foundation/Auth/RegistersUsers.php",
"/Users/ivan/Development/public/springfall/resources/views/partials/footer.blade.php",
"/Users/ivan/Development/public/springfall/.env",
"/Users/ivan/Development/public/springfall/app/Role.php"
"/Users/ivan/Development/public/springfall/resources/views/partials/footer.blade.php"
],
"find":
{
Expand Down Expand Up @@ -1143,24 +1176,87 @@
"groups":
[
{
"selected": 0,
"selected": 3,
"sheets":
[
{
"buffer": 0,
"file": "plugins/watchlearn/movies/components/Actors.php",
"file": "plugins/watchlearn/contact/Plugin.php",
"semi_transient": false,
"settings":
{
"buffer_size": 312,
"regions":
{
},
"selection":
[
[
251,
251
]
],
"settings":
{
"incomplete_sync": null,
"remote_loading": false,
"synced": false,
"syntax": "Packages/PHP/PHP.sublime-syntax"
},
"translation.x": 0.0,
"translation.y": 0.0,
"zoom_level": 1.0
},
"stack_index": 2,
"type": "text"
},
{
"buffer": 1,
"file": "plugins/watchlearn/contact/views/mail/message.htm",
"semi_transient": false,
"settings":
{
"buffer_size": 120,
"regions":
{
},
"selection":
[
[
115,
115
]
],
"settings":
{
"_anf_new": "",
"incomplete_sync": null,
"remote_loading": false,
"synced": false,
"syntax": "Packages/Twig/Syntaxes/HTML (Twig).tmLanguage"
},
"translation.x": 0.0,
"translation.y": 0.0,
"zoom_level": 1.0
},
"stack_index": 3,
"type": "text"
},
{
"buffer": 2,
"file": "plugins/watchlearn/contact/components/ContactForm.php",
"semi_transient": false,
"settings":
{
"buffer_size": 1634,
"buffer_size": 692,
"regions":
{
},
"selection":
[
[
1188,
1188
578,
578
]
],
"settings":
Expand All @@ -1172,11 +1268,74 @@
"syntax": "Packages/PHP/PHP.sublime-syntax"
},
"translation.x": 0.0,
"translation.y": 1889.0,
"translation.y": 689.0,
"zoom_level": 1.0
},
"stack_index": 1,
"type": "text"
},
{
"buffer": 3,
"file": "config/mail.php",
"semi_transient": false,
"settings":
{
"buffer_size": 4432,
"regions":
{
},
"selection":
[
[
3930,
3930
]
],
"settings":
{
"incomplete_sync": null,
"remote_loading": false,
"synced": false,
"syntax": "Packages/PHP/PHP.sublime-syntax"
},
"translation.x": 0.0,
"translation.y": 4548.0,
"zoom_level": 1.0
},
"stack_index": 0,
"type": "text"
},
{
"buffer": 4,
"file": "plugins/watchlearn/contact/components/contactform/default.htm",
"semi_transient": false,
"settings":
{
"buffer_size": 290,
"regions":
{
},
"selection":
[
[
28,
28
]
],
"settings":
{
"_anf_new": "",
"incomplete_sync": null,
"remote_loading": false,
"synced": false,
"syntax": "Packages/Twig/Syntaxes/HTML (Twig).tmLanguage"
},
"translation.x": 0.0,
"translation.y": 0.0,
"zoom_level": 1.0
},
"stack_index": 4,
"type": "text"
}
]
}
Expand Down Expand Up @@ -1751,21 +1910,25 @@
"select_project":
{
"height": 500.0,
"last_filter": "watch",
"last_filter": "wat",
"selected_items":
[
[
"watch",
"wat",
"~/Development/public/watchlearn/watchlearn.sublime-project"
],
[
"spring",
"~/Development/public/springfall/springfall.sublime-project"
"watc",
"~/Development/public/watchlearn/watchlearn.sublime-project"
],
[
"watc",
"watch",
"~/Development/public/watchlearn/watchlearn.sublime-project"
],
[
"spring",
"~/Development/public/springfall/springfall.sublime-project"
],
[
"octo",
"~/Development/public/octobermovies/octobermovies.sublime-project"
Expand Down Expand Up @@ -1894,10 +2057,6 @@
"que",
"~/Development/public/query/query.sublime-project"
],
[
"wat",
"~/Development/public/watchlearn/watchlearn.sublime-project"
],
[
"act",
"~/Development/public/wineapp/wineapp.sublime-project"
Expand Down
17 changes: 17 additions & 0 deletions plugins/watchlearn/contact/Plugin.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php namespace Watchlearn\Contact;

use System\Classes\PluginBase;

class Plugin extends PluginBase
{
public function registerComponents()
{
return [
'Watchlearn\Contact\Components\ContactForm' => 'contactform',
];
}

public function registerSettings()
{
}
}
31 changes: 31 additions & 0 deletions plugins/watchlearn/contact/components/ContactForm.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php namespace Watchlearn\Contact\Components;

use Cms\Classes\ComponentBase;
use Input;
use Mail;

class ContactForm extends ComponentBase
{

public function componentDetails(){
return [
'name' => 'Contact Form',
'description' => 'Simple contact form'
];
}


public function onSend(){

$vars = ['name' => Input::get('name'), 'email' => Input::get('email'), 'content' => Input::get('content')];

Mail::send('watchlearn.contact::mail.message', $vars, function($message) {

$message->to('[email protected]', 'Admin Person');
$message->subject('New message from contact form');

});

}

}
Loading

0 comments on commit 6a50a20

Please sign in to comment.