298bc0f4
Alexey Boroda
first commit
|
1
|
<?php
|
298bc0f4
Alexey Boroda
first commit
|
2
|
use artbox\core\components\SeoComponent;
|
ff81af45
Alexey Boroda
-Languages in pro...
|
3
|
use frontend\components\UrlManager;
|
298bc0f4
Alexey Boroda
first commit
|
4
|
|
4df5348f
alex
Поредактировал фо...
|
5
6
|
$a = \Yii::t('app', 'Message');
|
298bc0f4
Alexey Boroda
first commit
|
7
8
9
10
11
12
|
$params = array_merge(
require( __DIR__ . '/../../common/config/params.php' ),
require( __DIR__ . '/../../common/config/params-local.php' ),
require( __DIR__ . '/params.php' ),
require( __DIR__ . '/params-local.php' )
);
|
298bc0f4
Alexey Boroda
first commit
|
13
14
15
16
|
return [
'id' => 'app-frontend',
'homeUrl' => '/',
'basePath' => dirname(__DIR__),
|
4df5348f
alex
Поредактировал фо...
|
17
18
19
20
21
|
'bootstrap' => [
'log',
'i18n',
'contact',
],
|
298bc0f4
Alexey Boroda
first commit
|
22
|
'controllerNamespace' => 'frontend\controllers',
|
4df5348f
alex
Поредактировал фо...
|
23
|
'container' => [
|
298bc0f4
Alexey Boroda
first commit
|
24
25
26
27
|
'singletons' => [
'artbox\core\services\Languages' =>'artbox\core\services\Languages',
]
],
|
4df5348f
alex
Поредактировал фо...
|
28
|
|
929c9486
alex
Поредактировал фо...
|
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
'components' => [
'request' => [
'csrfParam' => '_csrf-frontend',
'baseUrl' => '',
],
'user' => [
'identityClass' => 'common\models\User',
'enableAutoLogin' => true,
'identityCookie' => [
'name' => '_identity-frontend',
'httpOnly' => true,
],
],
'session' => [
// this is the name of the session cookie used for login on the frontend
'name' => 'advanced-frontend',
],
'log' => [
'traceLevel' => YII_DEBUG ? 3 : 0,
'targets' => [
[
'class' => 'yii\log\FileTarget',
'levels' => [
'error',
'warning',
],
],
],
],
'seo' => [
'class' => SeoComponent::className(),
],
'errorHandler' => [
'errorAction' => 'site/error',
],
'i18n' => [
'translations' => [
'core' => [
'class' => 'yii\i18n\PhpMessageSource',
'basePath' => '@common/messages',
],
'app' => [
'class' => 'yii\i18n\PhpMessageSource',
'basePath' => '@common/messages',
],
],
],
'urlManager' => [
'class' => UrlManager::className(),
'baseUrl' => '/',
'enablePrettyUrl' => true,
'showScriptName' => false,
'rules' => [ ],
'hideDefaultLanguagePrefix' => true,
],
],
|
298bc0f4
Alexey Boroda
first commit
|
86
87
|
'modules' => [
'feedback' => [
|
d36b7201
alex
Поредактировал фо...
|
88
89
90
|
'class' => 'artbox\core\forms\Module',
'activeRecord' => "frontend\models\Feedback",
'attributes' => [
|
298bc0f4
Alexey Boroda
first commit
|
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
'name',
'email',
'message',
],
'rules' => [
[
[ 'email' ],
'email',
],
[
[
'email',
'name',
'message',
],
'required',
],
],
'labels' => [
|
0d556e29
Anastasia
translations
|
110
111
112
|
'email' => \Yii::t('app','Email'),
'name' => \Yii::t('app','Name'),
'message' => \Yii::t('app','You question'),
|
298bc0f4
Alexey Boroda
first commit
|
113
114
115
116
117
118
119
|
],
'inputOptions' => [
'message' => [
'type' => 'textarea',
'options' => [],
],
],
|
4df5348f
alex
Поредактировал фо...
|
120
|
'buttonContent' => \Yii::t('app', 'Send'),
|
298bc0f4
Alexey Boroda
first commit
|
121
122
123
124
125
|
'scenario' => 'feedback',
'sendEmail' => false,
'formId' => 'feedback-form',
'ajax' => true,
'successCallback' => 'function (data) {
|
cef18d3a
Anastasia
- forms
|
126
127
|
if (data.status == "success"){
document.getElementById("feedback-form").reset();
|
298bc0f4
Alexey Boroda
first commit
|
128
129
130
131
132
|
$(".close").click();
$(".success_").animate({opacity: 1, top: \'40\'}, 200).addClass("done_");
setTimeout(function(){$(".success_").animate({opacity: 0, top: \'0\'}, 200,function(){
$(this).removeClass("done_");
})}, 4000);
|
9cbe82b5
Anastasia
- forms ajax
|
133
134
|
var data = $("#feedback-form").data(\'yiiActiveForm\');
data.validated = false;
|
cef18d3a
Anastasia
- forms
|
135
|
}
|
c4d70d93
Anastasia
- blog
|
136
|
|
298bc0f4
Alexey Boroda
first commit
|
137
138
|
}',
],
|
298bc0f4
Alexey Boroda
first commit
|
139
|
'contact' => [
|
d36b7201
alex
Поредактировал фо...
|
140
141
|
'class' => 'artbox\core\forms\Module',
'activeRecord' => "frontend\models\Feedback",
|
298bc0f4
Alexey Boroda
first commit
|
142
|
'templateForm' => '<div class="row">{form}</div>',
|
d36b7201
alex
Поредактировал фо...
|
143
|
'attributes' => [
|
298bc0f4
Alexey Boroda
first commit
|
144
145
146
|
'name',
'email',
'phone',
|
929c9486
alex
Поредактировал фо...
|
147
|
'message',
|
298bc0f4
Alexey Boroda
first commit
|
148
|
],
|
d36b7201
alex
Поредактировал фо...
|
149
|
'rules' => [
|
298bc0f4
Alexey Boroda
first commit
|
150
151
152
153
154
155
156
157
158
159
160
161
162
163
|
[
[ 'email' ],
'email',
],
[
[
'email',
'name',
'phone',
],
'required',
]
],
'labels' => [
|
0d556e29
Anastasia
translations
|
164
165
166
167
|
'email' => \Yii::t('app','Email'),
'name' => \Yii::t('app', 'Name'),
'message' => \Yii::t('app','Message'),
'phone' => \Yii::t('app','Phone')
|
298bc0f4
Alexey Boroda
first commit
|
168
169
170
171
|
],
'inputOptions' => [
'name' => [
|
929c9486
alex
Поредактировал фо...
|
172
|
'template' => '<div class="col-sm-12">{input}</div>',
|
298bc0f4
Alexey Boroda
first commit
|
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
|
],
'email' => [
'template' => '<div class="col-sm-6">{input}</div>'
],
'phone' => [
'template' => '<div class="col-sm-6">{input}</div>'
],
'message' => [
'type' => 'textarea',
'options' => [],
'template' => '<div class="col-sm-12">{input}</div>'
],
],
'buttonTemplate' => '<div class="col-sm-12 text-center">{button}</div>',
'buttonOptions' => [
|
929c9486
alex
Поредактировал фо...
|
188
|
'class' => 'btn btn-template-main',
|
298bc0f4
Alexey Boroda
first commit
|
189
|
],
|
ae6f91d8
alex
123
|
190
|
'buttonContent' => '<i class="fa fa-envelope-o"></i>Send Message',
|
298bc0f4
Alexey Boroda
first commit
|
191
192
193
194
195
|
'sendEmail' => false,
'ajax' => true,
'formId' => 'contact-form',
'scenario' => 'default',
'successCallback' => 'function (data) {
|
cef18d3a
Anastasia
- forms
|
196
|
if (data.status == "success"){
|
c4d70d93
Anastasia
- blog
|
197
|
document.getElementById("contact-form").reset();
|
298bc0f4
Alexey Boroda
first commit
|
198
199
200
201
202
|
$(".close").click();
$(".success_").animate({opacity: 1, top: \'40\'}, 200).addClass("done_");
setTimeout(function(){$(".success_").animate({opacity: 0, top: \'0\'}, 200,function(){
$(this).removeClass("done_");
})}, 4000);
|
cef18d3a
Anastasia
- forms
|
203
|
}
|
298bc0f4
Alexey Boroda
first commit
|
204
|
}',
|
929c9486
alex
Поредактировал фо...
|
205
|
|
298bc0f4
Alexey Boroda
first commit
|
206
207
|
],
],
|
298bc0f4
Alexey Boroda
first commit
|
208
209
|
'params' => $params,
];
|
929c9486
alex
Поредактировал фо...
|
210
|
|