Fix display of contact form when logged in

This commit is contained in:
DariusIII
2018-11-19 13:42:47 +01:00
parent bf55489a9a
commit ab36c87631
4 changed files with 100 additions and 84 deletions
+2
View File
@@ -1,3 +1,5 @@
2018-11-19 DariusIII
* Fix: Fix display of contact form when logged in
2018-11-18 DariusIII
* Chg: Increase number of checked files in PostProcess par2 check function
* Chg: Update Blacklight/utility/Country class
+22 -9
View File
@@ -118,20 +118,33 @@ class BasePageController extends Controller
if (Auth::check()) {
$this->userdata = User::find(Auth::id());
$this->setUserPreferences();
if ($this->theme === 'None') {
$this->theme = Settings::settingValue('site.main.style');
}
} else {
$this->theme = Settings::settingValue('site.main.style');
// Tell Smarty which directories to use for templates
$this->smarty->setTemplateDir([
'user' => config('ytake-laravel-smarty.template_path').DIRECTORY_SEPARATOR.$this->theme,
'shared' => config('ytake-laravel-smarty.template_path').'/shared',
'default' => config('ytake-laravel-smarty.template_path').'/Gentele',
]);
$this->smarty->assign('isadmin', 'false');
$this->smarty->assign('ismod', 'false');
$this->smarty->assign('loggedin', 'false');
$this->smarty->assign(
[
'isadmin' => false,
'ismod' => false,
'loggedin' => false
]
);
}
if ($this->theme === 'None') {
$this->theme = Settings::settingValue('site.main.style');
}
$this->smarty->assign('theme', $this->theme);
$this->smarty->assign('site', $this->settings);
$this->smarty->assign(
[
'theme'=> $this->theme,
'site' => $this->settings
]
);
}
/**
+10 -7
View File
@@ -16,6 +16,7 @@ class ContactUsController extends BasePageController
*/
public function contact(Request $request)
{
$this->setPrefs();
$this->validate($request, [
'useremail' => 'required',
'username' => 'required',
@@ -45,33 +46,35 @@ class ContactUsController extends BasePageController
}
$msg = "<h2 style='text-align:center;'>Thank you for getting in touch with ".Settings::settingValue('site.main.title').'.</h2>';
}
app('smarty.view')->assign('msg', $msg);
return redirect('contact-us');
return $this->showContactForm($msg);
}
/**
* @param string $msg
*
* @throws \Exception
*/
public function showContactForm()
public function showContactForm($msg = '')
{
$theme = Settings::settingValue('site.main.style');
$this->setPrefs();
$title = 'Contact '.Settings::settingValue('site.main.title');
$meta_title = 'Contact '.Settings::settingValue('site.main.title');
$meta_keywords = 'contact us,contact,get in touch,email';
$meta_description = 'Contact us at '.Settings::settingValue('site.main.title').' and submit your feedback';
$content = app('smarty.view')->fetch($theme.'/contact.tpl');
$content = $this->smarty->fetch('contact.tpl');
app('smarty.view')->assign(
$this->smarty->assign(
[
'title' => $title,
'content' => $content,
'meta_title' => $meta_title,
'meta_keywords' => $meta_keywords,
'meta_description' => $meta_description,
'msg' => $msg,
]
);
app('smarty.view')->display($theme.'/basepage.tpl');
$this->pagerender();
}
}
+66 -68
View File
@@ -1,77 +1,75 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>{$meta_title}{if $meta_title != "" && $site->metatitle != ""} - {/if}{$site->metatitle}</title>
<meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
<meta charset="UTF-8">
<title>{$meta_title}{if $meta_title != "" && $site->metatitle != ""} - {/if}{$site->metatitle}</title>
<meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
</head>
<body class="skin-blue layout-boxed">
<div class="wrapper">
<div class="header">
<h2>Contact Us</h2>
<div class="breadcrumb-wrapper">
<ol class="breadcrumb">
<li><a href="{$smarty.const.WWW_TOP}{$site->home_link}">Home</a></li>
/ Contact
</ol>
</div>
</div>
<div class="box-body">
<div class="box-content"
<div class="row">
<div class="col-md-12">
<div class="box-content">
<div class="row">
<div class="col-lg-12 col-sm-12 col-xs-12">
<div class="panel panel-default">
<div class="panel-body pagination2">
<div class="box-body">
<div class="row">
<div class="col-sm-8">
{$msg}
{if empty($msg)}
<h2>Have a question? <br> Don't hesitate to send us a message. Our team
will be
happy to help you.</h2>
</div>
</div>
<div class="row m-b-30">
<div class="col-sm-6">
{{Form::open(['url' => 'contact-us'])}}
<div class="row">
<div class="col-sm-6">
<label for="username" class="h6">Name</label>
<input id="username" type="text" name="username" value=""
placeholder="Name" class="form-control form-white">
</div>
<div class="col-sm-6">
<label for="useremail" class="h6">E-mail</label>
<input type="text" id="useremail" name="useremail"
class="form-control form-white">
</div>
</div>
<label for="comment" class="h6">Message</label>
<textarea rows="7" name="comment" id="comment"
class="form-control form-white"></textarea>
{if {config('captcha.enabled')} == 1 && !empty({config('captcha.sitekey')}) && !empty({config('captcha.secret')})}
{NoCaptcha::display()}{NoCaptcha::renderJs()}
{/if}
<button type="submit" class="btn btn-primary m-t-20">
Send message
</button>
{{Form::close()}}
</div>
</div>
</div>
</div>
</div>
</div>
{/if}
</div>
</div>
</div>
</div>
</div>
<div class="header">
<h2>Contact Us</h2>
<div class="breadcrumb-wrapper">
<ol class="breadcrumb">
<li><a href="{$smarty.const.WWW_TOP}{$site->home_link}">Home</a></li>
/ Contact
</ol>
</div>
</div>
<div class="box-body">
<div class="box-content"
<div class="row">
<div class="col-md-12">
<div class="box-content">
<div class="row">
<div class="col-lg-12 col-sm-12 col-xs-12">
<div class="panel panel-default">
<div class="panel-body pagination2">
<div class="box-body">
<div class="row">
<div class="col-sm-8">
{$msg}
<h2>Have a question? <br> Don't hesitate to send us a message. Our team
will be
happy to help you.</h2>
</div>
</div>
<div class="row m-b-30">
<div class="col-sm-6">
{{Form::open(['url' => 'contact-us'])}}
<div class="row">
<div class="col-sm-6">
<label for="username" class="h6">Name</label>
<input id="username" type="text" name="username" value=""
placeholder="Name" class="form-control form-white">
</div>
<div class="col-sm-6">
<label for="useremail" class="h6">E-mail</label>
<input type="text" id="useremail" name="useremail"
class="form-control form-white">
</div>
</div>
<label for="comment" class="h6">Message</label>
<textarea rows="7" name="comment" id="comment"
class="form-control form-white"></textarea>
{if {config('captcha.enabled')} == 1 && !empty({config('captcha.sitekey')}) && !empty({config('captcha.secret')})}
{NoCaptcha::display()}{NoCaptcha::renderJs()}
{/if}
<button type="submit" class="btn btn-primary m-t-20">
Send message
</button>
{{Form::close()}}
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>