Skip to content

Commit 8ea1785

Browse files
authored
Merge pull request #63 from XetaIO/terms-contact
Added a Terms page
2 parents dc5d2b6 + c380824 commit 8ea1785

File tree

20 files changed

+814
-22
lines changed

20 files changed

+814
-22
lines changed

app/Http/Controllers/PageController.php

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
<?php
22
namespace Xetaravel\Http\Controllers;
33

4+
use Illuminate\Http\RedirectResponse;
5+
use Illuminate\Http\Request ;
6+
use Illuminate\Support\Facades\Auth;
7+
use Illuminate\Support\Facades\Mail;
8+
use Illuminate\View\View;
49
use Xetaravel\Models\Article;
510
use Xetaravel\Models\Comment;
6-
use Illuminate\Support\Facades\Auth;
11+
use Xetaravel\Mail\Contact;
712

813
class PageController extends Controller
914
{
@@ -30,6 +35,54 @@ public function index()
3035
return view('page.index', ['articles' => $articles, 'comments' => $comments]);
3136
}
3237

38+
/**
39+
* Display the terms page.
40+
*
41+
* @return \Illuminate\Http\Response
42+
*/
43+
public function terms()
44+
{
45+
$this->breadcrumbs->addCrumb('Terms', route('page.terms'));
46+
47+
return view('page.terms', ['breadcrumbs' => $this->breadcrumbs]);
48+
}
49+
50+
/**
51+
* Display the contact page.
52+
*
53+
* @return \Illuminate\View\View
54+
*/
55+
public function showContact(): View
56+
{
57+
$this->breadcrumbs->addCrumb('Contact', route('page.contact'));
58+
59+
return view('page.contact', ['breadcrumbs' => $this->breadcrumbs]);
60+
}
61+
62+
/**
63+
* Send an E-mail to .
64+
*
65+
* @param \Illuminate\Http\Request $request The current request.
66+
*
67+
* @return \Illuminate\Http\RedirectResponse
68+
*/
69+
public function contact(Request $request): RedirectResponse
70+
{
71+
$details = [
72+
'name' => $request->get('name'),
73+
'email' => $request->get('email'),
74+
'subject' => $request->get('subject'),
75+
'message' => $request->get('message'),
76+
'ip' => $request->ip()
77+
];
78+
79+
Mail::to(config('xetaravel.site.contact_email'))->send(new Contact($details));
80+
81+
return redirect()
82+
->route('page.contact')
83+
->with('success', 'Thanks for contacting me ! I will answer you as fast as I can !');
84+
}
85+
3386
/**
3487
* Display the banished page.
3588
*

app/Mail/Contact.php

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?php
2+
3+
namespace Xetaravel\Mail;
4+
5+
use Illuminate\Bus\Queueable;
6+
use Illuminate\Contracts\Queue\ShouldQueue;
7+
use Illuminate\Mail\Mailable;
8+
use Illuminate\Queue\SerializesModels;
9+
10+
class Contact extends Mailable
11+
{
12+
use Queueable, SerializesModels;
13+
14+
/**
15+
* The details of the mail.
16+
*
17+
* @var array
18+
*/
19+
public $details;
20+
21+
/**
22+
* Create a new message instance.
23+
*
24+
* @return void
25+
*/
26+
public function __construct(array $details)
27+
{
28+
$this->details = $details;
29+
}
30+
31+
/**
32+
* Build the message.
33+
*
34+
* @return $this
35+
*/
36+
public function build()
37+
{
38+
return $this
39+
->from('[email protected]', 'Contact - Xetaravel')
40+
->subject($this->details['subject'])
41+
->view('emails.contact');
42+
}
43+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
.contact {
2+
.contacts {
3+
list-style: none;
4+
padding: 0;
5+
margin: 0;
6+
font-size: 16px;
7+
}
8+
9+
.social {
10+
list-style: none;
11+
padding: 0;
12+
margin: 0;
13+
14+
li {
15+
display: inline-block;
16+
17+
a {
18+
display: block;
19+
border-radius: 50%;
20+
width: 40px;
21+
height: 40px;
22+
line-height: 40px;
23+
text-align: center;
24+
color: $white;
25+
background-color: $selection-color;
26+
27+
&:hover {
28+
background-color: $brand-primary;
29+
}
30+
}
31+
}
32+
}
33+
}

