From 6e997cb428563cd67d61c3f90fc25563ad141e70 Mon Sep 17 00:00:00 2001 From: Qiang Xue Date: Fri, 3 May 2013 17:28:19 -0400 Subject: [PATCH] improved contact page. --- app/protected/controllers/SiteController.php | 2 +- app/protected/views/site/contact.php | 16 +++++++++++----- app/protected/views/site/login.php | 6 ++---- framework/web/Session.php | 2 +- 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/app/protected/controllers/SiteController.php b/app/protected/controllers/SiteController.php index 33a87c9..7e6bb15 100644 --- a/app/protected/controllers/SiteController.php +++ b/app/protected/controllers/SiteController.php @@ -33,7 +33,7 @@ class SiteController extends Controller { $model = new ContactForm; if ($this->populate($_POST, $model) && $model->contact(Yii::$app->params['adminEmail'])) { - Yii::$app->session->setFlash('contact', 'Thank you for contacting us. We will respond to you as soon as possible.'); + Yii::$app->session->setFlash('contactFormSubmitted'); Yii::$app->response->refresh(); } else { echo $this->render('contact', array( diff --git a/app/protected/views/site/contact.php b/app/protected/views/site/contact.php index 726498e..246570d 100644 --- a/app/protected/views/site/contact.php +++ b/app/protected/views/site/contact.php @@ -9,7 +9,15 @@ $this->title = 'Contact'; ?>

title); ?>

-

Please fill out the following fields:

+session->hasFlash('contactFormSubmitted')): ?> +
+ Thank you for contacting us. We will respond to you as soon as possible. +
+ + +

+ If you have business inquiries or other questions, please fill out the following form to contact us. Thank you. +

beginWidget('yii\widgets\ActiveForm', array( 'options' => array('class' => 'form-horizontal'), @@ -19,9 +27,7 @@ $this->title = 'Contact'; field($model, 'email')->textInput(); ?> field($model, 'subject')->textInput(); ?> field($model, 'body')->textArea(array('rows' => 6)); ?> -
-
- 'btn btn-primary')); ?> -
+
+ 'btn btn-primary')); ?>
endWidget(); ?> \ No newline at end of file diff --git a/app/protected/views/site/login.php b/app/protected/views/site/login.php index 68272b4..5608ffb 100644 --- a/app/protected/views/site/login.php +++ b/app/protected/views/site/login.php @@ -15,9 +15,7 @@ $this->title = 'Login'; field($model, 'username')->textInput(); ?> field($model, 'password')->passwordInput(); ?> field($model, 'rememberMe')->checkbox(); ?> -
-
- 'btn btn-primary')); ?> -
+
+ 'btn btn-primary')); ?>
endWidget(); ?> \ No newline at end of file diff --git a/framework/web/Session.php b/framework/web/Session.php index 4c0505f..1b48433 100644 --- a/framework/web/Session.php +++ b/framework/web/Session.php @@ -587,7 +587,7 @@ class Session extends Component implements \IteratorAggregate, \ArrayAccess, \Co * session variable using the same name, its value will be overwritten by this method. * @param mixed $value flash message */ - public function setFlash($key, $value) + public function setFlash($key, $value = true) { $counters = $this->get($this->flashVar, array()); $counters[$key] = 0;