Blame view

frontend/config/main.php 15.1 KB
0060a4ca   Anastasia   first commit
1
  <?php
14c89ea2   Anastasia   seo
2
      use frontend\components\SeoComponent;
0060a4ca   Anastasia   first commit
3
4
5
6
7
8
9
10
11
12
13
14
15
      use frontend\components\UrlManager;
      
      $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' )
      );
      
      return [
          'id'                  => 'app-frontend',
          'homeUrl'             => '/',
          'basePath'            => dirname(__DIR__),
44ac74b7   Anastasia   - add assets auto...
16
          'bootstrap'           => [ 'log', 'assetsAutoCompress', ],
0060a4ca   Anastasia   first commit
17
18
19
20
21
22
23
24
25
26
27
28
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
          'controllerNamespace' => 'frontend\controllers',
          'container' => [
              'singletons' => [
                  'artbox\core\services\Languages' =>'artbox\core\services\Languages',
              ]
          ],
          'modules'             => [
              'feedback' => [
                  'class'      => 'artbox\core\forms\Module',
                  'activeRecord' => "artbox\core\models\Feedback",
                  'attributes' => [
                      'name',
                      'email',
                      'message',
                  ],
                  'rules'           => [
                      [
                          [ 'email' ],
                          'email',
                      ],
                      [
                          [
                              'email',
                              'name',
                              'message',
                          ],
                          'required',
                      ],
                  ],
                  'labels'          => [
                      'email'   => 'Email',
                      'name'    => 'Name',
                      'message' => 'You question',
                  ],
                  'inputOptions'    => [
                      'message' => [
                          'type'    => 'textarea',
                          'options' => [],
                      ],
                  ],
                  'scenario'        => 'feedback',
                  'sendEmail'       => false,
                  'formId'          => 'feedback-form',
                  'ajax'            => true,
                  'successCallback' => 'function (data) {
                   document.getElementById("feedback-form").reset();
                                $(".close").click();
                                if (data.status == "success"){
                                
                                $(".success_").animate({opacity: 1, top: \'40\'}, 200).addClass("done_");
                                setTimeout(function(){$(".success_").animate({opacity: 0, top: \'0\'}, 200,function(){
                                    $(this).removeClass("done_");
                                })}, 4000);
                                }
                      }',
              ],
  
              'contact' => [
                  'class'      => 'artbox\core\forms\Module',
                  'activeRecord' => "artbox\core\models\Feedback",
                  'templateForm' => '<div class="row">{form}</div>',
                  'attributes' => [
                      'name',
                      'email',
                      'phone',
                       'message',
                  ],
                  'rules'      => [
                      [
                          [ 'email' ],
                          'email',
                      ],
                      [
                          [
                              'email',
                              'name',
                              'phone',
                          ],
                          'required',
                      ]
                  ],
                  'labels'     => [
                      'email'   => 'Email',
                      'name'    => 'Name',
                      'message' => 'Message',
                      'phone'   => 'Phone'
                  ],
      
                  'inputOptions'    => [
                      'name'   => [
                        'template' => '<div class="col-sm-12">{input}</div>'
                      ],
                      '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'   => [
                    'class' =>   'btn btn-template-main',
                  ],
                  'buttonContent'   => '<i class="fa fa-envelope-o"></i> Send message',
                  'sendEmail'       => false,
                  'ajax'            => true,
                  'formId'          => 'contact-form',
                  'scenario'        => 'default',
                  'successCallback' => 'function (data) {
                                document.getElementById("contact-form").innerHTML = "";
                                $(".close").click();
                                if (data.status == "success"){
                                $(".success_").animate({opacity: 1, top: \'40\'}, 200).addClass("done_");
                                setTimeout(function(){$(".success_").animate({opacity: 0, top: \'0\'}, 200,function(){
                                    $(this).removeClass("done_");
                                })}, 4000);
                                }
                      }',
                  
              ],
95f0b726   Anastasia   - comment answer ...
142
143
144
145
146
147
148
              'comments' => [
                  'class'      => 'artbox\core\forms\Module',
                  'activeRecord' => "common\models\Comment",
                  'attributes' => [
                      'name',
                      'email',
                      'comment',
8c8f7aeb   Anastasia   - blog view
149
150
                      'entity_id',
                      'entity',
95f0b726   Anastasia   - comment answer ...
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
                      'parent_id'
                  ],
                  'templateForm' => '<div class="style title-add-comments-form">Додати коментар</div>{form}',
                  'rules'      => [
                      [
                          [
                              'name',
                              'email',
                          ],
                          'required',
                      ]
                  ],
                  'labels'     => [
                      'name'    => 'Ім\'я',
                      'email' => 'Пошта',
                      'comment' => 'коментар',
8c8f7aeb   Anastasia   - blog view
167
168
                      'entity_id' => false,
                      'entity' => false,
95f0b726   Anastasia   - comment answer ...
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
                      'parent_id' => false
                  ],
      
                  'inputOptions'    => [
                      'name'   => [
                          'template' => '<div class="input-wr required">{input}</div>'
                      ],
                      'email'   => [
                          'template' => '<div class="input-wr required">{input}</div>'
                      ],
                      'comment' => [
                          'type'    => 'textarea',
                          'options' => [],
                          'template' => '<div class="input-wr">{input}</div>'
                      ],
                  ],
                  'buttonTemplate'  => '<div class="button-wr">{button}</div>',
                  'buttonOptions'   => [],
                  'buttonContent'   => 'Додати',
                  'sendEmail'       => false,
                  'ajax'            => true,
                  'formId'          => 'comment-form',
                  'scenario'        => 'default',
                  'successCallback' => 'function (data) {
                                document.getElementById("comment-form").reset();
                                $("#comment-form").parent().html("<p>Ваш коментар з\'явиться після перевірки модератором</p>")
                                $("#comment-form").remove();
                                
                      }',
  
              ],
              'commentsChild' => [
                  'class'      => 'artbox\core\forms\Module',
                  'activeRecord' => "common\models\Comment",
                  'attributes' => [
                      'name',
                      'email',
                      'comment',
8c8f7aeb   Anastasia   - blog view
207
208
                      'entity_id',
                      'entity',
95f0b726   Anastasia   - comment answer ...
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
                      'parent_id'
                  ],
                  'templateForm' => '<div class="style title-add-comments-form">Відповісти</div>{form}',
                  'rules'      => [
                      [
                          [
                              'name',
                              'email',
                          ],
                          'required',
                      ]
                  ],
                  'labels'     => [
                      'name'    => 'Ім\'я',
                      'email' => 'Пошта',
                      'comment' => 'коментар',
8c8f7aeb   Anastasia   - blog view
225
226
                      'entity_id' => false,
                      'entity' => false,
95f0b726   Anastasia   - comment answer ...
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
                      'parent_id' => false
                  ],
      
                  'inputOptions'    => [
                      'name'   => [
                          'template' => '<div class="input-wr required">{input}</div>'
                      ],
                      'email'   => [
                          'template' => '<div class="input-wr required">{input}</div>'
                      ],
                      'comment' => [
                          'type'    => 'textarea',
                          'options' => [],
                          'template' => '<div class="input-wr">{input}</div>'
                      ],
                  ],
                  'buttonTemplate'  => '<div class="button-wr">{button}</div>',
                  'buttonOptions'   => [],
                  'buttonContent'   => 'Додати',
                  'sendEmail'       => false,
                  'ajax'            => true,
                  'formId'          => 'answer-form',
                  'scenario'        => 'default',
                  'successCallback' => 'function (data) {
                                document.getElementById("answer-form").reset();
                                $("#answer-form").parent().html("<p>Ваш коментар з\'явиться після перевірки модератором</p>")
                                $("#answer-form").remove();
                                
                      }',
  
              ],
0060a4ca   Anastasia   first commit
258
259
          ],
          'components'          => [
9afd152f   Anastasia   - support from main
260
261
              'assetManager'       => [
                  'bundles'         => [
94a12acc   Anastasia   - disable css boo...
262
263
264
                      'yii\bootstrap\BootstrapAsset' => [
                          'css' => []
                      ],
9afd152f   Anastasia   - support from main
265
266
267
268
269
270
271
272
273
274
                      // new version gentenella
  //                    'kartik\select2\Select2Asset' => [
  //                        'css'       => [],
  //                    ],
  //                    'kartik\select2\ThemeKrajeeAsset' => [
  //                        'css' => []
  //                    ]
                  ],
                  'appendTimestamp' => true,
              ],
8f340aa7   Anastasia   - main page
275
276
              'user'               => [
                  'identityClass'   => 'common\models\Author',
0060a4ca   Anastasia   first commit
277
278
279
280
281
282
                  'enableAutoLogin' => true,
                  'identityCookie'  => [
                      'name'     => '_identity-frontend',
                      'httpOnly' => true,
                  ],
              ],
8f340aa7   Anastasia   - main page
283
284
285
286
              'request'      => [
                  'csrfParam' => '_csrf-frontend',
                  'baseUrl'   => '',
              ],
0060a4ca   Anastasia   first commit
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
              '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',
              ],
              'urlManager'   => [
                  'class'           => UrlManager::className(),
                  'baseUrl'         => '/',
                  'enablePrettyUrl' => true,
1b785495   alex   404 на / в конце
313
  
0060a4ca   Anastasia   first commit
314
315
316
317
                  'showScriptName'  => false,
                  'rules'           => [],
                  'hideDefaultLanguagePrefix' => true,
              ],
44ac74b7   Anastasia   - add assets auto...
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
              'assetsAutoCompress' => [
                  'class'   => '\skeeks\yii2\assetsAuto\AssetsAutoCompressComponent',
                  'enabled' => true,
      
                  'readFileTimeout' => 3,
                  //Time in seconds for reading each asset file
      
                  'jsCompress'                => true,
                  //Enable minification js in html code
                  'jsCompressFlaggedComments' => true,
                  //Cut comments during processing js
      
                  'cssCompress' => true,
                  //Enable minification css in html code
      
                  'cssFileCompile'        => true,
                  //Turning association css files
                  'cssFileRemouteCompile' => false,
                  //Trying to get css files to which the specified path as the remote file, skchat him to her.
                  'cssFileCompress'       => true,
                  //Enable compression and processing before being stored in the css file
                  'cssFileBottom'         => false,
                  //Moving down the page css files
                  'cssFileBottomLoadOnJs' => false,
                  //Transfer css file down the page and uploading them using js
      
                  'jsFileCompile'                 => true,
                  //Turning association js files
                  'jsFileRemouteCompile'          => false,
                  //Trying to get a js files to which the specified path as the remote file, skchat him to her.
                  'jsFileCompress'                => true,
                  //Enable compression and processing js before saving a file
                  'jsFileCompressFlaggedComments' => true,
                  //Cut comments during processing js
      
                  'htmlCompress'           => true,
                  //Enable compression html
                  'noIncludeJsFilesOnPjax' => true,
                  //Do not connect the js files when all pjax requests
abe4455d   Anastasia   html compress
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
                  'htmlFormatter' => [
                      //Enable compression html
                      'class'         => 'skeeks\yii2\assetsAuto\formatters\html\TylerHtmlCompressor',
                      'extra'         => false,       //use more compact algorithm
                      'noComments'    => true,        //cut all the html comments
                      'maxNumberRows' => 50000,       //The maximum number of rows that the formatter runs on
      
                      //or
      
                      //                    'class' => 'skeeks\yii2\assetsAuto\formatters\html\MrclayHtmlCompressor',
      
                      //or any other your handler implements skeeks\yii2\assetsAuto\IFormatter interface
      
                      //or false
                  ],
44ac74b7   Anastasia   - add assets auto...
372
              ],
0060a4ca   Anastasia   first commit
373
374
375
376
          ],
          
          'params'              => $params,
      ];