resources/assets/sass/_footer.scss

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,16 @@
1414
padding-right: 15px;
1515
padding-left: 15px;
1616
}
17-
}
17+
18+
li:before {
19+
content: "|";
20+
margin-right: 4px;
21+
}
22+
23+
li:first-child {
24+
&:before {
25+
content: "";
26+
margin-right: 4px;
27+
}
28+
}
29+
}

resources/assets/sass/_scaffolding.scss

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,38 @@ section {
3636
position: static;
3737
}
3838
}
39+
40+
.hr-divider {
41+
position: relative;
42+
line-height: 20px;
43+
font-size: 17px;
44+
text-align: center;
45+
text-transform: uppercase;
46+
margin-bottom: 20px;
47+
48+
&:before {
49+
position: absolute;
50+
top: 49%;
51+
display: block;
52+
content: " ";
53+
width: 100%;
54+
height: 1px;
55+
background-color: #B7B7B7;
56+
}
57+
58+
.hr-divider-content {
59+
position: relative;
60+
z-index: 2;
61+
display: inline-block;
62+
padding-left: 1em;
63+
padding-right: 1em;
64+
vertical-align: middle;
65+
background-color: #ffffff;
66+
}
67+
68+
.hr-divider-heading {
69+
margin-top: 0;
70+
margin-bottom: 0;
71+
color: inherit;
72+
}
73+
}

resources/assets/sass/_terms.scss

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
.terms {
2+
h4 {
3+
&:hover {
4+
i {
5+
display:inline-block;
6+
}
7+
}
8+
9+
i {
10+
font-size: 80%;
11+
display: none;
12+
}
13+
}
14+
15+
h5 {
16+
&:hover {
17+
i {
18+
display:inline-block;
19+
}
20+
}
21+
22+
i {
23+
font-size: 80%;
24+
display: none;
25+
}
26+
}
27+
}

resources/assets/sass/xetaravel.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,5 @@
2525
@import "profile";
2626
@import "error";
2727
@import "security";
28+
@import "terms";
29+
@import "contact";

resources/views/Auth/register.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
@endif
4949
</div>
5050

51-
{!! Form::bsCheckbox("terms", null, false, "By clicking on \"Register\", you accept that you have read and understand the Terms.") !!}
51+
{!! Form::bsCheckbox("terms", null, false, "By clicking on \"Register\", you accept that you have read and understand the " . link_to(route('page.terms'), 'Terms') . ".") !!}
5252

5353
<div class="form-group text-xs-center">
5454
<div class="col-md-12 mb-1">

resources/views/account/index.blade.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@
4444
</div>
4545
<div class="col-md-9">
4646
<section>
47+
<div class="hr-divider">
48+
<h4 class="hr-divider-content hr-divider-heading font-xeta">
49+
My Account
50+
</h4>
51+
</div>
52+
4753
{!! Form::model($user, ['route' => 'users.account.update', 'files'=>'true', 'method' => 'put']) !!}
4854
<div class="row">
4955
<div class="col-md-5 col-lg-4">

resources/views/components/form/checkbox.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<label class="{{ isset($attributes['labelClass']) ? $attributes['labelClass'] : 'custom-control custom-checkbox' }}">
77
{!! Form::checkbox($name, $value, $checked, array_merge(['class' => 'custom-control-input'], $attributes)) !!}
88
<span class="custom-control-indicator"></span>
9-
<span class="custom-control-description">{{ $label }}</span>
9+
<span class="custom-control-description">{!! $label !!}</span>
1010
</label>
1111
@if ($errors->has($name))
1212
<div class="form-control-feedback">

0 commit comments

Comments
 (0)