Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
taskonsite-архив-перенесен
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Packages
Packages
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dmitry Korolev
taskonsite-архив-перенесен
Commits
3a7a76b0
Commit
3a7a76b0
authored
Feb 05, 2016
by
Виталий Мурашко
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Registration
parent
83131e64
Changes
14
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
1454 additions
and
20 deletions
+1454
-20
common/components/BaseForm.php
common/components/BaseForm.php
+11
-2
common/components/_BaseForm.php
common/components/_BaseForm.php
+2
-1
common/modules/school/controllers/CourseController.php
common/modules/school/controllers/CourseController.php
+4
-1
common/modules/school/models/Courses.php
common/modules/school/models/Courses.php
+0
-1
common/modules/school/views/course/index.php
common/modules/school/views/course/index.php
+3
-6
common/modules/users/controllers/UserController.php
common/modules/users/controllers/UserController.php
+5
-4
common/modules/users/forms/RegistrationUserForm.php
common/modules/users/forms/RegistrationUserForm.php
+44
-0
common/modules/users/models/User.php
common/modules/users/models/User.php
+18
-3
console/migrations/m160204_213447_add_field_to_users_table.php
...le/migrations/m160204_213447_add_field_to_users_table.php
+17
-0
frontend/config/main.php
frontend/config/main.php
+1
-0
frontend/views/layouts/foot.php
frontend/views/layouts/foot.php
+2
-1
frontend/web/css/screen.css
frontend/web/css/screen.css
+6
-0
frontend/web/js/common.js
frontend/web/js/common.js
+64
-1
frontend/web/js/jquery.form.js
frontend/web/js/jquery.form.js
+1277
-0
No files found.
common/components/BaseForm.php
View file @
3a7a76b0
...
@@ -168,6 +168,10 @@ JS;
...
@@ -168,6 +168,10 @@ JS;
$opt
=
$element
[
'fileOptions'
];
$opt
=
$element
[
'fileOptions'
];
if
(
!
empty
(
$element
[
'empty'
]))
if
(
!
empty
(
$element
[
'empty'
]))
$opt
[
'value'
]
=
$element
[
'empty'
];
$opt
[
'value'
]
=
$element
[
'empty'
];
if
(
!
empty
(
$element
[
'inputOptions'
]))
$optEl
[
'inputOptions'
]
=
$element
[
'inputOptions'
];
if
(
!
empty
(
$element
[
'inputOptions'
]))
$opt
[
'inputOptions'
]
=
$element
[
'inputOptions'
];
switch
(
$element
[
'type'
])
{
switch
(
$element
[
'type'
])
{
case
'checkbox'
:
case
'checkbox'
:
$opt
[
'data-render'
]
=
'switchery'
;
$opt
[
'data-render'
]
=
'switchery'
;
...
@@ -191,12 +195,15 @@ JS;
...
@@ -191,12 +195,15 @@ JS;
case
'email'
:
case
'email'
:
$tmp
=
$this
->
field
(
$this
->
model
,
$key
,
$optEl
)
->
input
(
$element
[
'type'
],
$opt
);
$tmp
=
$this
->
field
(
$this
->
model
,
$key
,
$optEl
)
->
input
(
$element
[
'type'
],
$opt
);
if
(
!
empty
(
$element
[
'hint'
]))
$tmp
=
$tmp
->
hint
(
$element
[
'hint'
]);
if
(
!
empty
(
$element
[
'hint'
]))
$tmp
=
$tmp
->
hint
(
$element
[
'hint'
]);
if
(
$element
[
'options'
][
'label'
]
===
false
)
$tmp
=
$tmp
->
label
(
false
);
$config
[
'options'
][]
=
$tmp
;
$config
[
'options'
][]
=
$tmp
;
break
;
break
;
case
'password'
:
case
'password'
:
//$opt['value'] = '';
//$opt['value'] = '';
$optEl
[
'template'
]
=
'{label}{input}<div id="'
.
$element
[
'pwd-id'
]
.
'" class="is0 m-t-5"></div>{error}'
;
$optEl
[
'template'
]
=
'{label}{input}<div id="'
.
$element
[
'pwd-id'
]
.
'" class="is0 m-t-5"></div>{error}'
;
$config
[
'options'
][]
=
$this
->
field
(
$this
->
model
,
$key
,
$optEl
)
->
input
(
$element
[
'type'
],
$opt
);
$tmp
=
$this
->
field
(
$this
->
model
,
$key
,
$optEl
)
->
input
(
$element
[
'type'
],
$opt
);
if
(
$element
[
'options'
][
'label'
]
===
false
)
$tmp
=
$tmp
->
label
(
false
);
$config
[
'options'
][]
=
$tmp
;
break
;
break
;
case
'hidden'
:
case
'hidden'
:
$config
[
'options'
][]
=
$this
->
field
(
$this
->
model
,
$key
,
$optEl
)
->
hiddenInput
(
$opt
)
->
label
(
false
);
$config
[
'options'
][]
=
$this
->
field
(
$this
->
model
,
$key
,
$optEl
)
->
hiddenInput
(
$opt
)
->
label
(
false
);
...
@@ -209,6 +216,7 @@ JS;
...
@@ -209,6 +216,7 @@ JS;
//$optEl['template'] = '{label}<div class="col-md-8">{input}</div>{error}{hint}';
//$optEl['template'] = '{label}<div class="col-md-8">{input}</div>{error}{hint}';
$tmp
=
$this
->
field
(
$this
->
model
,
$key
,
$optEl
)
->
dropDownList
(
$element
[
'items'
],
$opt
);
$tmp
=
$this
->
field
(
$this
->
model
,
$key
,
$optEl
)
->
dropDownList
(
$element
[
'items'
],
$opt
);
if
(
!
empty
(
$element
[
'hint'
]))
$tmp
=
$tmp
->
hint
(
$element
[
'hint'
]);
if
(
!
empty
(
$element
[
'hint'
]))
$tmp
=
$tmp
->
hint
(
$element
[
'hint'
]);
if
(
$element
[
'options'
][
'label'
]
===
false
)
$tmp
=
$tmp
->
label
(
false
);
$config
[
'options'
][]
=
$tmp
;
$config
[
'options'
][]
=
$tmp
;
break
;
break
;
case
'listBox'
:
case
'listBox'
:
...
@@ -272,7 +280,8 @@ JS;
...
@@ -272,7 +280,8 @@ JS;
if
(
$button
[
'type'
]
==
'htmlBlock'
)
if
(
$button
[
'type'
]
==
'htmlBlock'
)
$config
[
'options'
][]
=
$button
[
'value'
];
$config
[
'options'
][]
=
$button
[
'value'
];
else
if
(
$button
[
'type'
]
==
'submit'
)
else
if
(
$button
[
'type'
]
==
'submit'
)
$config
[
'options'
][]
=
\yii\helpers\Html
::
submitButton
(
$button
[
'value'
],
[
'class'
=>
'btn btn-success'
]);
$config
[
'options'
][]
=
(
!
empty
(
$button
[
'class'
]))
?
\yii\helpers\Html
::
submitButton
(
$button
[
'value'
],
[
'class'
=>
$button
[
'class'
]])
:
\yii\helpers\Html
::
submitButton
(
$button
[
'value'
],
[
'class'
=>
'btn btn-success'
]);
else
if
(
$button
[
'type'
]
==
'cancel'
)
else
if
(
$button
[
'type'
]
==
'cancel'
)
$config
[
'options'
][]
=
\yii\helpers\Html
::
resetButton
(
$button
[
'value'
],
[
'class'
=>
'btn btn-default'
]);
$config
[
'options'
][]
=
\yii\helpers\Html
::
resetButton
(
$button
[
'value'
],
[
'class'
=>
'btn btn-default'
]);
else
if
(
$button
[
'type'
]
==
'danger'
)
else
if
(
$button
[
'type'
]
==
'danger'
)
...
...
common/components/_BaseForm.php
View file @
3a7a76b0
...
@@ -121,7 +121,7 @@ JS;
...
@@ -121,7 +121,7 @@ JS;
if
(
!
empty
(
$element
[
'options'
][
'label'
]))
if
(
!
empty
(
$element
[
'options'
][
'label'
]))
$optEl
[
'labelOptions'
]
=
[
'label'
=>
$element
[
'options'
][
'label'
]];
$optEl
[
'labelOptions'
]
=
[
'label'
=>
$element
[
'options'
][
'label'
]];
if
(
!
empty
(
$element
[
'empty'
]))
if
(
!
empty
(
$element
[
'empty'
]))
$opt
[
'value'
]
=
$element
[
'empty'
];
$opt
[
'value'
]
=
$element
[
'empty'
];
switch
(
$element
[
'type'
])
{
switch
(
$element
[
'type'
])
{
case
'checkbox'
:
case
'checkbox'
:
$opt
[
'data-render'
]
=
'switchery'
;
$opt
[
'data-render'
]
=
'switchery'
;
...
@@ -186,6 +186,7 @@ JS;
...
@@ -186,6 +186,7 @@ JS;
$config
[
'options'
][]
=
'<div style="clear: both;"></div>'
;
$config
[
'options'
][]
=
'<div style="clear: both;"></div>'
;
/* **************** */
/* **************** */
}
}
unset
(
$config
[
'elements'
]);
unset
(
$config
[
'elements'
]);
if
(
$meta
)
{
if
(
$meta
)
{
//die(print_r($model->metaTag));
//die(print_r($model->metaTag));
...
...
common/modules/school/controllers/CourseController.php
View file @
3a7a76b0
...
@@ -6,6 +6,7 @@ use common\components\BaseController;
...
@@ -6,6 +6,7 @@ use common\components\BaseController;
use
common\modules\school\models\Courses
;
use
common\modules\school\models\Courses
;
use
common\modules\school\models\SearchCourses
;
use
common\modules\school\models\SearchCourses
;
use
common\modules\school\models\SearchLessons
;
use
common\modules\school\models\SearchLessons
;
use
common\modules\users\models\User
;
class
CourseController
extends
BaseController
class
CourseController
extends
BaseController
{
{
...
@@ -23,7 +24,9 @@ class CourseController extends BaseController
...
@@ -23,7 +24,9 @@ class CourseController extends BaseController
$search
=
\Yii
::
$app
->
request
->
queryParams
;
$search
=
\Yii
::
$app
->
request
->
queryParams
;
$dataProvider
=
$searchModel
->
search
(
$search
);
$dataProvider
=
$searchModel
->
search
(
$search
);
return
$this
->
render
(
'index'
,
[
'dataProvider'
=>
$dataProvider
]);
$modelUser
=
new
User
();
$form
=
new
\common\components\BaseForm
(
'/common/modules/users/forms/RegistrationUserForm'
,
$modelUser
);
return
$this
->
render
(
'index'
,
[
'dataProvider'
=>
$dataProvider
,
'form'
=>
$form
->
out
]);
}
}
public
function
actionView
(
$id
)
public
function
actionView
(
$id
)
...
...
common/modules/school/models/Courses.php
View file @
3a7a76b0
...
@@ -26,7 +26,6 @@ class Courses extends \common\components\ActiveRecordModel
...
@@ -26,7 +26,6 @@ class Courses extends \common\components\ActiveRecordModel
self
::
TYPE_DV
=>
'в разработке'
,
self
::
TYPE_DV
=>
'в разработке'
,
];
];
public
static
function
tableName
()
public
static
function
tableName
()
{
{
return
'courses'
;
return
'courses'
;
...
...
common/modules/school/views/course/index.php
View file @
3a7a76b0
...
@@ -49,12 +49,9 @@
...
@@ -49,12 +49,9 @@
<div
class=
"container"
>
<div
class=
"container"
>
<div
class=
"row"
>
<div
class=
"row"
>
<div
class=
"col-md-4 col-xs-6 col-sm-12"
>
<div
class=
"col-md-4 col-xs-6 col-sm-12"
>
<form
class=
"sh_reg_form"
>
<?php
<input
type=
"text"
class=
"input_st field-input required alphanumeric"
placeholder=
"Ваше имя*"
>
echo
$form
;
<input
type=
"tel"
class=
"input_st field-input required alphanumeric"
placeholder=
"Телефон*"
>
?>
<input
type=
"email"
class=
"input_st field-input required email"
placeholder=
"E-mail*"
>
<button
class=
"save-button sh_bt_send"
>
Записаться
</button>
</form>
<div
class=
"usl"
>
Проходя регистрацию вы подтверждаете
<br><a
href=
"#"
>
согласие на обработку персональных данных.
</a></div>
<div
class=
"usl"
>
Проходя регистрацию вы подтверждаете
<br><a
href=
"#"
>
согласие на обработку персональных данных.
</a></div>
</div>
</div>
<div
class=
"col-md-8 col-xs-6 col-sm-12"
>
<div
class=
"col-md-8 col-xs-6 col-sm-12"
>
...
...
common/modules/users/controllers/UserController.php
View file @
3a7a76b0
...
@@ -46,7 +46,7 @@ class UserController extends \common\components\BaseController {
...
@@ -46,7 +46,7 @@ class UserController extends \common\components\BaseController {
}
}
public
function
loadModel
(
$id
)
{
public
function
loadModel
(
$id
,
$scopes
=
array
(),
$attribute
=
NULL
)
{
$model
=
User
::
model
()
->
findByPk
((
int
)
$id
);
$model
=
User
::
model
()
->
findByPk
((
int
)
$id
);
if
(
$model
===
null
)
{
if
(
$model
===
null
)
{
$this
->
pageNotFound
();
$this
->
pageNotFound
();
...
@@ -104,14 +104,15 @@ class UserController extends \common\components\BaseController {
...
@@ -104,14 +104,15 @@ class UserController extends \common\components\BaseController {
public
function
actionRegistration
()
{
public
function
actionRegistration
()
{
$model
=
new
User
;
die
(
''
);
$model
=
new
User
();
$model
->
scenario
=
User
::
SCENARIO_REGISTRATION
;
$model
->
scenario
=
User
::
SCENARIO_REGISTRATION
;
$form
=
new
BaseForm
(
'users.RegistrationForm'
,
$model
);
/*
$form = new BaseForm('users.RegistrationForm', $model);
$this->performAjaxValidation($model);
$this->performAjaxValidation($model);
unset($form->elements['captcha']);
unset($form->elements['captcha']);
$is_created
=
false
;
$is_created = false;
*/
if
(
isset
(
$_POST
[
'User'
]))
{
if
(
isset
(
$_POST
[
'User'
]))
{
$model
->
attributes
=
$_POST
[
'User'
];
$model
->
attributes
=
$_POST
[
'User'
];
...
...
common/modules/users/forms/RegistrationUserForm.php
0 → 100644
View file @
3a7a76b0
<?php
use
yii\helpers\Url
;
use
common\modules\users\models\User
;
$elements
=
[
'name'
=>
[
'type'
=>
'text'
,
'placeholder'
=>
"Ваше имя*"
,
'options'
=>
[
'label'
=>
false
],
'inputOptions'
=>
[
'class'
=>
'input_st field-input required alphanumeric'
]],
'email'
=>
[
'type'
=>
'text'
,
'placeholder'
=>
"E-mail*"
,
'options'
=>
[
'label'
=>
false
],
'inputOptions'
=>
[
'class'
=>
'input_st field-input required alphanumeric'
]],
'password'
=>
[
'type'
=>
'password'
,
'placeholder'
=>
"Придумайте пароль*"
,
'options'
=>
[
'label'
=>
false
],
'inputOptions'
=>
[
'class'
=>
'input_st field-input required alphanumeric'
]],
'password_c'
=>
[
'type'
=>
'password'
,
'placeholder'
=>
"Повторите пароль*"
,
'options'
=>
[
'label'
=>
false
],
'inputOptions'
=>
[
'class'
=>
'input_st field-input required alphanumeric'
]],
'phone'
=>
[
'type'
=>
'text'
,
'placeholder'
=>
"Телефон"
,
'options'
=>
[
'label'
=>
false
],
'inputOptions'
=>
[
'class'
=>
'input_st field-input required alphanumeric'
]],
'teltext'
=>
'<div class="teltext-block">Для участие в проводимых конкурсах укажите Ваш реальный номер телефона,
что бы мы смогли вас оповестить о результатах</div>'
,
'occupation'
=>
[
'type'
=>
'dropdownlist'
,
'items'
=>
User
::
$occupation_list
,
'placeholder'
=>
"Род занятий"
,
'options'
=>
[
'label'
=>
false
],
'empty'
=>
'Чем вы занимаетесь'
,
'inputOptions'
=>
[
'class'
=>
'input_st field-input required alphanumeric'
]
],
];
return
[
'activeForm'
=>
[
'id'
=>
'sh_reg_form'
,
'options'
=>
[
//'onsubmit'=>"ajaxSubmit(url: ".Url::toRoute(['/users/user/registration']).")";
'enctype'
=>
'multipart/form-data'
],
],
'elements'
=>
$elements
,
'buttons'
=>
[
'submit'
=>
[
'type'
=>
'submit'
,
'value'
=>
'Записаться'
,
'class'
=>
"save-button sh_bt_send"
]
]
];
common/modules/users/models/User.php
View file @
3a7a76b0
...
@@ -16,7 +16,12 @@ use \common\modules\rbac\models\AuthAssignment;
...
@@ -16,7 +16,12 @@ use \common\modules\rbac\models\AuthAssignment;
class
User
extends
\common\components\ActiveRecordModel
implements
IdentityInterface
class
User
extends
\common\components\ActiveRecordModel
implements
IdentityInterface
{
{
const
PAGE_SIZE
=
10
;
const
PAGE_SIZE
=
10
;
const
OCCUPATION_CHIEF_IT
=
1
;
const
OCCUPATION_MANAGER_IT
=
2
;
const
OCCUPATION_CREATOR
=
3
;
const
OCCUPATION_NOT_IT
=
4
;
const
STATUS_ACTIVE
=
'active'
;
const
STATUS_ACTIVE
=
'active'
;
const
STATUS_NEW
=
'new'
;
const
STATUS_NEW
=
'new'
;
const
STATUS_BLOCKED
=
'blocked'
;
const
STATUS_BLOCKED
=
'blocked'
;
...
@@ -63,6 +68,14 @@ class User extends \common\components\ActiveRecordModel implements IdentityInter
...
@@ -63,6 +68,14 @@ class User extends \common\components\ActiveRecordModel implements IdentityInter
public
$tmp
;
//for external using. no delete!
public
$tmp
;
//for external using. no delete!
// public $post;
// public $post;
public
static
$occupation_list
=
[
self
::
OCCUPATION_CHIEF_IT
=>
'Руководитель в IT сфере'
,
self
::
OCCUPATION_MANAGER_IT
=>
'Менеджер в IT сфере'
,
self
::
OCCUPATION_CREATOR
=>
'Разработчик'
,
self
::
OCCUPATION_NOT_IT
=>
'Не работаю в IT'
,
];
public
function
behaviors
()
public
function
behaviors
()
{
{
return
[
return
[
...
@@ -91,7 +104,8 @@ class User extends \common\components\ActiveRecordModel implements IdentityInter
...
@@ -91,7 +104,8 @@ class User extends \common\components\ActiveRecordModel implements IdentityInter
"send_email"
=>
"Отправить уведомление на почту"
,
"send_email"
=>
"Отправить уведомление на почту"
,
"generate_new"
=>
"Сгенерировать пароль автоматически"
,
"generate_new"
=>
"Сгенерировать пароль автоматически"
,
"post"
=>
"Должность"
,
"post"
=>
"Должность"
,
"status"
=>
"Активен / заблокирован"
"status"
=>
"Активен / заблокирован"
,
"occupation"
=>
"Род занятий"
,
));
));
return
$attrs
;
return
$attrs
;
...
@@ -136,7 +150,7 @@ class User extends \common\components\ActiveRecordModel implements IdentityInter
...
@@ -136,7 +150,7 @@ class User extends \common\components\ActiveRecordModel implements IdentityInter
self
::
SCENARIO_CHANGE_PASSWORD
,
self
::
SCENARIO_CHANGE_PASSWORD
,
self
::
SCENARIO_CREATE
,
self
::
SCENARIO_CREATE
,
],
'message'
=>
'Пожалуйста, укажите пароль'
],
],
'message'
=>
'Пожалуйста, укажите пароль'
],
[[
'password'
],
'string'
,
'min'
=>
4
,
'on'
=>
[
[[
'password'
],
'string'
,
'min'
=>
7
,
'on'
=>
[
self
::
SCENARIO_REGISTRATION
,
self
::
SCENARIO_REGISTRATION
,
self
::
SCENARIO_CHANGE_PASSWORD
,
self
::
SCENARIO_CHANGE_PASSWORD
,
self
::
SCENARIO_UPDATE
,
self
::
SCENARIO_UPDATE
,
...
@@ -183,6 +197,7 @@ class User extends \common\components\ActiveRecordModel implements IdentityInter
...
@@ -183,6 +197,7 @@ class User extends \common\components\ActiveRecordModel implements IdentityInter
self
::
SCENARIO_SEARCH
,
self
::
SCENARIO_SEARCH
,
self
::
SCENARIO_CREATE
,
self
::
SCENARIO_CREATE
,
]],
]],
[[
'occupation'
],
'integer'
,
'max'
=>
11
],
[[
'tmp'
,
'role'
,
'sort'
,
'fio'
,
'name'
,
'surname'
,
'email'
,
'mobile_phone'
],
'safe'
],
[[
'tmp'
,
'role'
,
'sort'
,
'fio'
,
'name'
,
'surname'
,
'email'
,
'mobile_phone'
],
'safe'
],
];
];
}
}
...
...
console/migrations/m160204_213447_add_field_to_users_table.php
0 → 100644
View file @
3a7a76b0
<?php
use
yii\db\Schema
;
use
yii\db\Migration
;
class
m160204_213447_add_field_to_users_table
extends
Migration
{
public
function
safeUp
()
{
$this
->
addColumn
(
'users'
,
'occupation'
,
Schema
::
TYPE_INTEGER
.
'(11)'
);
}
public
function
safeDown
()
{
$this
->
dropColumn
(
'users'
,
'occupation'
);
}
}
frontend/config/main.php
View file @
3a7a76b0
...
@@ -22,6 +22,7 @@ return [
...
@@ -22,6 +22,7 @@ return [
'school'
=>
[
'class'
=>
'common\modules\school\Module'
,],
'school'
=>
[
'class'
=>
'common\modules\school\Module'
,],
'bids'
=>
[
'class'
=>
'common\modules\bids\Module'
],
'bids'
=>
[
'class'
=>
'common\modules\bids\Module'
],
'testings'
=>
[
'class'
=>
'common\modules\testings\Module'
,],
'testings'
=>
[
'class'
=>
'common\modules\testings\Module'
,],
'users'
=>
[
'class'
=>
'common\modules\users\users'
,],
'sitemap'
=>
[
'sitemap'
=>
[
'class'
=>
'himiklab\sitemap\Sitemap'
,
'class'
=>
'himiklab\sitemap\Sitemap'
,
'models'
=>
[
'models'
=>
[
...
...
frontend/views/layouts/foot.php
View file @
3a7a76b0
...
@@ -22,4 +22,5 @@
...
@@ -22,4 +22,5 @@
<?php
$this
->
registerJsFile
(
'/js/jquery.inputmask.js'
,
[
'position'
=>
yii\web\View
::
POS_END
]);
?>
<?php
$this
->
registerJsFile
(
'/js/jquery.inputmask.js'
,
[
'position'
=>
yii\web\View
::
POS_END
]);
?>
<?php
$this
->
registerJsFile
(
'/js/inputmask.phone.extensions.js'
,
[
'position'
=>
yii\web\View
::
POS_END
]);
?>
<?php
$this
->
registerJsFile
(
'/js/inputmask.phone.extensions.js'
,
[
'position'
=>
yii\web\View
::
POS_END
]);
?>
<?php
$this
->
registerJsFile
(
'/js/common.js'
,
[
'position'
=>
yii\web\View
::
POS_END
]);
?>
<?php
$this
->
registerJsFile
(
'/js/common.js'
,
[
'position'
=>
yii\web\View
::
POS_END
]);
?>
\ No newline at end of file
<?php
$this
->
registerJsFile
(
'/js/jquery.form.js'
,
[
'position'
=>
yii\web\View
::
POS_END
]);
?>
\ No newline at end of file
frontend/web/css/screen.css
View file @
3a7a76b0
...
@@ -11458,4 +11458,10 @@ h6 {
...
@@ -11458,4 +11458,10 @@ h6 {
}
}
.row
li
{
.row
li
{
list-style
:
none
;
list-style
:
none
;
}
.teltext-block
{
margin-top
:
-40px
;
margin-bottom
:
15px
;
color
:
#698387
;
font-size
:
14px
;
}
}
\ No newline at end of file
frontend/web/js/common.js
View file @
3a7a76b0
...
@@ -580,4 +580,67 @@ jQuery(document).ready(function(){
...
@@ -580,4 +580,67 @@ jQuery(document).ready(function(){
$
(
this
).
parent
().
toggleClass
(
"
box_off_hide
"
);
$
(
this
).
parent
().
toggleClass
(
"
box_off_hide
"
);
});
});
});
});
\ No newline at end of file
// prepare the form when the DOM is ready
$
(
document
).
ready
(
function
()
{
var
options
=
{
//target: '#output2', // target element(s) to be updated with server response
beforeSubmit
:
showRequest
,
// pre-submit callback
success
:
showResponse
,
// post-submit callback
// other available options:
url
:
'
/users/user/registration
'
// override for form's 'action' attribute
//type: type // 'get' or 'post', override for form's 'method' attribute
//dataType: null // 'xml', 'script', or 'json' (expected server response type)
//clearForm: true // clear all form fields after successful submit
//resetForm: true // reset the form after successful submit
// $.ajax options can be used here too, for example:
//timeout: 3000
};
// bind to the form's submit event
$
(
'
#sh_reg_form
'
).
submit
(
function
()
{
// inside event callbacks 'this' is the DOM element so we first
// wrap it in a jQuery object and then invoke ajaxSubmit
$
(
this
).
ajaxSubmit
(
options
);
// !!! Important !!!
// always return false to prevent standard browser submit and page navigation
return
false
;
});
});
// pre-submit callback
function
showRequest
(
formData
,
jqForm
,
options
)
{
// formData is an array; here we use $.param to convert it to a string to display it
// but the form plugin does this for you automatically when it submits the data
var
queryString
=
$
.
param
(
formData
);
// jqForm is a jQuery object encapsulating the form element. To access the
// DOM element for the form do this:
// var formElement = jqForm[0];
//alert('About to submit: \n\n' + queryString);
// here we could return false to prevent the form from being submitted;
// returning anything other than false will allow the form submit to continue
return
true
;
}
// post-submit callback
function
showResponse
(
responseText
,
statusText
,
xhr
,
$form
)
{
// for normal html responses, the first argument to the success callback
// is the XMLHttpRequest object's responseText property
// if the ajaxSubmit method was passed an Options Object with the dataType
// property set to 'xml' then the first argument to the success callback
// is the XMLHttpRequest object's responseXML property
// if the ajaxSubmit method was passed an Options Object with the dataType
// property set to 'json' then the first argument to the success callback
// is the json data object returned by the server
//alert('status: ' + statusText + '\n\nresponseText: \n' + responseText +
// '\n\nThe output div should have already been updated with the responseText.');
}
\ No newline at end of file
frontend/web/js/jquery.form.js
0 → 100644
View file @
3a7a76b0
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment