Костяк
0 parents
Showing
84 changed files
with
2960 additions
and
0 deletions
.bowerrc
0 → 100644
.gitignore
0 → 100644
LICENSE.md
0 → 100644
README.md
0 → 100644
Vagrantfile
0 → 100644
assets/AdminAsset.php
0 → 100644
| <?php | ||
| /** | ||
| * @link http://www.yiiframework.com/ | ||
| * @copyright Copyright (c) 2008 Yii Software LLC | ||
| * @license http://www.yiiframework.com/license/ | ||
| */ | ||
| namespace app\assets; | ||
| use yii\web\AssetBundle; | ||
| /** | ||
| * Main application asset bundle. | ||
| * | ||
| * @author Qiang Xue <[email protected]> | ||
| * @since 2.0 | ||
| */ | ||
| class AdminAsset extends AssetBundle | ||
| { | ||
| public $basePath = '@webroot'; | ||
| public $baseUrl = '@web'; | ||
| public $css = ['css/admin.css']; | ||
| public $js = ['js/chosen.jquery.min.js']; | ||
| public $depends = [ | ||
| 'yii\web\YiiAsset', | ||
| 'yii\bootstrap\BootstrapAsset', | ||
| ]; | ||
| } |
assets/AppAsset.php
0 → 100644
| <?php | ||
| /** | ||
| * @link http://www.yiiframework.com/ | ||
| * @copyright Copyright (c) 2008 Yii Software LLC | ||
| * @license http://www.yiiframework.com/license/ | ||
| */ | ||
| namespace app\assets; | ||
| use yii\web\AssetBundle; | ||
| /** | ||
| * Main application asset bundle. | ||
| * | ||
| * @author Qiang Xue <[email protected]> | ||
| * @since 2.0 | ||
| */ | ||
| class AppAsset extends AssetBundle | ||
| { | ||
| public $basePath = '@webroot'; | ||
| public $baseUrl = '@web'; | ||
| public $css = [ | ||
| "//fonts.googleapis.com/css?family=Roboto+Condensed:300,300i,400,400i,700,700i", | ||
| "//fonts.googleapis.com/css?family=Dosis:200,300,400,500,600,700", | ||
| //"/css/font-awesome.min.css", | ||
| //"/css/ionicons.min.css", | ||
| //"/css/Pe-icon-7-stroke.min.css", | ||
| "/css/owl.carousel.min.css", | ||
| // "/css/slick-theme.css", | ||
| // "/css/slick.css", | ||
| "/css/animation.css", | ||
| //"/css/bootstrap-select.min.css", | ||
| "/css/styles.css", | ||
| ]; | ||
| public $js = [ | ||
| '/app.js', | ||
| // "js/vit-gallery.js", | ||
| // "js/jquery.countTo.js", | ||
| // "js/jquery.appear.min.js", | ||
| // "js/isotope.pkgd.min.js", | ||
| // "js/bootstrap-select.js", | ||
| // "js/jquery.littlelightbox.js", | ||
| ]; | ||
| public $depends = [ | ||
| 'yii\web\YiiAsset', | ||
| 'yii\bootstrap\BootstrapAsset', | ||
| ]; | ||
| } |
assets/MainAsset.php
0 → 100644
| <?php | ||
| /** | ||
| * @link http://www.yiiframework.com/ | ||
| * @copyright Copyright (c) 2008 Yii Software LLC | ||
| * @license http://www.yiiframework.com/license/ | ||
| */ | ||
| namespace app\assets; | ||
| use yii\web\AssetBundle; | ||
| /** | ||
| * Main application asset bundle. | ||
| * | ||
| * @author Qiang Xue <[email protected]> | ||
| * @since 2.0 | ||
| */ | ||
| class MainAsset extends AssetBundle | ||
| { | ||
| public $basePath = '@webroot'; | ||
| public $baseUrl = '@web'; | ||
| public $css = [ | ||
| //'css/site.css', | ||
| ]; | ||
| public $js = [ | ||
| "/js/owl.carousel.min.js", | ||
| "/js/slick.min.js", | ||
| "/js/function.js" | ||
| ]; | ||
| public $depends = [ | ||
| 'yii\web\YiiAsset', | ||
| 'yii\bootstrap\BootstrapAsset', | ||
| ]; | ||
| } |
codeception.yml
0 → 100644
commands/HelloController.php
0 → 100644
| <?php | ||
| /** | ||
| * @link http://www.yiiframework.com/ | ||
| * @copyright Copyright (c) 2008 Yii Software LLC | ||
| * @license http://www.yiiframework.com/license/ | ||
| */ | ||
| namespace app\commands; | ||
| use yii\console\Controller; | ||
| use yii\console\ExitCode; | ||
| /** | ||
| * This command echoes the first argument that you have entered. | ||
| * | ||
| * This command is provided as an example for you to learn how to create console commands. | ||
| * | ||
| * @author Qiang Xue <[email protected]> | ||
| * @since 2.0 | ||
| */ | ||
| class HelloController extends Controller | ||
| { | ||
| /** | ||
| * This command echoes what you have entered as the message. | ||
| * @param string $message the message to be echoed. | ||
| * @return int Exit code | ||
| */ | ||
| public function actionIndex($message = 'hello world') | ||
| { | ||
| echo $message . "\n"; | ||
| return ExitCode::OK; | ||
| } | ||
| } |
commands/RbacController.php
0 → 100644
composer.json
0 → 100644
composer.lock
0 → 100644
This diff could not be displayed because it is too large.
config/console.php
0 → 100644
config/db.php
0 → 100644
config/params.php
0 → 100644
| <?php | ||
| return [ | ||
| 'adminEmail' => '[email protected]', | ||
| 'senderEmail' => '[email protected]', | ||
| 'senderName' => 'Example.com mailer', | ||
| ]; |
config/test.php
0 → 100644
config/test_db.php
0 → 100644
config/web.php
0 → 100644
controllers/AuthController.php
0 → 100644
controllers/SiteController.php
0 → 100644
docker-compose.yml
0 → 100644
mail/layouts/html.php
0 → 100644
migrations/m191025_123812_user.php
0 → 100644
models/ContactForm.php
0 → 100644
models/Image.php
0 → 100644
models/LoginForm.php
0 → 100644
models/Plant.php
0 → 100644
models/PlantImage.php
0 → 100644
models/PlantSearch.php
0 → 100644
models/User.php
0 → 100644
modules/admin/Module.php
0 → 100644
modules/admin/views/default/index.php
0 → 100644
modules/admin/views/layouts/admin.php
0 → 100644
requirements.php
0 → 100644
runtime/.gitignore
0 → 100644
tests/_bootstrap.php
0 → 100644
tests/_data/.gitkeep
0 → 100644
tests/_output/.gitignore
0 → 100644
tests/_support/AcceptanceTester.php
0 → 100644
tests/_support/FunctionalTester.php
0 → 100644
tests/_support/UnitTester.php
0 → 100644
tests/acceptance.suite.yml.example
0 → 100644
tests/acceptance/AboutCest.php
0 → 100644
tests/acceptance/ContactCest.php
0 → 100644
| <?php | ||
| use yii\helpers\Url; | ||
| class ContactCest | ||
| { | ||
| public function _before(\AcceptanceTester $I) | ||
| { | ||
| $I->amOnPage(Url::toRoute('/site/contact')); | ||
| } | ||
| public function contactPageWorks(AcceptanceTester $I) | ||
| { | ||
| $I->wantTo('ensure that contact page works'); | ||
| $I->see('Contact', 'h1'); | ||
| } | ||
| public function contactFormCanBeSubmitted(AcceptanceTester $I) | ||
| { | ||
| $I->amGoingTo('submit contact form with correct data'); | ||
| $I->fillField('#contactform-name', 'tester'); | ||
| $I->fillField('#contactform-email', '[email protected]'); | ||
| $I->fillField('#contactform-subject', 'test subject'); | ||
| $I->fillField('#contactform-body', 'test content'); | ||
| $I->fillField('#contactform-verifycode', 'testme'); | ||
| $I->click('contact-button'); | ||
| $I->wait(2); // wait for button to be clicked | ||
| $I->dontSeeElement('#contact-form'); | ||
| $I->see('Thank you for contacting us. We will respond to you as soon as possible.'); | ||
| } | ||
| } |
tests/acceptance/HomeCest.php
0 → 100644
tests/acceptance/LoginCest.php
0 → 100644
tests/acceptance/_bootstrap.php
0 → 100644
tests/bin/yii
0 → 100644
tests/bin/yii.bat
0 → 100644
| @echo off | ||
| rem ------------------------------------------------------------- | ||
| rem Yii command line bootstrap script for Windows. | ||
| rem | ||
| rem @author Qiang Xue <[email protected]> | ||
| rem @link http://www.yiiframework.com/ | ||
| rem @copyright Copyright (c) 2008 Yii Software LLC | ||
| rem @license http://www.yiiframework.com/license/ | ||
| rem ------------------------------------------------------------- | ||
| @setlocal | ||
| set YII_PATH=%~dp0 | ||
| if "%PHP_COMMAND%" == "" set PHP_COMMAND=php.exe | ||
| "%PHP_COMMAND%" "%YII_PATH%yii" %* | ||
| @endlocal |
tests/functional.suite.yml
0 → 100644
tests/functional/ContactFormCest.php
0 → 100644
| <?php | ||
| class ContactFormCest | ||
| { | ||
| public function _before(\FunctionalTester $I) | ||
| { | ||
| $I->amOnPage(['site/contact']); | ||
| } | ||
| public function openContactPage(\FunctionalTester $I) | ||
| { | ||
| $I->see('Contact', 'h1'); | ||
| } | ||
| public function submitEmptyForm(\FunctionalTester $I) | ||
| { | ||
| $I->submitForm('#contact-form', []); | ||
| $I->expectTo('see validations errors'); | ||
| $I->see('Contact', 'h1'); | ||
| $I->see('Name cannot be blank'); | ||
| $I->see('Email cannot be blank'); | ||
| $I->see('Subject cannot be blank'); | ||
| $I->see('Body cannot be blank'); | ||
| $I->see('The verification code is incorrect'); | ||
| } | ||
| public function submitFormWithIncorrectEmail(\FunctionalTester $I) | ||
| { | ||
| $I->submitForm('#contact-form', [ | ||
| 'ContactForm[name]' => 'tester', | ||
| 'ContactForm[email]' => 'tester.email', | ||
| 'ContactForm[subject]' => 'test subject', | ||
| 'ContactForm[body]' => 'test content', | ||
| 'ContactForm[verifyCode]' => 'testme', | ||
| ]); | ||
| $I->expectTo('see that email address is wrong'); | ||
| $I->dontSee('Name cannot be blank', '.help-inline'); | ||
| $I->see('Email is not a valid email address.'); | ||
| $I->dontSee('Subject cannot be blank', '.help-inline'); | ||
| $I->dontSee('Body cannot be blank', '.help-inline'); | ||
| $I->dontSee('The verification code is incorrect', '.help-inline'); | ||
| } | ||
| public function submitFormSuccessfully(\FunctionalTester $I) | ||
| { | ||
| $I->submitForm('#contact-form', [ | ||
| 'ContactForm[name]' => 'tester', | ||
| 'ContactForm[email]' => '[email protected]', | ||
| 'ContactForm[subject]' => 'test subject', | ||
| 'ContactForm[body]' => 'test content', | ||
| 'ContactForm[verifyCode]' => 'testme', | ||
| ]); | ||
| $I->seeEmailIsSent(); | ||
| $I->dontSeeElement('#contact-form'); | ||
| $I->see('Thank you for contacting us. We will respond to you as soon as possible.'); | ||
| } | ||
| } |
tests/functional/LoginFormCest.php
0 → 100644
tests/functional/_bootstrap.php
0 → 100644
tests/unit.suite.yml
0 → 100644
tests/unit/_bootstrap.php
0 → 100644
tests/unit/models/ContactFormTest.php
0 → 100644
| <?php | ||
| namespace tests\unit\models; | ||
| use app\models\ContactForm; | ||
| use yii\mail\MessageInterface; | ||
| class ContactFormTest extends \Codeception\Test\Unit | ||
| { | ||
| private $model; | ||
| /** | ||
| * @var \UnitTester | ||
| */ | ||
| public $tester; | ||
| public function testEmailIsSentOnContact() | ||
| { | ||
| /** @var ContactForm $model */ | ||
| $this->model = $this->getMockBuilder('app\models\ContactForm') | ||
| ->setMethods(['validate']) | ||
| ->getMock(); | ||
| $this->model->expects($this->once()) | ||
| ->method('validate') | ||
| ->willReturn(true); | ||
| $this->model->attributes = [ | ||
| 'name' => 'Tester', | ||
| 'email' => '[email protected]', | ||
| 'subject' => 'very important letter subject', | ||
| 'body' => 'body of current message', | ||
| ]; | ||
| expect_that($this->model->contact('[email protected]')); | ||
| // using Yii2 module actions to check email was sent | ||
| $this->tester->seeEmailIsSent(); | ||
| /** @var MessageInterface $emailMessage */ | ||
| $emailMessage = $this->tester->grabLastSentEmail(); | ||
| expect('valid email is sent', $emailMessage)->isInstanceOf('yii\mail\MessageInterface'); | ||
| expect($emailMessage->getTo())->hasKey('[email protected]'); | ||
| expect($emailMessage->getFrom())->hasKey('[email protected]'); | ||
| expect($emailMessage->getReplyTo())->hasKey('[email protected]'); | ||
| expect($emailMessage->getSubject())->equals('very important letter subject'); | ||
| expect($emailMessage->toString())->contains('body of current message'); | ||
| } | ||
| } |
tests/unit/models/LoginFormTest.php
0 → 100644
tests/unit/models/UserTest.php
0 → 100644
vagrant/config/.gitignore
0 → 100644
vagrant/config/vagrant-local.example.yml
0 → 100644
vagrant/nginx/app.conf
0 → 100644
vagrant/nginx/log/.gitignore
0 → 100644
vagrant/provision/always-as-root.sh
0 → 100644
vagrant/provision/once-as-root.sh
0 → 100644
vagrant/provision/once-as-vagrant.sh
0 → 100644
views/admin/index.php
0 → 100644
views/auth/login.php
0 → 100644
views/layouts/main.php
0 → 100644
views/site/about.php
0 → 100644
views/site/contact.php
0 → 100644
views/site/error.php
0 → 100644
views/site/index.php
0 → 100644
views/site/login.php
0 → 100644
web/.htaccess
0 → 100644
web/assets/.gitignore
0 → 100644
web/favicon.ico
0 → 100644
No preview for this file type
web/index-test.php
0 → 100644
web/index.php
0 → 100644
web/robots.txt
0 → 100644
widgets/Alert.php
0 → 100644
| <?php | ||
| namespace app\widgets; | ||
| use Yii; | ||
| /** | ||
| * Alert widget renders a message from session flash. All flash messages are displayed | ||
| * in the sequence they were assigned using setFlash. You can set message as following: | ||
| * | ||
| * ```php | ||
| * Yii::$app->session->setFlash('error', 'This is the message'); | ||
| * Yii::$app->session->setFlash('success', 'This is the message'); | ||
| * Yii::$app->session->setFlash('info', 'This is the message'); | ||
| * ``` | ||
| * | ||
| * Multiple messages could be set as follows: | ||
| * | ||
| * ```php | ||
| * Yii::$app->session->setFlash('error', ['Error 1', 'Error 2']); | ||
| * ``` | ||
| * | ||
| * @author Kartik Visweswaran <[email protected]> | ||
| * @author Alexander Makarov <[email protected]> | ||
| */ | ||
| class Alert extends \yii\bootstrap\Widget | ||
| { | ||
| /** | ||
| * @var array the alert types configuration for the flash messages. | ||
| * This array is setup as $key => $value, where: | ||
| * - key: the name of the session flash variable | ||
| * - value: the bootstrap alert type (i.e. danger, success, info, warning) | ||
| */ | ||
| public $alertTypes = [ | ||
| 'error' => 'alert-danger', | ||
| 'danger' => 'alert-danger', | ||
| 'success' => 'alert-success', | ||
| 'info' => 'alert-info', | ||
| 'warning' => 'alert-warning' | ||
| ]; | ||
| /** | ||
| * @var array the options for rendering the close button tag. | ||
| * Array will be passed to [[\yii\bootstrap\Alert::closeButton]]. | ||
| */ | ||
| public $closeButton = []; | ||
| /** | ||
| * {@inheritdoc} | ||
| */ | ||
| public function run() | ||
| { | ||
| $session = Yii::$app->session; | ||
| $flashes = $session->getAllFlashes(); | ||
| $appendClass = isset($this->options['class']) ? ' ' . $this->options['class'] : ''; | ||
| foreach ($flashes as $type => $flash) { | ||
| if (!isset($this->alertTypes[$type])) { | ||
| continue; | ||
| } | ||
| foreach ((array) $flash as $i => $message) { | ||
| echo \yii\bootstrap\Alert::widget([ | ||
| 'body' => $message, | ||
| 'closeButton' => $this->closeButton, | ||
| 'options' => array_merge($this->options, [ | ||
| 'id' => $this->getId() . '-' . $type . '-' . $i, | ||
| 'class' => $this->alertTypes[$type] . $appendClass, | ||
| ]), | ||
| ]); | ||
| } | ||
| $session->removeFlash($type); | ||
| } | ||
| } | ||
| } |
yii
0 → 100644
yii.bat
0 → 100644
| @echo off | ||
| rem ------------------------------------------------------------- | ||
| rem Yii command line bootstrap script for Windows. | ||
| rem | ||
| rem @author Qiang Xue <[email protected]> | ||
| rem @link http://www.yiiframework.com/ | ||
| rem @copyright Copyright (c) 2008 Yii Software LLC | ||
| rem @license http://www.yiiframework.com/license/ | ||
| rem ------------------------------------------------------------- | ||
| @setlocal | ||
| set YII_PATH=%~dp0 | ||
| if "%PHP_COMMAND%" == "" set PHP_COMMAND=php.exe | ||
| "%PHP_COMMAND%" "%YII_PATH%yii" %* | ||
| @endlocal |
-
Please register or sign in to post a comment