Commit cea5c45dcdb0d427531ab41bf74f4fcd6acc216f
1 parent
3da83322
21.03.16 Versrka
Showing
17 changed files
with
654 additions
and
287 deletions
Show diff stats
common/models/Customers.php
| ... | ... | @@ -58,6 +58,22 @@ class Customers extends User |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | /** |
| 61 | + * Finds user by email | |
| 62 | + * | |
| 63 | + * @param string $email | |
| 64 | + * @return static|null | |
| 65 | + */ | |
| 66 | + public static function findByEmail($email) | |
| 67 | + { | |
| 68 | + return static::findOne(['email' => $email, 'status' => self::STATUS_ACTIVE]); | |
| 69 | + } | |
| 70 | + | |
| 71 | + public function getName(){ | |
| 72 | + return $this->username. ' '.$this->surname; | |
| 73 | + } | |
| 74 | + | |
| 75 | + | |
| 76 | + /** | |
| 61 | 77 | * @inheritdoc |
| 62 | 78 | */ |
| 63 | 79 | public function attributeLabels() | ... | ... |
common/models/LoginForm.php
| ... | ... | @@ -9,9 +9,9 @@ use yii\base\Model; |
| 9 | 9 | */ |
| 10 | 10 | class LoginForm extends Model |
| 11 | 11 | { |
| 12 | - public $username; | |
| 13 | 12 | public $password; |
| 14 | 13 | public $rememberMe = true; |
| 14 | + public $email; | |
| 15 | 15 | |
| 16 | 16 | private $_user; |
| 17 | 17 | |
| ... | ... | @@ -23,7 +23,7 @@ class LoginForm extends Model |
| 23 | 23 | { |
| 24 | 24 | return [ |
| 25 | 25 | // username and password are both required |
| 26 | - [['username', 'password'], 'required'], | |
| 26 | + [['email', 'password'], 'required'], | |
| 27 | 27 | // rememberMe must be a boolean value |
| 28 | 28 | ['rememberMe', 'boolean'], |
| 29 | 29 | // password is validated by validatePassword() |
| ... | ... | @@ -70,9 +70,19 @@ class LoginForm extends Model |
| 70 | 70 | protected function getUser() |
| 71 | 71 | { |
| 72 | 72 | if ($this->_user === null) { |
| 73 | - $this->_user = User::findByUsername($this->username); | |
| 73 | + $this->_user = Customers::findByEmail($this->email); | |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | return $this->_user; |
| 77 | 77 | } |
| 78 | + | |
| 79 | + /** | |
| 80 | + * @inheritdoc | |
| 81 | + */ | |
| 82 | + public function attributeLabels() | |
| 83 | + { | |
| 84 | + return [ | |
| 85 | + 'rememberMe' => Yii::t('app', 'rememberMe'), | |
| 86 | + ]; | |
| 87 | + } | |
| 78 | 88 | } | ... | ... |
| 1 | +<?php | |
| 2 | +return [ | |
| 3 | + 'id' => 'ID', | |
| 4 | + 'username' => 'Имя', | |
| 5 | + 'surname' => 'Фамилия', | |
| 6 | + 'auth_key' => 'Auth Key', | |
| 7 | + 'password_hash' => 'Password Hash', | |
| 8 | + 'password_reset_token' => 'Password Reset Token', | |
| 9 | + 'email' => 'Логин (e-mail)', | |
| 10 | + 'phone' => 'Телефон', | |
| 11 | + 'status' => 'Status', | |
| 12 | + 'created_at' => 'Created At', | |
| 13 | + 'updated_at' => 'Updated At', | |
| 14 | + 'verifyCode' => 'Код проверки', | |
| 15 | + 'password' => 'Пароль', | |
| 16 | + 'password_repeat' => 'Повторить пароль', | |
| 17 | + 'registration' => 'Регистрация', | |
| 18 | + 'message' => 'Этот {field} уже занят', | |
| 19 | + 'message_match_password' => 'Пароли не совпадают', | |
| 20 | + 'exit' => 'Выход', | |
| 21 | + 'enter' => 'Войти', | |
| 22 | + 'your_personal_area' => 'Вход в личный кабинет', | |
| 23 | + 'forgot_password' => 'Забыли пароль?', | |
| 24 | + 'rememberMe' => 'Запомнить меня', | |
| 25 | +]; | |
| 0 | 26 | \ No newline at end of file | ... | ... |
console/migrations/m160320_174258_customer.php
| ... | ... | @@ -14,7 +14,7 @@ class m160320_174258_customer extends Migration |
| 14 | 14 | |
| 15 | 15 | $this->createTable('{{%customers}}', [ |
| 16 | 16 | 'id' => $this->primaryKey(), |
| 17 | - 'username' => $this->string()->notNull()->unique(), | |
| 17 | + 'username' => $this->string()->notNull(), | |
| 18 | 18 | 'surname' => $this->string(), |
| 19 | 19 | 'auth_key' => $this->string(32)->notNull(), |
| 20 | 20 | 'password_hash' => $this->string()->notNull(), | ... | ... |
| 1 | +<?php | |
| 2 | + | |
| 3 | +use yii\db\Migration; | |
| 4 | + | |
| 5 | +class m160321_232402_orders extends Migration | |
| 6 | +{ | |
| 7 | + public function up() | |
| 8 | + { | |
| 9 | + $tableOptions = null; | |
| 10 | + if ($this->db->driverName === 'mysql') { | |
| 11 | + // http://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci | |
| 12 | + $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB'; | |
| 13 | + } | |
| 14 | + | |
| 15 | + $this->createTable('{{%orders}}', [ | |
| 16 | + 'id' => $this->primaryKey(), | |
| 17 | + 'name' => $this->string()->notNull(), | |
| 18 | + 'email' => $this->string()->notNull(), | |
| 19 | + 'phone' => $this->string(32)->notNull(), | |
| 20 | + 'delivery' => $this->integer(), | |
| 21 | + 'payment' => $this->integer(), | |
| 22 | + 'code' => $this->string(), | |
| 23 | + 'status' => $this->smallInteger(), | |
| 24 | + 'created_at' => $this->integer()->notNull(), | |
| 25 | + 'updated_at' => $this->integer()->notNull(), | |
| 26 | + ], $tableOptions); | |
| 27 | + } | |
| 28 | + | |
| 29 | + public function down() | |
| 30 | + { | |
| 31 | + $this->dropTable('{{%orders}}'); | |
| 32 | + } | |
| 33 | + | |
| 34 | +} | ... | ... |
| 1 | +<?php | |
| 2 | + | |
| 3 | +namespace frontend\controllers; | |
| 4 | + | |
| 5 | +use Yii; | |
| 6 | + | |
| 7 | +use yii\web\Controller; | |
| 8 | +use yii\web\NotFoundHttpException; | |
| 9 | +use yii\data\ArrayDataProvider; | |
| 10 | +/** | |
| 11 | + * OrderController implements the CRUD actions for Order model. | |
| 12 | + */ | |
| 13 | +class OrderController extends Controller | |
| 14 | +{ | |
| 15 | + | |
| 16 | + public $layout='/column2'; | |
| 17 | + | |
| 18 | + /** | |
| 19 | + * Lists all Order models. | |
| 20 | + * @return mixed | |
| 21 | + */ | |
| 22 | + public function actionIndex() | |
| 23 | + { | |
| 24 | + | |
| 25 | + if (Yii::$app->request->post()) { | |
| 26 | + $item = $items_id = array(); | |
| 27 | + | |
| 28 | + $i = 0; | |
| 29 | + $order = Yii::$app->request->post(); | |
| 30 | + | |
| 31 | + $orderData['Order'] = $order['OrderForm']; | |
| 32 | + | |
| 33 | + foreach($order['OrderForm']['one_item'] as $k => $v ){ | |
| 34 | + $item[$k]['num'] = $v['num']; | |
| 35 | + $items_id[] = $k; | |
| 36 | + $i++; | |
| 37 | + } | |
| 38 | + | |
| 39 | + $items = Items::find()->where(['id'=>$items_id])->all(); | |
| 40 | + | |
| 41 | + | |
| 42 | + $orderModel = new Order(); | |
| 43 | + $orderModel->load($orderData); | |
| 44 | + $orderModel->save(); | |
| 45 | + | |
| 46 | + | |
| 47 | + foreach($items as $one_item){ | |
| 48 | + $ItemOrderModel = new ItemOrder(); | |
| 49 | + $ItemOrderModel->order_id = $orderModel->id; | |
| 50 | + $ItemOrderModel->num = $item[$one_item->id]['num']; | |
| 51 | + $ItemOrderModel->item_id = $one_item->id; | |
| 52 | + $ItemOrderModel->price = $one_item->price * $item[$one_item->id]['num']; | |
| 53 | + $ItemOrderModel->item_name = $one_item->name; | |
| 54 | + $ItemOrderModel->save(); | |
| 55 | + } | |
| 56 | + Yii::$app->session->set('order', [] ); | |
| 57 | + return $this->redirect(['order/complete']); | |
| 58 | + } | |
| 59 | + $total_price = 0; | |
| 60 | + | |
| 61 | + $items_id = []; | |
| 62 | + | |
| 63 | + $orders = Yii::$app->session->get('order'); | |
| 64 | + | |
| 65 | + if(!empty($orders)){ | |
| 66 | + foreach($orders as $k => $v) { | |
| 67 | + $items_id[] = $k; | |
| 68 | + } | |
| 69 | + } | |
| 70 | + | |
| 71 | + | |
| 72 | + $items = Items::find()->where(['id'=>$items_id])->all(); | |
| 73 | + | |
| 74 | + foreach($items as $item) { | |
| 75 | + $total_price += $orders[$item['id']]['num'] * $item['price']; | |
| 76 | + } | |
| 77 | + | |
| 78 | + | |
| 79 | + $dataProvider = new ArrayDataProvider([ | |
| 80 | + 'allModels' => $items | |
| 81 | + ]); | |
| 82 | + | |
| 83 | + return $this->render('index', [ | |
| 84 | + 'dataProvider' => $dataProvider, | |
| 85 | + 'total_price'=> $total_price, | |
| 86 | + 'model' => new OrderForm() | |
| 87 | + ]); | |
| 88 | + } | |
| 89 | + | |
| 90 | + | |
| 91 | + public function actionComplete() | |
| 92 | + { | |
| 93 | + return $this->render('complete', [ | |
| 94 | + ]); | |
| 95 | + } | |
| 96 | + | |
| 97 | + public function actionBuyItems(){ | |
| 98 | + $data = Yii::$app->request->post(); | |
| 99 | + $sessionData = Yii::$app->session->get('order'); | |
| 100 | + if(isset($sessionData) && !array_search($data['id'],Yii::$app->session->get('order')) ){ | |
| 101 | + $array = Yii::$app->session->get('order'); | |
| 102 | + $array[$data['id']] = $data; | |
| 103 | + Yii::$app->session->set('order', $array ); | |
| 104 | + } else { | |
| 105 | + $array[$data['id']] = $data; | |
| 106 | + Yii::$app->session->set('order', $array ); | |
| 107 | + } | |
| 108 | + echo count(Yii::$app->session->get('order')); | |
| 109 | + | |
| 110 | + } | |
| 111 | + /** | |
| 112 | + * Displays a single Order model. | |
| 113 | + * @param integer $id | |
| 114 | + * @return mixed | |
| 115 | + */ | |
| 116 | + public function actionView($id) | |
| 117 | + { | |
| 118 | + return $this->render('view', [ | |
| 119 | + 'model' => $this->findModel($id), | |
| 120 | + ]); | |
| 121 | + } | |
| 122 | + | |
| 123 | + /** | |
| 124 | + * Creates a new Order model. | |
| 125 | + * If creation is successful, the browser will be redirected to the 'view' page. | |
| 126 | + * @return mixed | |
| 127 | + */ | |
| 128 | + public function actionCreate() | |
| 129 | + { | |
| 130 | + $model = new Order(); | |
| 131 | + | |
| 132 | + if ($model->load(Yii::$app->request->post()) && $model->save()) { | |
| 133 | + return $this->redirect(['view', 'id' => $model->id]); | |
| 134 | + } else { | |
| 135 | + return $this->render('create', [ | |
| 136 | + 'model' => $model, | |
| 137 | + ]); | |
| 138 | + } | |
| 139 | + } | |
| 140 | + | |
| 141 | + /** | |
| 142 | + * Updates an existing Order model. | |
| 143 | + * If update is successful, the browser will be redirected to the 'view' page. | |
| 144 | + * @param integer $id | |
| 145 | + * @return mixed | |
| 146 | + */ | |
| 147 | + public function actionUpdate($id) | |
| 148 | + { | |
| 149 | + $model = $this->findModel($id); | |
| 150 | + | |
| 151 | + if ($model->load(Yii::$app->request->post()) && $model->save()) { | |
| 152 | + return $this->redirect(['view', 'id' => $model->id]); | |
| 153 | + } else { | |
| 154 | + return $this->render('update', [ | |
| 155 | + 'model' => $model, | |
| 156 | + ]); | |
| 157 | + } | |
| 158 | + } | |
| 159 | + | |
| 160 | + /** | |
| 161 | + * Deletes an existing Order model. | |
| 162 | + * If deletion is successful, the browser will be redirected to the 'index' page. | |
| 163 | + * @param integer $id | |
| 164 | + * @return mixed | |
| 165 | + */ | |
| 166 | + public function actionDelete() | |
| 167 | + { | |
| 168 | + $data = Yii::$app->request->post(); | |
| 169 | + $sessionData = Yii::$app->session->get('order'); | |
| 170 | + unset($sessionData[$data['id']]); | |
| 171 | + Yii::$app->session->set('order', $sessionData); | |
| 172 | + return count(Yii::$app->session->get('order')); | |
| 173 | + } | |
| 174 | + | |
| 175 | + /** | |
| 176 | + * Finds the Order model based on its primary key value. | |
| 177 | + * If the model is not found, a 404 HTTP exception will be thrown. | |
| 178 | + * @param integer $id | |
| 179 | + * @return Order the loaded model | |
| 180 | + * @throws NotFoundHttpException if the model cannot be found | |
| 181 | + */ | |
| 182 | + protected function findModel($id) | |
| 183 | + { | |
| 184 | + if (($model = Order::findOne($id)) !== null) { | |
| 185 | + return $model; | |
| 186 | + } else { | |
| 187 | + throw new NotFoundHttpException('The requested page does not exist.'); | |
| 188 | + } | |
| 189 | + } | |
| 190 | +} | ... | ... |
frontend/controllers/PuttyController.php
| ... | ... | @@ -35,9 +35,6 @@ class PuttyController extends Controller |
| 35 | 35 | return $this->render('basket-step-02'); |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - public function actionCabinet(){ | |
| 39 | - return $this->render('cabinet'); | |
| 40 | - } | |
| 41 | 38 | |
| 42 | 39 | public function actionContacts(){ |
| 43 | 40 | return $this->render('contacts'); | ... | ... |
frontend/controllers/SiteController.php
| ... | ... | @@ -12,12 +12,15 @@ use yii\web\BadRequestHttpException; |
| 12 | 12 | use yii\web\Controller; |
| 13 | 13 | use yii\filters\VerbFilter; |
| 14 | 14 | use yii\filters\AccessControl; |
| 15 | +use yii\web\Response; | |
| 16 | +use yii\widgets\ActiveForm; | |
| 15 | 17 | |
| 16 | 18 | /** |
| 17 | 19 | * Site controller |
| 18 | 20 | */ |
| 19 | 21 | class SiteController extends Controller |
| 20 | 22 | { |
| 23 | + | |
| 21 | 24 | /** |
| 22 | 25 | * @inheritdoc |
| 23 | 26 | */ |
| ... | ... | @@ -52,6 +55,18 @@ class SiteController extends Controller |
| 52 | 55 | /** |
| 53 | 56 | * @inheritdoc |
| 54 | 57 | */ |
| 58 | + public function beforeAction($action) | |
| 59 | + { | |
| 60 | + if ($action->id == 'signup') { | |
| 61 | + Yii::$app->controller->enableCsrfValidation = false; | |
| 62 | + } | |
| 63 | + | |
| 64 | + return true; | |
| 65 | + } | |
| 66 | + | |
| 67 | + /** | |
| 68 | + * @inheritdoc | |
| 69 | + */ | |
| 55 | 70 | public function actions() |
| 56 | 71 | { |
| 57 | 72 | return [ |
| ... | ... | @@ -149,15 +164,23 @@ class SiteController extends Controller |
| 149 | 164 | */ |
| 150 | 165 | public function actionSignup() |
| 151 | 166 | { |
| 152 | - $model = new SignupForm(); | |
| 153 | - if ($model->load(Yii::$app->request->post())) { | |
| 154 | - if ($user = $model->signup()) { | |
| 155 | - if (Yii::$app->getUser()->login($user)) { | |
| 156 | - return $this->goHome(); | |
| 157 | - } | |
| 158 | - } | |
| 159 | - } | |
| 160 | 167 | |
| 168 | + if(Yii::$app->request->post()){ | |
| 169 | + if (Yii::$app->request->isAjax) { | |
| 170 | + Yii::$app->response->format = Response::FORMAT_JSON; | |
| 171 | + $model = new SignupForm(['scenario' => SignupForm::SCENARIO_AJAX]); | |
| 172 | + $model->load(Yii::$app->request->post()); | |
| 173 | + return ActiveForm::validate($model); | |
| 174 | + } else { | |
| 175 | + $model = new SignupForm(['scenario' => SignupForm::SCENARIO_SUBMIT]); | |
| 176 | + $model->load(Yii::$app->request->post()); | |
| 177 | + if ($user = $model->signup()) { | |
| 178 | + if (Yii::$app->getUser()->login($user)) { | |
| 179 | + return $this->goHome(); | |
| 180 | + } | |
| 181 | + } | |
| 182 | + } | |
| 183 | + } | |
| 161 | 184 | return $this->render('signup', [ |
| 162 | 185 | 'model' => $model, |
| 163 | 186 | ]); |
| ... | ... | @@ -211,4 +234,9 @@ class SiteController extends Controller |
| 211 | 234 | 'model' => $model, |
| 212 | 235 | ]); |
| 213 | 236 | } |
| 237 | + | |
| 238 | + | |
| 239 | + public function actionCabinet(){ | |
| 240 | + return $this->render('cabinet'); | |
| 241 | + } | |
| 214 | 242 | } | ... | ... |
frontend/models/SignupForm.php
| ... | ... | @@ -18,6 +18,8 @@ class SignupForm extends Model |
| 18 | 18 | public $surname; |
| 19 | 19 | public $phone; |
| 20 | 20 | |
| 21 | + const SCENARIO_AJAX = 'ajax'; | |
| 22 | + const SCENARIO_SUBMIT = 'submit'; | |
| 21 | 23 | |
| 22 | 24 | /** |
| 23 | 25 | * @inheritdoc |
| ... | ... | @@ -33,16 +35,38 @@ class SignupForm extends Model |
| 33 | 35 | ['email', 'required'], |
| 34 | 36 | ['email', 'email'], |
| 35 | 37 | [['email','phone'], 'string', 'max' => 255], |
| 36 | - ['email', 'unique', 'targetClass' => '\common\models\Customers', 'message' => 'This email address has already been taken.'], | |
| 38 | + ['email', 'unique', 'targetClass' => '\common\models\Customers', 'message' => Yii::t('app','message',[ | |
| 39 | + 'field' => 'Email' | |
| 40 | + ])], | |
| 37 | 41 | |
| 42 | + [['phone'], 'unique', 'targetClass' => '\common\models\Customers', 'message' => Yii::t('app','message',[ | |
| 43 | + 'field' => 'Телефон' | |
| 44 | + ])], | |
| 38 | 45 | |
| 39 | 46 | ['password_repeat', 'required'], |
| 40 | - ['password_repeat', 'compare', 'compareAttribute'=>'password', 'message'=>"Passwords don't match" ], | |
| 47 | + ['password_repeat', 'compare', 'compareAttribute'=>'password', 'message'=> Yii::t('app', 'message_match_password') ], | |
| 41 | 48 | |
| 42 | 49 | ['password', 'required'], |
| 43 | 50 | ['password', 'string', 'min' => 6], |
| 44 | 51 | |
| 45 | - ['verifyCode', 'captcha'], | |
| 52 | + [ | |
| 53 | + 'verifyCode', | |
| 54 | + 'safe', | |
| 55 | + 'on'=>[SignupForm::SCENARIO_AJAX] | |
| 56 | + ], | |
| 57 | + [ | |
| 58 | + 'verifyCode', | |
| 59 | + 'captcha', | |
| 60 | + 'on'=>[SignupForm::SCENARIO_SUBMIT] | |
| 61 | + ], | |
| 62 | + [ | |
| 63 | + 'verifyCode', | |
| 64 | + 'captcha', | |
| 65 | + 'on'=>[SignupForm::SCENARIO_DEFAULT] | |
| 66 | + ], | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 46 | 70 | ]; |
| 47 | 71 | } |
| 48 | 72 | |
| ... | ... | @@ -65,17 +89,18 @@ class SignupForm extends Model |
| 65 | 89 | public function signup() |
| 66 | 90 | { |
| 67 | 91 | |
| 68 | - | |
| 69 | 92 | if (!$this->validate()) { |
| 70 | 93 | return null; |
| 71 | 94 | } |
| 72 | 95 | |
| 73 | 96 | $user = new Customers(); |
| 74 | 97 | $user->username = $this->username; |
| 98 | + $user->surname = $this->surname; | |
| 75 | 99 | $user->email = $this->email; |
| 76 | 100 | $user->phone = $this->phone; |
| 77 | 101 | $user->setPassword($this->password); |
| 78 | 102 | $user->generateAuthKey(); |
| 103 | + $user->validate(); | |
| 79 | 104 | return $user->save() ? $user : null; |
| 80 | 105 | } |
| 81 | 106 | } | ... | ... |
frontend/views/layouts/main.php
| ... | ... | @@ -5,6 +5,8 @@ |
| 5 | 5 | |
| 6 | 6 | |
| 7 | 7 | use frontend\assets\AppAsset; |
| 8 | +use yii\helpers\Html; | |
| 9 | +use yii\helpers\Url; | |
| 8 | 10 | |
| 9 | 11 | |
| 10 | 12 | AppAsset::register($this); |
| ... | ... | @@ -35,15 +37,20 @@ AppAsset::register($this); |
| 35 | 37 | </div> |
| 36 | 38 | <div class="right_lineup"> |
| 37 | 39 | <ul> |
| 38 | - <li class="login_button_lu"><a href="#">Вход</a></li> | |
| 39 | - <li class="reg_button_lu"><a href="#">Регистрация</a></li> | |
| 40 | + <?php | |
| 41 | + if (Yii::$app->user->isGuest) { ?> | |
| 42 | + <li class="login_button_lu"><a href="#">Вход</a></li> | |
| 43 | + <li class="reg_button_lu"><a href="#">Регистрация</a></li> | |
| 44 | + <?php } else { ?> | |
| 45 | + <li class="user_button_lu"><?= Html::a( Yii::$app->user->identity->username , Url::toRoute(['site/cabinet'])); ?></li> | |
| 46 | + <?php } ?> | |
| 40 | 47 | </ul> |
| 41 | 48 | </div> |
| 42 | 49 | </div> |
| 43 | 50 | </div> |
| 44 | 51 | <div class="head"> |
| 45 | 52 | <div class="head_up"> |
| 46 | - <a href="#" class="head_up_cell bau_logo"><img src="/images/bau_logo.png" border="0"></a> | |
| 53 | + <?= Html::a(Html::img('/images/bau_logo.png',['border'=>'0']), ['/'],['class'=>'head_up_cell bau_logo'])?> | |
| 47 | 54 | <div class="head_up_cell srch"> |
| 48 | 55 | <div class="search_head"> |
| 49 | 56 | <div class="srch_head_desc">Введите запрос <a href="#">Шифер</a> <a href="#">Рубероид</a></div> | ... | ... |
frontend/views/modal/login_window_model_window.php
| 1 | +<?php | |
| 2 | + | |
| 3 | +/* @var $this yii\web\View */ | |
| 4 | +/* @var $form yii\bootstrap\ActiveForm */ | |
| 5 | +/* @var $model \common\models\LoginForm */ | |
| 6 | + | |
| 7 | +use common\models\LoginForm; | |
| 8 | +use yii\helpers\Html; | |
| 9 | +use yii\bootstrap\ActiveForm; | |
| 10 | +use yii\helpers\Url; | |
| 11 | + | |
| 12 | +$this->title = 'Login'; | |
| 13 | +$this->params['breadcrumbs'][] = $this->title; | |
| 14 | +?> | |
| 1 | 15 | <div class="modal_wrapper_login"> |
| 2 | 16 | <!-- <form name="login_form"> --> |
| 3 | 17 | <div class="modal_window"> |
| 4 | - <form> | |
| 5 | - <div class="modal_close_btn"></div> | |
| 6 | - <div class="title">Вход в личный кабинет</div> | |
| 7 | - <label>Логин<input type="text" required></label> | |
| 8 | - <label>Пароль <input type="password" required></label> | |
| 9 | - <div class="pass_links"> | |
| 10 | - <label><input type="checkbox" name="remember_password" value="0" /></label> | |
| 11 | - <span class="remember_pas">Запомнить меня</span> | |
| 12 | - <a href="#" class="forgot_pass_link">Забыли пароль?</a> | |
| 13 | - </div> | |
| 14 | - <div class="for_btn_position"><button class="my_cust_btn" type="submit">войти</button></div> | |
| 15 | - </form> | |
| 18 | + <?php $form = ActiveForm::begin([ | |
| 19 | + 'action'=>Url::toRoute('site/login'), | |
| 20 | + ]); ?> | |
| 21 | + <div class="title"><?= Yii::t('app', 'your_personal_area') ?></div> | |
| 22 | + <div class="modal_close_btn"></div> | |
| 23 | + <?= $form->field(new LoginForm(), 'email', | |
| 24 | + [ | |
| 25 | + 'template' => '<label>'.Yii::t('app', 'email').'{input}{error}{hint}</label>', | |
| 26 | + ] | |
| 27 | + )->textInput(['autofocus' => true]) ?> | |
| 28 | + | |
| 29 | + <?= $form->field(new LoginForm(), 'password', | |
| 30 | + [ | |
| 31 | + 'template' => '<label>'.Yii::t('app', 'password').'{input}{error}{hint}</label>', | |
| 32 | + ] | |
| 33 | + )->passwordInput() ?> | |
| 34 | + | |
| 35 | + | |
| 36 | + <div class="pass_links"> | |
| 37 | + <?= $form->field(new LoginForm(), 'rememberMe',[ | |
| 38 | + 'checkboxTemplate' => "{beginLabel}\n{input}\n{labelTitle}\n{endLabel}", | |
| 39 | + | |
| 40 | + ])->checkbox() ?> | |
| 41 | + | |
| 42 | + | |
| 43 | + <?= Html::a(Yii::t('app', 'forgot_password'), ['site/request-password-reset'],['class'=>'forgot_pass_link']) ?> | |
| 44 | + </div> | |
| 45 | + | |
| 46 | + <div class="for_btn_position"> | |
| 47 | + <?= Html::submitButton(Yii::t('app','enter'), ['class' => 'my_cust_btn', 'name' => 'login-button']) ?> | |
| 48 | + </div> | |
| 49 | + <?php ActiveForm::end(); ?> | |
| 16 | 50 | </div> |
| 17 | 51 | <!-- </form> --> |
| 18 | 52 | </div> |
| 19 | 53 | \ No newline at end of file | ... | ... |
frontend/views/modal/registration_window_model_window.php
| ... | ... | @@ -11,62 +11,50 @@ use yii\widgets\ActiveForm; |
| 11 | 11 | <!-- <form name="registration_form"> --> |
| 12 | 12 | <div class="modal_window"> |
| 13 | 13 | |
| 14 | - <?php $form = ActiveForm::begin(['action'=>Url::toRoute('site/signup')]); ?> | |
| 14 | + <?php $form = ActiveForm::begin([ | |
| 15 | + 'action'=>Url::toRoute('site/signup'), | |
| 16 | + ]); ?> | |
| 15 | 17 | |
| 16 | 18 | <div class="modal_close_btn"></div> |
| 17 | 19 | |
| 18 | - <div class="title">Регистрация</div> | |
| 20 | + <div class="title"><?= Yii::t('app', 'registration') ?></div> | |
| 19 | 21 | |
| 20 | - <?= $form->field(new SignupForm(), 'email',[ | |
| 21 | - 'template' => '<label>'.Yii::t('app', 'Email').'{input}{error}{hint}</label>', | |
| 22 | + <?= $form->field(new SignupForm(), 'email', ['enableAjaxValidation' => true, | |
| 23 | + 'template' => '<label>'.Yii::t('app', 'email').'{input}{error}{hint}</label>', | |
| 22 | 24 | ]) ?> |
| 23 | 25 | |
| 24 | 26 | <?= $form->field(new SignupForm(), 'password',[ |
| 25 | - 'template' => '<label>'.Yii::t('app', 'Password').'{input}{error}{hint}</label>', | |
| 27 | + 'template' => '<label>'.Yii::t('app', 'password').'{input}{error}{hint}</label>', | |
| 26 | 28 | ])->passwordInput() ?> |
| 27 | 29 | |
| 28 | 30 | <?= $form->field(new SignupForm(), 'password_repeat',[ |
| 29 | - 'template' => '<label>'.Yii::t('app', 'Password_repeat').'{input}{error}{hint}</label>', | |
| 31 | + 'template' => '<label>'.Yii::t('app', 'password_repeat').'{input}{error}{hint}</label>', | |
| 30 | 32 | ])->passwordInput() ?> |
| 31 | 33 | |
| 32 | 34 | <?= $form->field(new SignupForm(), 'username',[ |
| 33 | - 'template' => '<label>'.Yii::t('app', 'Username').'{input}{error}{hint}</label>', | |
| 34 | - ])->textInput(['autofocus' => true]) ?> | |
| 35 | + 'template' => '<label>'.Yii::t('app', 'username').'{input}{error}{hint}</label>', | |
| 36 | + ])->textInput() ?> | |
| 35 | 37 | |
| 36 | 38 | <?= $form->field(new SignupForm(), 'surname',[ |
| 37 | - 'template' => '<label>'.Yii::t('app', 'Surname').'{input}{error}{hint}</label>', | |
| 39 | + 'template' => '<label>'.Yii::t('app', 'surname').'{input}{error}{hint}</label>', | |
| 38 | 40 | ])->textInput() ?> |
| 39 | 41 | |
| 40 | - <?= $form->field(new SignupForm(), 'phone',[ | |
| 41 | - 'template' => '<label>'.Yii::t('app', 'Phone').'{input}{error}{hint}</label>', | |
| 42 | + <?= $form->field(new SignupForm(), 'phone', ['enableAjaxValidation' => true, | |
| 43 | + 'template' => '<label>'.Yii::t('app', 'phone').'{input}{error}{hint}</label>', | |
| 42 | 44 | ])->textInput() ?> |
| 43 | 45 | |
| 44 | 46 | |
| 45 | 47 | <?= $form->field(new SignupForm(), 'verifyCode')->widget(Captcha::className(), [ |
| 46 | - 'template' => '<label>Код проверки{image}{input}</label>', | |
| 48 | + 'template' => '<label>'.Yii::t('app', 'verifyCode').'{image}{input}</label>', | |
| 47 | 49 | ])->label(false) ?> |
| 48 | 50 | |
| 49 | 51 | |
| 50 | 52 | <div class="form-group"> |
| 51 | - <?= Html::submitButton('регистрация', ['class' => 'my_cust_btn', 'name' => 'signup-button']) ?> | |
| 53 | + <?= Html::submitButton(Yii::t('app', 'registration'), ['class' => 'my_cust_btn', 'name' => 'signup-button']) ?> | |
| 52 | 54 | </div> |
| 53 | 55 | |
| 54 | 56 | <?php ActiveForm::end(); ?> |
| 55 | -<!----> | |
| 56 | -<!-- <form>--> | |
| 57 | -<!-- <div class="modal_close_btn"></div>--> | |
| 58 | -<!-- <div class="title">Регистрация</div>--> | |
| 59 | -<!-- <label>Логин (e-mail)<input type="email" id="email_reg" required></label>--> | |
| 60 | -<!-- <label>Пароль <input type="password" id="pass_reg" required></label>--> | |
| 61 | -<!-- <label>Повторить пароль<input type="password" id="pass_reg_rep" required></label>--> | |
| 62 | -<!----> | |
| 63 | -<!-- <label>Имя<input type="text" required></label>--> | |
| 64 | -<!----> | |
| 65 | -<!-- <label>Фамилия<input type="text" required></label>--> | |
| 66 | -<!-- <label>Телефон<input type="text" id="phone_num_reg" required></label>--> | |
| 67 | -<!-- <label>Код проверки<img src="/images/modal_capcha.png" alt=""> <input type="text" required></label>--> | |
| 68 | -<!-- <div class="for_btn_position"><button class="my_cust_btn" type="submit">регистрация</button></div>--> | |
| 69 | -<!-- </form>--> | |
| 57 | + | |
| 70 | 58 | </div> |
| 71 | 59 | <!-- </form> --> |
| 72 | 60 | </div> |
| 73 | 61 | \ No newline at end of file | ... | ... |
frontend/views/putty/catalog.php
| ... | ... | @@ -386,7 +386,7 @@ $this->params['breadcrumbs'][] = $this->title; |
| 386 | 386 | <div class="content"> |
| 387 | 387 | <div class="novelty_cont"> |
| 388 | 388 | |
| 389 | - <div class="item"> | |
| 389 | + <div class="item" data-id="1"> | |
| 390 | 390 | <div class="new">АКЦИЯ</div> |
| 391 | 391 | <div class="top">Toп</div> |
| 392 | 392 | <a href="#" class="item_link"><div class="pic"><img src="/images/items/01.jpg"></div> |
| ... | ... | @@ -399,7 +399,7 @@ $this->params['breadcrumbs'][] = $this->title; |
| 399 | 399 | <img class="item_bottom_img" src="/images/nc_item_bottom.png" alt=""> |
| 400 | 400 | </div> |
| 401 | 401 | |
| 402 | - <div class="item"> | |
| 402 | + <div class="item" data-id="2"> | |
| 403 | 403 | <div class="new">АКЦИЯ</div> |
| 404 | 404 | <div class="top">Toп</div> |
| 405 | 405 | <a href="#" class="item_link"><div class="pic"><img src="/images/items/02.jpg"></div> |
| ... | ... | @@ -412,7 +412,7 @@ $this->params['breadcrumbs'][] = $this->title; |
| 412 | 412 | <img class="item_bottom_img" src="/images/nc_item_bottom.png" alt=""> |
| 413 | 413 | </div> |
| 414 | 414 | |
| 415 | - <div class="item"> | |
| 415 | + <div class="item" data-id="3"> | |
| 416 | 416 | <div class="new">АКЦИЯ</div> |
| 417 | 417 | <div class="top">Toп</div> |
| 418 | 418 | <a href="#" class="item_link"><div class="pic"><img src="/images/items/01.jpg"></div> |
| ... | ... | @@ -425,7 +425,7 @@ $this->params['breadcrumbs'][] = $this->title; |
| 425 | 425 | <img class="item_bottom_img" src="/images/nc_item_bottom.png" alt=""> |
| 426 | 426 | </div> |
| 427 | 427 | |
| 428 | - <div class="item"> | |
| 428 | + <div class="item" data-id="4"> | |
| 429 | 429 | <div class="new">АКЦИЯ</div> |
| 430 | 430 | <div class="top">Toп</div> |
| 431 | 431 | <a href="#" class="item_link"><div class="pic"><img src="/images/items/02.jpg"></div> |
| ... | ... | @@ -438,7 +438,7 @@ $this->params['breadcrumbs'][] = $this->title; |
| 438 | 438 | <img class="item_bottom_img" src="/images/nc_item_bottom.png" alt=""> |
| 439 | 439 | </div> |
| 440 | 440 | |
| 441 | - <div class="item"> | |
| 441 | + <div class="item" data-id="5"> | |
| 442 | 442 | <div class="new">АКЦИЯ</div> |
| 443 | 443 | <div class="top">Toп</div> |
| 444 | 444 | <a href="#" class="item_link"><div class="pic"><img src="/images/items/01.jpg"></div> |
| ... | ... | @@ -451,7 +451,7 @@ $this->params['breadcrumbs'][] = $this->title; |
| 451 | 451 | <img class="item_bottom_img" src="/images/nc_item_bottom.png" alt=""> |
| 452 | 452 | </div> |
| 453 | 453 | |
| 454 | - <div class="item"> | |
| 454 | + <div class="item" data-id="6" > | |
| 455 | 455 | <div class="new">АКЦИЯ</div> |
| 456 | 456 | <div class="top">Toп</div> |
| 457 | 457 | <a href="#" class="item_link"><div class="pic"><img src="/images/items/02.jpg"></div> |
| ... | ... | @@ -464,7 +464,7 @@ $this->params['breadcrumbs'][] = $this->title; |
| 464 | 464 | <img class="item_bottom_img" src="/images/nc_item_bottom.png" alt=""> |
| 465 | 465 | </div> |
| 466 | 466 | |
| 467 | - <div class="item"> | |
| 467 | + <div class="item" data-id="7"> | |
| 468 | 468 | <div class="new">АКЦИЯ</div> |
| 469 | 469 | <div class="top">Toп</div> |
| 470 | 470 | <a href="#" class="item_link"><div class="pic"><img src="/images/items/01.jpg"></div> |
| ... | ... | @@ -477,7 +477,7 @@ $this->params['breadcrumbs'][] = $this->title; |
| 477 | 477 | <img class="item_bottom_img" src="/images/nc_item_bottom.png" alt=""> |
| 478 | 478 | </div> |
| 479 | 479 | |
| 480 | - <div class="item"> | |
| 480 | + <div class="item" data-id="8"> | |
| 481 | 481 | <div class="new">АКЦИЯ</div> |
| 482 | 482 | <div class="top">Toп</div> |
| 483 | 483 | <a href="#" class="item_link"><div class="pic"><img src="/images/items/02.jpg"></div> |
| ... | ... | @@ -489,7 +489,7 @@ $this->params['breadcrumbs'][] = $this->title; |
| 489 | 489 | <a href="#" class="compare_add_but"><span>добавить к сравнению</span></a> |
| 490 | 490 | <img class="item_bottom_img" src="/images/nc_item_bottom.png" alt=""> |
| 491 | 491 | </div> |
| 492 | - <div class="item"> | |
| 492 | + <div class="item" data-id="10"> | |
| 493 | 493 | <div class="new">АКЦИЯ</div> |
| 494 | 494 | <div class="top">Toп</div> |
| 495 | 495 | <a href="#" class="item_link"><div class="pic"><img src="/images/items/01.jpg"></div> |
| ... | ... | @@ -502,7 +502,7 @@ $this->params['breadcrumbs'][] = $this->title; |
| 502 | 502 | <img class="item_bottom_img" src="/images/nc_item_bottom.png" alt=""> |
| 503 | 503 | </div> |
| 504 | 504 | |
| 505 | - <div class="item"> | |
| 505 | + <div class="item" data-id="9"> | |
| 506 | 506 | <div class="new">АКЦИЯ</div> |
| 507 | 507 | <div class="top">Toп</div> |
| 508 | 508 | <a href="#" class="item_link"><div class="pic"><img src="/images/items/02.jpg"></div> |
| ... | ... | @@ -515,7 +515,7 @@ $this->params['breadcrumbs'][] = $this->title; |
| 515 | 515 | <img class="item_bottom_img" src="/images/nc_item_bottom.png" alt=""> |
| 516 | 516 | </div> |
| 517 | 517 | |
| 518 | - <div class="item"> | |
| 518 | + <div class="item" data-id="11"> | |
| 519 | 519 | <div class="new">АКЦИЯ</div> |
| 520 | 520 | <div class="top">Toп</div> |
| 521 | 521 | <a href="#" class="item_link"><div class="pic"><img src="/images/items/01.jpg"></div> |
| ... | ... | @@ -528,7 +528,7 @@ $this->params['breadcrumbs'][] = $this->title; |
| 528 | 528 | <img class="item_bottom_img" src="/images/nc_item_bottom.png" alt=""> |
| 529 | 529 | </div> |
| 530 | 530 | |
| 531 | - <div class="item"> | |
| 531 | + <div class="item" data-id="12"> | |
| 532 | 532 | <div class="new">АКЦИЯ</div> |
| 533 | 533 | <div class="top">Toп</div> |
| 534 | 534 | <a href="#" class="item_link"><div class="pic"><img src="/images/items/02.jpg"></div> |
| ... | ... | @@ -541,7 +541,7 @@ $this->params['breadcrumbs'][] = $this->title; |
| 541 | 541 | <img class="item_bottom_img" src="/images/nc_item_bottom.png" alt=""> |
| 542 | 542 | </div> |
| 543 | 543 | |
| 544 | - <div class="item"> | |
| 544 | + <div class="item" data-id="31"> | |
| 545 | 545 | <div class="new">АКЦИЯ</div> |
| 546 | 546 | <div class="top">Toп</div> |
| 547 | 547 | <a href="#" class="item_link"><div class="pic"><img src="/images/items/01.jpg"></div> |
| ... | ... | @@ -554,7 +554,7 @@ $this->params['breadcrumbs'][] = $this->title; |
| 554 | 554 | <img class="item_bottom_img" src="/images/nc_item_bottom.png" alt=""> |
| 555 | 555 | </div> |
| 556 | 556 | |
| 557 | - <div class="item"> | |
| 557 | + <div class="item" data-id="15"> | |
| 558 | 558 | <div class="new">АКЦИЯ</div> |
| 559 | 559 | <div class="top">Toп</div> |
| 560 | 560 | <a href="#" class="item_link"><div class="pic"><img src="/images/items/01.jpg"></div> |
| ... | ... | @@ -567,7 +567,7 @@ $this->params['breadcrumbs'][] = $this->title; |
| 567 | 567 | <img class="item_bottom_img" src="/images/nc_item_bottom.png" alt=""> |
| 568 | 568 | </div> |
| 569 | 569 | |
| 570 | - <div class="item"> | |
| 570 | + <div class="item" data-id="14"> | |
| 571 | 571 | <div class="new">АКЦИЯ</div> |
| 572 | 572 | <div class="top">Toп</div> |
| 573 | 573 | <a href="#" class="item_link"><div class="pic"><img src="/images/items/02.jpg"></div> | ... | ... |
frontend/views/putty/cabinet.php renamed to frontend/views/site/cabinet.php
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | +use yii\helpers\Html; | |
| 4 | +use yii\helpers\Url; | |
| 5 | + | |
| 3 | 6 | $this->title = 'Moй кабинет'; |
| 4 | 7 | $this->params['breadcrumbs'][] = $this->title; |
| 5 | 8 | |
| ... | ... | @@ -22,13 +25,13 @@ $this->params['breadcrumbs'][] = $this->title; |
| 22 | 25 | </div> |
| 23 | 26 | |
| 24 | 27 | <div class="block_03"> |
| 25 | - <div class="cab_01"><span class="grey">artweb test</span></div> | |
| 26 | - <div class="cab_01"><span class="grey">dimitrosh@mail.ru</span></div> | |
| 27 | - <div class="cab_01"><span class="grey">(123) 456-7899</span></div> | |
| 28 | + <div class="cab_01"><span class="grey"><?= Yii::$app->user->identity->name ?></span></div> | |
| 29 | + <div class="cab_01"><span class="grey"><?= Yii::$app->user->identity->email ?></span></div> | |
| 30 | + <div class="cab_01"><span class="grey"><?= Yii::$app->user->identity->phone ?></span></div> | |
| 28 | 31 | </div> |
| 29 | 32 | |
| 30 | 33 | <div class="block_04"> |
| 31 | 34 | <div class="link"><span class="dotted"><a href="#">Редактировать личные данные</a></span></div> |
| 32 | - <div class="link"><a href="#">Выход</a></div> | |
| 35 | + <div class="link"><?= Html::a(Yii::t('app','exit'), Url::toRoute('site/logout'))?></div> | |
| 33 | 36 | </div> |
| 34 | 37 | </div> | ... | ... |
frontend/views/site/index.php
| ... | ... | @@ -169,7 +169,7 @@ $this->title = 'My Yii Application'; |
| 169 | 169 | <div class="content"> |
| 170 | 170 | <div class="title">Новинки</div> |
| 171 | 171 | <div class="novelty_cont"> |
| 172 | - <div class="item"> | |
| 172 | + <div class="item" data-id="1"> | |
| 173 | 173 | <div class="new">Новинка</div> |
| 174 | 174 | <div class="top">Toп</div> |
| 175 | 175 | <a href="#" class="item_link"><div class="pic"><img src="images/items/01.jpg"></div> |
| ... | ... | @@ -180,7 +180,7 @@ $this->title = 'My Yii Application'; |
| 180 | 180 | <button class="basket_add_but">в корзину</button> |
| 181 | 181 | <a href="#" class="compare_add_but"><span>добавить к сравнению</span></a> |
| 182 | 182 | </div> |
| 183 | - <div class="item"> | |
| 183 | + <div class="item" data-id="12"> | |
| 184 | 184 | <div class="new">Новинка</div> |
| 185 | 185 | <a href="#" class="item_link"><div class="pic"><img src="images/items/02.jpg"></div> |
| 186 | 186 | <div class="title_item">Ceresit CR 65 гидроизоляционная смесь, 25кг</div></a> |
| ... | ... | @@ -190,7 +190,7 @@ $this->title = 'My Yii Application'; |
| 190 | 190 | <button class="basket_add_but">в корзину</button> |
| 191 | 191 | <a href="#" class="compare_add_but"><span>добавить к сравнению</span></a> |
| 192 | 192 | </div> |
| 193 | - <div class="item"> | |
| 193 | + <div class="item" data-id="13"> | |
| 194 | 194 | <div class="new">Новинка</div> |
| 195 | 195 | <div class="top">Toп</div> |
| 196 | 196 | <a href="#" class="item_link"><div class="pic"><img src="images/items/03.jpg"></div> |
| ... | ... | @@ -201,7 +201,7 @@ $this->title = 'My Yii Application'; |
| 201 | 201 | <button class="basket_add_but">в корзину</button> |
| 202 | 202 | <a href="#" class="compare_add_but"><span>добавить к сравнению</span></a> |
| 203 | 203 | </div> |
| 204 | - <div class="item"> | |
| 204 | + <div class="item" data-id="14"> | |
| 205 | 205 | <div class="new">Новинка</div> |
| 206 | 206 | <div class="top">Toп</div> |
| 207 | 207 | <a href="#" class="item_link"><div class="pic"><img src="images/items/04.jpg"></div> | ... | ... |
frontend/web/css/style.css
| ... | ... | @@ -27,7 +27,7 @@ |
| 27 | 27 | .line_up a{color:#dde1e8;text-decoration:none;} |
| 28 | 28 | .line_up_in .left_lineup ul{ float:left;} |
| 29 | 29 | .line_up_in .right_lineup ul{ float:right;} |
| 30 | -.login_button_lu{ | |
| 30 | +.login_button_lu, .user_button_lu{ | |
| 31 | 31 | padding-left:15px; |
| 32 | 32 | background:url('../images/ico_user.png') center left no-repeat; |
| 33 | 33 | cursor:pointer; |
| ... | ... | @@ -37,10 +37,10 @@ |
| 37 | 37 | background:url('../images/ico_note.png') center left no-repeat; |
| 38 | 38 | cursor:pointer; |
| 39 | 39 | } |
| 40 | -.login_button_lu a, .reg_button_lu a{border-bottom:1px dotted #dde1e8;} | |
| 40 | +.login_button_lu a, .reg_button_lu a, .user_button_lu a{border-bottom:1px dotted #dde1e8;} | |
| 41 | 41 | .line_up ul li:last-child{padding-right:0px;} |
| 42 | 42 | .line_up a:hover{color:#eef1f5;transition:0.2s;} |
| 43 | -.login_button_lu a:hover, .reg_button_lu a:hover{border-bottom:1px dotted #eef1f5;} | |
| 43 | +.login_button_lu a:hover, .reg_button_lu a:hover, .user_button_lu a:hover{border-bottom:1px dotted #eef1f5;} | |
| 44 | 44 | |
| 45 | 45 | /* */ |
| 46 | 46 | |
| ... | ... | @@ -1068,3 +1068,13 @@ input.error_pass{ |
| 1068 | 1068 | display:block; |
| 1069 | 1069 | } |
| 1070 | 1070 | |
| 1071 | +#loginform-rememberme{ | |
| 1072 | + display: none; | |
| 1073 | +} | |
| 1074 | +.field-loginform-rememberme{ | |
| 1075 | + display: inline; | |
| 1076 | + color: #6aa034; | |
| 1077 | +} | |
| 1078 | +.field-loginform-rememberme label:hover{ | |
| 1079 | + color: #517a27; | |
| 1080 | +} | |
| 1071 | 1081 | \ No newline at end of file | ... | ... |
frontend/web/js/my_scripts.js
| ... | ... | @@ -4,16 +4,16 @@ $(document).ready(function(){ |
| 4 | 4 | |
| 5 | 5 | // price rangeslider (filter price slider) |
| 6 | 6 | $("#example_id").ionRangeSlider({ |
| 7 | - type: "double", | |
| 8 | - min: 0, | |
| 9 | - max: 500, | |
| 10 | - from: 50, | |
| 11 | - to: 450, | |
| 12 | - grid: false | |
| 7 | + type: "double", | |
| 8 | + min: 0, | |
| 9 | + max: 500, | |
| 10 | + from: 50, | |
| 11 | + to: 450, | |
| 12 | + grid: false | |
| 13 | 13 | }); |
| 14 | 14 | |
| 15 | 15 | // ion checkradio init |
| 16 | - $("input[type='radio'], input[type='checkbox']").ionCheckRadio(); | |
| 16 | + $("input[type='radio'], input[type='checkbox']").ionCheckRadio(); | |
| 17 | 17 | |
| 18 | 18 | // filter open li |
| 19 | 19 | var filter_list = $('.filter_list ul li .arrow'); |
| ... | ... | @@ -21,30 +21,30 @@ $(document).ready(function(){ |
| 21 | 21 | filter_list.on('click', function(){ |
| 22 | 22 | $(this).next().slideToggle(300); |
| 23 | 23 | var this_img = $(this).children('img'); |
| 24 | - if (this_img.attr('src') === "/images/head_down.png" ) { | |
| 25 | - this_img.attr('src', '/images/head_up.png'); | |
| 24 | + if (this_img.attr('src') === "images/head_down.png" ) { | |
| 25 | + this_img.attr('src', 'images/head_up.png'); | |
| 26 | 26 | } else { |
| 27 | - this_img.attr('src', '/images/head_down.png'); | |
| 27 | + this_img.attr('src', 'images/head_down.png'); | |
| 28 | 28 | }; |
| 29 | 29 | }); |
| 30 | 30 | |
| 31 | 31 | $('.form_checkbox_reset').click(function(e){ |
| 32 | 32 | e.preventDefault(); |
| 33 | - $('.price_filter input[type="checkbox"]').prop('checked', false); | |
| 34 | - $('.price_filter label').removeClass('checked'); | |
| 35 | - }); | |
| 33 | + $('.price_filter input[type="checkbox"]').prop('checked', false); | |
| 34 | + $('.price_filter label').removeClass('checked'); | |
| 35 | + }); | |
| 36 | 36 | |
| 37 | 37 | |
| 38 | - // CHANGE ACTIVE CLASS | |
| 38 | + // CHANGE ACTIVE CLASS | |
| 39 | 39 | function change_right(){ |
| 40 | 40 | var main_div = $('.main_img_slide'), |
| 41 | - | |
| 41 | + | |
| 42 | 42 | arrow_right = $('.slider_arrow_right'), |
| 43 | 43 | arrow_left = $('.slider_arrow_left'), |
| 44 | 44 | main_img = $('.main_img img'); |
| 45 | 45 | |
| 46 | 46 | |
| 47 | - arrow_right.on('click', function(){ | |
| 47 | + arrow_right.on('click', function(){ | |
| 48 | 48 | var next = $('.small_img_block.active').next(); |
| 49 | 49 | var next_attr = next.children().attr('src'); |
| 50 | 50 | if (next.hasClass('small_img_block')) { |
| ... | ... | @@ -52,20 +52,20 @@ $(document).ready(function(){ |
| 52 | 52 | next.addClass('active'); |
| 53 | 53 | main_img.attr('src', next_attr); |
| 54 | 54 | }; |
| 55 | - | |
| 55 | + | |
| 56 | 56 | }); |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | - // CHANGE ACTIVE CLASS | |
| 59 | + // CHANGE ACTIVE CLASS | |
| 60 | 60 | function change_left(){ |
| 61 | 61 | var main_div = $('.main_img_slide'), |
| 62 | - | |
| 62 | + | |
| 63 | 63 | arrow_right = $('.slider_arrow_right'), |
| 64 | 64 | arrow_left = $('.slider_arrow_left'), |
| 65 | 65 | main_img = $('.main_img img'); |
| 66 | 66 | |
| 67 | 67 | |
| 68 | - arrow_left.on('click', function(){ | |
| 68 | + arrow_left.on('click', function(){ | |
| 69 | 69 | var prev = $('.small_img_block.active').prev(); |
| 70 | 70 | var prev_attr = prev.children().attr('src'); |
| 71 | 71 | if (prev.hasClass('small_img_block')) { |
| ... | ... | @@ -73,7 +73,7 @@ $(document).ready(function(){ |
| 73 | 73 | prev.addClass('active'); |
| 74 | 74 | main_img.attr('src', prev_attr); |
| 75 | 75 | }; |
| 76 | - | |
| 76 | + | |
| 77 | 77 | }); |
| 78 | 78 | }; |
| 79 | 79 | var arrow_right = $('.slider_arrow_right'), |
| ... | ... | @@ -85,17 +85,17 @@ $(document).ready(function(){ |
| 85 | 85 | // arrow left hover |
| 86 | 86 | arrow_left.hover( |
| 87 | 87 | function(){ |
| 88 | - $(this).attr('src', '/images/slider_left_hover.png'); | |
| 88 | + $(this).attr('src', 'images/slider_left_hover.png'); | |
| 89 | 89 | }, function(){ |
| 90 | - $(this).attr('src', '/images/slider_left.png'); | |
| 90 | + $(this).attr('src', 'images/slider_left.png'); | |
| 91 | 91 | }); |
| 92 | 92 | |
| 93 | 93 | // arrow right hover |
| 94 | 94 | arrow_right.hover( |
| 95 | 95 | function(){ |
| 96 | - $(this).attr('src', '/images/slider_right_hover.png'); | |
| 96 | + $(this).attr('src', 'images/slider_right_hover.png'); | |
| 97 | 97 | }, function(){ |
| 98 | - $(this).attr('src', '/images/slider_right.png'); | |
| 98 | + $(this).attr('src', 'images/slider_right.png'); | |
| 99 | 99 | }); |
| 100 | 100 | |
| 101 | 101 | // добавить в корзину - счетчик + - товар |
| ... | ... | @@ -108,7 +108,7 @@ $(document).ready(function(){ |
| 108 | 108 | |
| 109 | 109 | counter_plus_btn.click(function(){ |
| 110 | 110 | var count = +counter_item_count.html(); |
| 111 | - count++; | |
| 111 | + count++; | |
| 112 | 112 | counter_item_count.text(count); |
| 113 | 113 | |
| 114 | 114 | var become = 1*($('.counter').children('.price').html()); |
| ... | ... | @@ -120,40 +120,40 @@ $(document).ready(function(){ |
| 120 | 120 | var result = become - state_price; |
| 121 | 121 | if(become > 0) { |
| 122 | 122 | open_card_item_price.text(result.toFixed(2)); |
| 123 | - var count = +counter_item_count.html(); | |
| 123 | + var count = +counter_item_count.html(); | |
| 124 | 124 | count--; |
| 125 | - counter_item_count.text(count); | |
| 125 | + counter_item_count.text(count); | |
| 126 | 126 | } |
| 127 | 127 | }); |
| 128 | 128 | |
| 129 | - // активный класс для корзины | |
| 129 | + // активный класс для корзины | |
| 130 | 130 | var basket_order_list = $('.order_list').find('.order_list_li'); |
| 131 | 131 | /*basket_order_list.click(function(){ |
| 132 | - basket_order_list.removeClass('active'); | |
| 133 | - $(this).addClass('active'); | |
| 134 | - // console.log('hello'); | |
| 135 | - });*/ | |
| 132 | + basket_order_list.removeClass('active'); | |
| 133 | + $(this).addClass('active'); | |
| 134 | + // console.log('hello'); | |
| 135 | + });*/ | |
| 136 | 136 | |
| 137 | 137 | // оформить заказ сумма всех товаров в корзине |
| 138 | 138 | var basket_all_items = $('.all_price').find('.all_count'), // количество товаров в корзине |
| 139 | 139 | basket_all_price = $('.all_price').find('.all_price'), // общая сумма за все товары |
| 140 | 140 | basket_each_price = basket_order_list.children('.price'), // цена товара(ов) |
| 141 | 141 | basket_each_count = basket_order_list.children('.how_many'); // количество каждого товара |
| 142 | - // console.log(basket_each_price); | |
| 143 | - | |
| 144 | - function basket_all_prices() { | |
| 145 | - var all_count = 0; | |
| 146 | - var all_price = 0; | |
| 147 | - for (var i = basket_each_count.length - 1; i >= 0; i--) { | |
| 148 | - var temp = basket_each_count[i].innerHTML; | |
| 149 | - var temp_price = basket_each_price[i].innerHTML; | |
| 150 | - all_count += parseInt(temp); | |
| 151 | - all_price += parseFloat(temp_price); | |
| 152 | - }; | |
| 153 | - basket_all_items.text(all_count); | |
| 154 | - basket_all_price.text(all_price.toFixed(2)); | |
| 155 | - } | |
| 156 | - basket_all_prices(); | |
| 142 | + // console.log(basket_each_price); | |
| 143 | + | |
| 144 | + function basket_all_prices() { | |
| 145 | + var all_count = 0; | |
| 146 | + var all_price = 0; | |
| 147 | + for (var i = basket_each_count.length - 1; i >= 0; i--) { | |
| 148 | + var temp = basket_each_count[i].innerHTML; | |
| 149 | + var temp_price = basket_each_price[i].innerHTML; | |
| 150 | + all_count += parseInt(temp); | |
| 151 | + all_price += parseFloat(temp_price); | |
| 152 | + }; | |
| 153 | + basket_all_items.text(all_count); | |
| 154 | + basket_all_price.text(all_price.toFixed(2)); | |
| 155 | + } | |
| 156 | + basket_all_prices(); | |
| 157 | 157 | |
| 158 | 158 | |
| 159 | 159 | // modal widows |
| ... | ... | @@ -167,7 +167,7 @@ $(document).ready(function(){ |
| 167 | 167 | forgot_pass_wrap = $('.forgot_pass_modal_wrapper'), // окно забыли пароль |
| 168 | 168 | forgot_pass_success_wrap = $('.forgot_pass_success_wrapper'), // окошко успешно отправлен пароль |
| 169 | 169 | forgot_pass_success_open_btn = $('.forgot_pass_modal_wrapper').find('.my_cust_btn'); |
| 170 | - forget_pass_again_btn = $('.forgot_pass_success_wrapper').find('.my_cust_btn'), | |
| 170 | + forget_pass_again_btn = $('.forgot_pass_success_wrapper').find('.my_cust_btn'), | |
| 171 | 171 | log_open_btn = $('.login_button_lu'), // окно логина |
| 172 | 172 | reg_open_btn = $('.reg_button_lu'), // кнопка открыть |
| 173 | 173 | modal_busket_open = $('.basket_add_but'), // открыть модалку корзины |
| ... | ... | @@ -182,7 +182,7 @@ $(document).ready(function(){ |
| 182 | 182 | callback_open_btn = $('.phone_me_head button'), |
| 183 | 183 | busket_modal_wrapper = $('.busket_modal_wrapper'), |
| 184 | 184 | main_wrap = $('.modal_wrapper'); |
| 185 | - reg_wrap_btn = $('.modal_wrapper_reg').find('button'); | |
| 185 | + reg_wrap_btn = $('.modal_wrapper_reg').find('button'); | |
| 186 | 186 | |
| 187 | 187 | |
| 188 | 188 | reg_wrap.css({'height': doc_h}); // высота заднего фона = высоте документа |
| ... | ... | @@ -192,18 +192,18 @@ $(document).ready(function(){ |
| 192 | 192 | callback_wrap.css({'height': doc_h}); // высота заднего фона = высоте документа |
| 193 | 193 | busket_modal_wrapper.css({'height' : doc_h}); // высота заднего фона = высоте документа |
| 194 | 194 | |
| 195 | - // | |
| 196 | - // | |
| 197 | - // $('body').keydown(function(event){ | |
| 198 | - // if (event.which == 27) { | |
| 199 | - // $(this).parent().find("input").val(''); | |
| 200 | - // reg_wrap.fadeOut(200); | |
| 201 | - // log_wrap.fadeOut(200); | |
| 202 | - // forgot_pass_wrap.fadeOut(200); | |
| 203 | - // forgot_pass_success_wrap.fadeOut(200); | |
| 204 | - // callback_wrap.fadeOut(200); | |
| 205 | - // }; | |
| 206 | - //}); | |
| 195 | + | |
| 196 | + | |
| 197 | + $('body').keydown(function(event){ | |
| 198 | + if (event.which == 27) { | |
| 199 | + $(this).parent().find("input").val(''); | |
| 200 | + reg_wrap.fadeOut(200); | |
| 201 | + log_wrap.fadeOut(200); | |
| 202 | + forgot_pass_wrap.fadeOut(200); | |
| 203 | + forgot_pass_success_wrap.fadeOut(200); | |
| 204 | + callback_wrap.fadeOut(200); | |
| 205 | + }; | |
| 206 | + }); | |
| 207 | 207 | |
| 208 | 208 | callback_open_btn.click(function(){ // открываем окно регистрации |
| 209 | 209 | $(".error").removeClass("error"); |
| ... | ... | @@ -213,7 +213,7 @@ $(document).ready(function(){ |
| 213 | 213 | } |
| 214 | 214 | else{ |
| 215 | 215 | callback_wrap.fadeIn(200); |
| 216 | - $(".phone_me_head").find("input").val(''); | |
| 216 | + $(".phone_me_head").find("input").val(''); | |
| 217 | 217 | } |
| 218 | 218 | }); |
| 219 | 219 | modal_busket_header_cont.click(function(){ // скрываем модальную корзину в хедере по ссылке |
| ... | ... | @@ -253,40 +253,40 @@ $(document).ready(function(){ |
| 253 | 253 | forgot_pass_wrap.fadeIn(50); |
| 254 | 254 | log_wrap.fadeOut(50); |
| 255 | 255 | }); |
| 256 | - //forgot_pass_success_open_btn.click(function(){ // сообщение об успешной отправке пароля на почту | |
| 257 | - // $(".error").removeClass("error"); | |
| 258 | - // if($(".forgot_pass_modal_wrapper").find("input").val().length == 0){ //проверка ввода поля | |
| 259 | - // $(".forgot_pass_modal_wrapper").find("input").addClass("error"); | |
| 260 | - // } | |
| 261 | - // else{ | |
| 262 | - // | |
| 263 | - // var email = $(".forgot_pass_modal_wrapper").find("input").val(); | |
| 264 | - // | |
| 265 | - //function isValidEmailAddress(emailAddress) { | |
| 266 | - //var pattern = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i); | |
| 267 | - //return pattern.test(emailAddress); | |
| 268 | - //} | |
| 269 | - // if(isValidEmailAddress(email)) | |
| 270 | - // { | |
| 271 | - // $(".forgot_pass_modal_wrapper").find("input").removeClass("error"); | |
| 272 | - // forgot_pass_success_wrap.fadeIn(200); | |
| 273 | - // forgot_pass_wrap.fadeOut(200); | |
| 274 | - // } else { | |
| 275 | - // $(".forgot_pass_modal_wrapper").find("input").addClass("error"); | |
| 276 | - // } | |
| 277 | - // | |
| 278 | - // | |
| 279 | - // /*// if ($('#forgot_pass_form')[0].checkValidity()) { | |
| 280 | - // forgot_pass_success_wrap.fadeIn(200); | |
| 281 | - // forgot_pass_wrap.fadeOut(200); | |
| 282 | - // // }; */ | |
| 283 | - // } | |
| 284 | - //}); | |
| 256 | + forgot_pass_success_open_btn.click(function(){ // сообщение об успешной отправке пароля на почту | |
| 257 | + $(".error").removeClass("error"); | |
| 258 | + if($(".forgot_pass_modal_wrapper").find("input").val().length == 0){ //проверка ввода поля | |
| 259 | + $(".forgot_pass_modal_wrapper").find("input").addClass("error"); | |
| 260 | + } | |
| 261 | + else{ | |
| 262 | + | |
| 263 | + var email = $(".forgot_pass_modal_wrapper").find("input").val(); | |
| 264 | + | |
| 265 | + function isValidEmailAddress(emailAddress) { | |
| 266 | + var pattern = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i); | |
| 267 | + return pattern.test(emailAddress); | |
| 268 | + } | |
| 269 | + if(isValidEmailAddress(email)) | |
| 270 | + { | |
| 271 | + $(".forgot_pass_modal_wrapper").find("input").removeClass("error"); | |
| 272 | + forgot_pass_success_wrap.fadeIn(200); | |
| 273 | + forgot_pass_wrap.fadeOut(200); | |
| 274 | + } else { | |
| 275 | + $(".forgot_pass_modal_wrapper").find("input").addClass("error"); | |
| 276 | + } | |
| 277 | + | |
| 278 | + | |
| 279 | + /*// if ($('#forgot_pass_form')[0].checkValidity()) { | |
| 280 | + forgot_pass_success_wrap.fadeIn(200); | |
| 281 | + forgot_pass_wrap.fadeOut(200); | |
| 282 | + // }; */ | |
| 283 | + } | |
| 284 | + }); | |
| 285 | 285 | forget_pass_again_btn.click(function(){ // еще раз отправить пароль |
| 286 | 286 | forgot_pass_wrap.fadeIn(50); |
| 287 | 287 | forgot_pass_success_wrap.fadeOut(50); |
| 288 | 288 | }); |
| 289 | - close_btn.click(function(){ // закрываем любые | |
| 289 | + close_btn.click(function(){ // закрываем любые | |
| 290 | 290 | $(this).parent().find("input").val(''); |
| 291 | 291 | $(".error").removeClass("error"); |
| 292 | 292 | reg_wrap.fadeOut(200); |
| ... | ... | @@ -302,60 +302,60 @@ $(document).ready(function(){ |
| 302 | 302 | forgot_pass_success_wrap.fadeOut(200); |
| 303 | 303 | callback_wrap.fadeOut(200); |
| 304 | 304 | }); |
| 305 | - | |
| 306 | - //reg_wrap_btn.click(function(){ | |
| 307 | - // /*$(".modal_wrapper_reg").find(".modal_window:label").each(function (i) { | |
| 308 | - // if (this.find("input").val().length == 0) { | |
| 309 | - // this.find("input").addClass("error"); | |
| 310 | - // alert('fdfdf'); | |
| 311 | - // } else { | |
| 312 | - // this.find("input").removeClass("error"); | |
| 313 | - // } | |
| 314 | - // });*/ | |
| 315 | - // var email_reg = $("#email_reg").val(); | |
| 316 | - // var pass_reg = $("#pass_reg").val(); | |
| 317 | - // var pass_reg_rep = $("#pass_reg_rep").val(); | |
| 318 | - // $(this).parent().parent().find("label").each(function(nf, form) | |
| 319 | - // { | |
| 320 | - // if($(this).find("input").val().length == 0){ | |
| 321 | - // $(this).find("input").addClass("error"); | |
| 322 | - // if(pass_reg !== pass_reg_rep){ | |
| 323 | - // $("#pass_reg").addClass("error_pass"); | |
| 324 | - // $("#pass_reg_rep").addClass("error_pass"); | |
| 325 | - // } | |
| 326 | - // else{ | |
| 327 | - // $("#pass_reg").removeClass("error_pass"); | |
| 328 | - // $("#pass_reg_rep").removeClass("error_pass"); | |
| 329 | - // } | |
| 330 | - // } | |
| 331 | - // else{ | |
| 332 | - // | |
| 333 | - // function isValidEmailAddress(emailAddress) { | |
| 334 | - // var pattern = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i); | |
| 335 | - // return pattern.test(emailAddress); | |
| 336 | - // } | |
| 337 | - // | |
| 338 | - // if(isValidEmailAddress(email_reg)) | |
| 339 | - // { | |
| 340 | - // $("#email_reg").removeClass("error"); | |
| 341 | - // $(this).find("input").removeClass("error"); | |
| 342 | - // } else { | |
| 343 | - // $(this).find("input").removeClass("error"); | |
| 344 | - // $("#email_reg").addClass("error"); | |
| 345 | - // } | |
| 346 | - // | |
| 347 | - // if(pass_reg !== pass_reg_rep){ | |
| 348 | - // $("#pass_reg").addClass("error_pass"); | |
| 349 | - // $("#pass_reg_rep").addClass("error_pass"); | |
| 350 | - // } | |
| 351 | - // else{ | |
| 352 | - // $("#pass_reg").removeClass("error_pass"); | |
| 353 | - // $("#pass_reg_rep").removeClass("error_pass"); | |
| 354 | - // } | |
| 355 | - // | |
| 356 | - // } | |
| 357 | - // }); | |
| 358 | - //}); | |
| 305 | + | |
| 306 | + reg_wrap_btn.click(function(){ | |
| 307 | + /*$(".modal_wrapper_reg").find(".modal_window:label").each(function (i) { | |
| 308 | + if (this.find("input").val().length == 0) { | |
| 309 | + this.find("input").addClass("error"); | |
| 310 | + alert('fdfdf'); | |
| 311 | + } else { | |
| 312 | + this.find("input").removeClass("error"); | |
| 313 | + } | |
| 314 | + });*/ | |
| 315 | + var email_reg = $("#email_reg").val(); | |
| 316 | + var pass_reg = $("#pass_reg").val(); | |
| 317 | + var pass_reg_rep = $("#pass_reg_rep").val(); | |
| 318 | + $(this).parent().parent().find("label").each(function(nf, form) | |
| 319 | + { | |
| 320 | + if($(this).find("input").val().length == 0){ | |
| 321 | + $(this).find("input").addClass("error"); | |
| 322 | + if(pass_reg !== pass_reg_rep){ | |
| 323 | + $("#pass_reg").addClass("error_pass"); | |
| 324 | + $("#pass_reg_rep").addClass("error_pass"); | |
| 325 | + } | |
| 326 | + else{ | |
| 327 | + $("#pass_reg").removeClass("error_pass"); | |
| 328 | + $("#pass_reg_rep").removeClass("error_pass"); | |
| 329 | + } | |
| 330 | + } | |
| 331 | + else{ | |
| 332 | + | |
| 333 | + function isValidEmailAddress(emailAddress) { | |
| 334 | + var pattern = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i); | |
| 335 | + return pattern.test(emailAddress); | |
| 336 | + } | |
| 337 | + | |
| 338 | + if(isValidEmailAddress(email_reg)) | |
| 339 | + { | |
| 340 | + $("#email_reg").removeClass("error"); | |
| 341 | + $(this).find("input").removeClass("error"); | |
| 342 | + } else { | |
| 343 | + $(this).find("input").removeClass("error"); | |
| 344 | + $("#email_reg").addClass("error"); | |
| 345 | + } | |
| 346 | + | |
| 347 | + if(pass_reg !== pass_reg_rep){ | |
| 348 | + $("#pass_reg").addClass("error_pass"); | |
| 349 | + $("#pass_reg_rep").addClass("error_pass"); | |
| 350 | + } | |
| 351 | + else{ | |
| 352 | + $("#pass_reg").removeClass("error_pass"); | |
| 353 | + $("#pass_reg_rep").removeClass("error_pass"); | |
| 354 | + } | |
| 355 | + | |
| 356 | + } | |
| 357 | + }); | |
| 358 | + }); | |
| 359 | 359 | } |
| 360 | 360 | modal_windows(); |
| 361 | 361 | |
| ... | ... | @@ -363,26 +363,26 @@ $(document).ready(function(){ |
| 363 | 363 | // category open blocks |
| 364 | 364 | function category_open_blocks() { |
| 365 | 365 | var open_block_btn = $('.category_wrap').find('.arrow'); |
| 366 | - open_block_btn.click(function(){ | |
| 367 | - var block = $(this).parent('.cat_li_cont').next(); | |
| 368 | - block.slideToggle(200); | |
| 369 | - | |
| 370 | - if($(this).css('background-position')==='0px 0px') { | |
| 371 | - $(this).css('background-position','0px -15px'); | |
| 372 | - }else{ | |
| 373 | - $(this).css('background-position','0px 0px'); | |
| 374 | - }; | |
| 375 | - }); | |
| 366 | + open_block_btn.click(function(){ | |
| 367 | + var block = $(this).parent('.cat_li_cont').next(); | |
| 368 | + block.slideToggle(200); | |
| 369 | + | |
| 370 | + if($(this).css('background-position')==='0px 0px') { | |
| 371 | + $(this).css('background-position','0px -15px'); | |
| 372 | + }else{ | |
| 373 | + $(this).css('background-position','0px 0px'); | |
| 374 | + }; | |
| 375 | + }); | |
| 376 | 376 | } |
| 377 | 377 | category_open_blocks(); |
| 378 | 378 | |
| 379 | 379 | |
| 380 | 380 | |
| 381 | - | |
| 381 | + // | |
| 382 | 382 | //// VALIDATION FORM JS |
| 383 | - //$.validator.addMethod("equals_code", function(value, element, string) { | |
| 384 | - // return value === string; | |
| 385 | - //}, $.validator.format("вы ввели не правильные буквы с картинки")); | |
| 383 | + //$.validator.addMethod("equals_code", function(value, element, string) { | |
| 384 | + // return value === string; | |
| 385 | + //}, $.validator.format("вы ввели не правильные буквы с картинки")); | |
| 386 | 386 | //// registration form |
| 387 | 387 | //$('.reg_form').validate({ |
| 388 | 388 | // rules: { |
| ... | ... | @@ -448,55 +448,55 @@ $(document).ready(function(){ |
| 448 | 448 | // // $('.foo_text').delay( 100 ).show(200); |
| 449 | 449 | // // } |
| 450 | 450 | //}); |
| 451 | - //// login form | |
| 452 | - //$('.log_form').validate({ | |
| 453 | - // rules: { | |
| 454 | - // password: { | |
| 451 | + //// login form | |
| 452 | + //$('.log_form').validate({ | |
| 453 | + // rules: { | |
| 454 | + // password: { | |
| 455 | 455 | // required: true |
| 456 | 456 | // }, |
| 457 | 457 | // login: { |
| 458 | 458 | // required: true |
| 459 | 459 | // } |
| 460 | - // }, | |
| 461 | - // messages: { | |
| 462 | - // password: { | |
| 463 | - // required: 'введите ваш пароль' | |
| 464 | - // }, | |
| 465 | - // login: { | |
| 466 | - // required: 'введите ваш логин' | |
| 467 | - // } | |
| 468 | - // } | |
| 469 | - //}); | |
| 470 | - //// forget password form | |
| 471 | - //$('.forgot_password_form').validate({ | |
| 472 | - // rules: { | |
| 473 | - // email: { | |
| 474 | - // required: true, | |
| 475 | - // email: true | |
| 476 | - // } | |
| 477 | - // }, | |
| 478 | - // messages: { | |
| 479 | - // email: { | |
| 480 | - // required: 'введите ваш логин...', | |
| 481 | - // email: 'введите правильный адресс (example@mail.com)' | |
| 482 | - // } | |
| 483 | - // }, | |
| 484 | - // submitHandler: function () { | |
| 460 | + // }, | |
| 461 | + // messages: { | |
| 462 | + // password: { | |
| 463 | + // required: 'введите ваш пароль' | |
| 464 | + // }, | |
| 465 | + // login: { | |
| 466 | + // required: 'введите ваш логин' | |
| 467 | + // } | |
| 468 | + // } | |
| 469 | + //}); | |
| 470 | + //// forget password form | |
| 471 | + //$('.forgot_password_form').validate({ | |
| 472 | + // rules: { | |
| 473 | + // email: { | |
| 474 | + // required: true, | |
| 475 | + // email: true | |
| 476 | + // } | |
| 477 | + // }, | |
| 478 | + // messages: { | |
| 479 | + // email: { | |
| 480 | + // required: 'введите ваш логин...', | |
| 481 | + // email: 'введите правильный адресс (example@mail.com)' | |
| 482 | + // } | |
| 483 | + // }, | |
| 484 | + // submitHandler: function () { | |
| 485 | 485 | // $('.forgot_pass_success_wrapper').fadeIn(200); |
| 486 | 486 | // $('.forgot_pass_modal_wrapper').fadeOut(200); |
| 487 | 487 | // } |
| 488 | - //}); | |
| 488 | + //}); | |
| 489 | 489 | |
| 490 | 490 | |
| 491 | 491 | |
| 492 | - //=============================================== BUSKET MODAL WINDOW FUNCTIONS | |
| 493 | - function all_modal_moves(){ | |
| 494 | - // BUSKET MODAL WINDOW ITEM DELETE | |
| 495 | - var delete_item_btn = $('.delete_item_btn').click(function(){ | |
| 496 | - $(this).closest('li').remove(); | |
| 497 | - }); | |
| 498 | - } | |
| 499 | - all_modal_moves(); | |
| 492 | + //=============================================== BUSKET MODAL WINDOW FUNCTIONS | |
| 493 | + function all_modal_moves(){ | |
| 494 | + // BUSKET MODAL WINDOW ITEM DELETE | |
| 495 | + var delete_item_btn = $('.delete_item_btn').click(function(){ | |
| 496 | + $(this).closest('li').remove(); | |
| 497 | + }); | |
| 498 | + } | |
| 499 | + all_modal_moves(); | |
| 500 | 500 | |
| 501 | 501 | |
| 502 | 502 | ... | ... |