diff --git a/composer.json b/composer.json index 5e2608d..a5b6c2f 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,8 @@ "php": ">=5.4.0", "yiisoft/yii2": "~2.0.6", "yiisoft/yii2-bootstrap": "~2.0.0", - "yiisoft/yii2-swiftmailer": "~2.0.0 || ~2.1.0" + "yiisoft/yii2-swiftmailer": "~2.0.0 || ~2.1.0", + "bower-asset/materialize": "^0.100.2" }, "require-dev": { "yiisoft/yii2-debug": "~2.0.0", diff --git a/composer.lock b/composer.lock index 1c289b8..e5a34ec 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "630d5f1d19e73b0163f900453171fba5", + "content-hash": "ec09898700dcf10b1fe4b54e61ad8ad4", "packages": [ { "name": "bower-asset/bootstrap", @@ -70,6 +70,25 @@ ] }, { + "name": "bower-asset/materialize", + "version": "v0.100.2", + "source": { + "type": "git", + "url": "https://github.com/Dogfalo/materialize.git", + "reference": "9bc43a1199ad5dfb78d58ba47726ab039218a939" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Dogfalo/materialize/zipball/9bc43a1199ad5dfb78d58ba47726ab039218a939", + "reference": "9bc43a1199ad5dfb78d58ba47726ab039218a939", + "shasum": null + }, + "require": { + "bower-asset/jquery": ">=3.0.0,<4.0.0|>=2.1.4,<3.0.0" + }, + "type": "bower-asset" + }, + { "name": "bower-asset/punycode", "version": "v1.3.2", "source": { diff --git a/frontend/assets/AppAsset.php b/frontend/assets/AppAsset.php index 8b5f017..c247898 100644 --- a/frontend/assets/AppAsset.php +++ b/frontend/assets/AppAsset.php @@ -18,6 +18,6 @@ class AppAsset extends AssetBundle ]; public $depends = [ 'yii\web\YiiAsset', - 'yii\bootstrap\BootstrapAsset', +// 'yii\bootstrap\BootstrapAsset', ]; } diff --git a/frontend/assets/MaterializeAsset.php b/frontend/assets/MaterializeAsset.php new file mode 100644 index 0000000..1591a03 --- /dev/null +++ b/frontend/assets/MaterializeAsset.php @@ -0,0 +1,19 @@ + [ - 'class' => AccessControl::className(), - 'only' => ['logout', 'signup'], - 'rules' => [ - [ - 'actions' => ['signup'], - 'allow' => true, - 'roles' => ['?'], + /** + * {@inheritdoc} + */ + public function behaviors() + { + return [ + 'access' => [ + 'class' => AccessControl::className(), + // 'only' => ['logout', 'signup'], + 'rules' => [ + [ + 'actions' => [ 'signup' ], + 'allow' => true, + 'roles' => [ '?' ], + ], + [ + 'actions' => [ + 'logout', + 'index', + 'calls', + ], + 'allow' => true, + 'roles' => [ '@' ], + ], + [ + 'actions' => [ 'login' ], + 'allow' => true, + // 'roles' => ['*'], + ], ], - [ - 'actions' => ['logout'], - 'allow' => true, - 'roles' => ['@'], + ], + 'verbs' => [ + 'class' => VerbFilter::className(), + 'actions' => [ + 'logout' => [ 'post' ], ], ], - ], - 'verbs' => [ - 'class' => VerbFilter::className(), - 'actions' => [ - 'logout' => ['post'], + ]; + } + + /** + * {@inheritdoc} + */ + public function actions() + { + return [ + 'error' => [ + 'class' => 'yii\web\ErrorAction', ], - ], - ]; - } - - /** - * {@inheritdoc} - */ - public function actions() - { - return [ - 'error' => [ - 'class' => 'yii\web\ErrorAction', - ], - 'captcha' => [ - 'class' => 'yii\captcha\CaptchaAction', - 'fixedVerifyCode' => YII_ENV_TEST ? 'testme' : null, - ], - ]; - } - - /** - * Displays homepage. - * - * @return mixed - */ - public function actionIndex() - { - return $this->render('index'); - } - - /** - * Logs in a user. - * - * @return mixed - */ - public function actionLogin() - { - if (!Yii::$app->user->isGuest) { - return $this->goHome(); + 'captcha' => [ + 'class' => 'yii\captcha\CaptchaAction', + 'fixedVerifyCode' => YII_ENV_TEST ? 'testme' : null, + ], + ]; } - - $model = new LoginForm(); - if ($model->load(Yii::$app->request->post()) && $model->login()) { - return $this->goBack(); - } else { - $model->password = ''; - - return $this->render('login', [ - 'model' => $model, - ]); + + /** + * Displays homepage. + * + * @return mixed + */ + public function actionIndex() + { + $calls = Call::find() + ->all(); + return $this->render( + 'index', + [ + 'calls' => $calls, + ] + ); } - } - - /** - * Logs out the current user. - * - * @return mixed - */ - public function actionLogout() - { - Yii::$app->user->logout(); - - return $this->goHome(); - } - - /** - * Displays contact page. - * - * @return mixed - */ - public function actionContact() - { - $model = new ContactForm(); - if ($model->load(Yii::$app->request->post()) && $model->validate()) { - if ($model->sendEmail(Yii::$app->params['adminEmail'])) { - Yii::$app->session->setFlash('success', 'Thank you for contacting us. We will respond to you as soon as possible.'); + + /** + * Logs in a user. + * + * @return mixed + */ + public function actionLogin() + { + if (!Yii::$app->user->isGuest) { + return $this->goHome(); + } + + $model = new LoginForm(); + if ($model->load(Yii::$app->request->post()) && $model->login()) { + return $this->goBack(); } else { - Yii::$app->session->setFlash('error', 'There was an error sending your message.'); + $model->password = ''; + + return $this->render( + 'login', + [ + 'model' => $model, + ] + ); } - - return $this->refresh(); - } else { - return $this->render('contact', [ - 'model' => $model, - ]); } - } - - /** - * Displays about page. - * - * @return mixed - */ - public function actionAbout() - { - return $this->render('about'); - } - - /** - * Signs user up. - * - * @return mixed - */ - public function actionSignup() - { - $model = new SignupForm(); - if ($model->load(Yii::$app->request->post())) { - if ($user = $model->signup()) { - if (Yii::$app->getUser()->login($user)) { - return $this->goHome(); + + /** + * Logs out the current user. + * + * @return mixed + */ + public function actionLogout() + { + Yii::$app->user->logout(); + + return $this->goHome(); + } + + /** + * Displays contact page. + * + * @return mixed + */ + public function actionContact() + { + $model = new ContactForm(); + if ($model->load(Yii::$app->request->post()) && $model->validate()) { + if ($model->sendEmail(Yii::$app->params[ 'adminEmail' ])) { + Yii::$app->session->setFlash( + 'success', + 'Thank you for contacting us. We will respond to you as soon as possible.' + ); + } else { + Yii::$app->session->setFlash('error', 'There was an error sending your message.'); } + + return $this->refresh(); + } else { + return $this->render( + 'contact', + [ + 'model' => $model, + ] + ); } } - - return $this->render('signup', [ - 'model' => $model, - ]); - } - - /** - * Requests password reset. - * - * @return mixed - */ - public function actionRequestPasswordReset() - { - $model = new PasswordResetRequestForm(); - if ($model->load(Yii::$app->request->post()) && $model->validate()) { - if ($model->sendEmail()) { - Yii::$app->session->setFlash('success', 'Check your email for further instructions.'); - - return $this->goHome(); - } else { - Yii::$app->session->setFlash('error', 'Sorry, we are unable to reset password for the provided email address.'); + + /** + * Displays about page. + * + * @return mixed + */ + public function actionAbout() + { + return $this->render('about'); + } + + /** + * Signs user up. + * + * @return mixed + */ + public function actionSignup() + { + $model = new SignupForm(); + if ($model->load(Yii::$app->request->post())) { + if ($user = $model->signup()) { + if (Yii::$app->getUser() + ->login($user)) { + return $this->goHome(); + } + } } + + return $this->render( + 'signup', + [ + 'model' => $model, + ] + ); } - - return $this->render('requestPasswordResetToken', [ - 'model' => $model, - ]); - } - - /** - * Resets password. - * - * @param string $token - * @return mixed - * @throws BadRequestHttpException - */ - public function actionResetPassword($token) - { - try { - $model = new ResetPasswordForm($token); - } catch (InvalidParamException $e) { - throw new BadRequestHttpException($e->getMessage()); + + /** + * Requests password reset. + * + * @return mixed + */ + public function actionRequestPasswordReset() + { + $model = new PasswordResetRequestForm(); + if ($model->load(Yii::$app->request->post()) && $model->validate()) { + if ($model->sendEmail()) { + Yii::$app->session->setFlash('success', 'Check your email for further instructions.'); + + return $this->goHome(); + } else { + Yii::$app->session->setFlash( + 'error', + 'Sorry, we are unable to reset password for the provided email address.' + ); + } + } + + return $this->render( + 'requestPasswordResetToken', + [ + 'model' => $model, + ] + ); } - - if ($model->load(Yii::$app->request->post()) && $model->validate() && $model->resetPassword()) { - Yii::$app->session->setFlash('success', 'New password saved.'); - - return $this->goHome(); + + /** + * Resets password. + * + * @param string $token + * + * @return mixed + * @throws BadRequestHttpException + */ + public function actionResetPassword($token) + { + try { + $model = new ResetPasswordForm($token); + } catch (InvalidParamException $e) { + throw new BadRequestHttpException($e->getMessage()); + } + + if ($model->load(Yii::$app->request->post()) && $model->validate() && $model->resetPassword()) { + Yii::$app->session->setFlash('success', 'New password saved.'); + + return $this->goHome(); + } + + return $this->render( + 'resetPassword', + [ + 'model' => $model, + ] + ); } - - return $this->render('resetPassword', [ - 'model' => $model, - ]); } -} diff --git a/frontend/views/layouts/main.php b/frontend/views/layouts/main.php index f4beaf5..aab7854 100644 --- a/frontend/views/layouts/main.php +++ b/frontend/views/layouts/main.php @@ -1,83 +1,81 @@ registerJs($js, View::POS_READY); -/* @var $this \yii\web\View */ -/* @var $content string */ - -use yii\helpers\Html; -use yii\bootstrap\Nav; -use yii\bootstrap\NavBar; -use yii\widgets\Breadcrumbs; -use frontend\assets\AppAsset; -use common\widgets\Alert; - -AppAsset::register($this); ?> beginPage() ?> -
+ - = Html::csrfMetaTags() ?> + = Html::csrfMetaTags() ?>You have successfully created your Yii-powered application.
- - -Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et - dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip - ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu - fugiat nulla pariatur.
- - -Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et - dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip - ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu - fugiat nulla pariatur.
- - -Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et - dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip - ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu - fugiat nulla pariatur.
- - -Company | +Status | +Duration | +
---|---|---|
= $call->company ?> | += $call->status ?> | += $call->duration ?> | +