Commit ed4ee1f2650901f2ccddfe1ad022f42aefa0070a
1 parent
3faf12ee
test
Showing
7 changed files
with
37 additions
and
16 deletions
Show diff stats
common/modules/comment/widgets/CommentWidget.php
| ... | ... | @@ -218,7 +218,7 @@ |
| 218 | 218 | 'date_add' => SORT_DESC, |
| 219 | 219 | ], |
| 220 | 220 | ])), |
| 221 | - 'pagination' => ArrayHelper::remove($this->provider_options, 'query', [ | |
| 221 | + 'pagination' => ArrayHelper::remove($this->provider_options, 'pagination', [ | |
| 222 | 222 | 'pageSize' => 10, |
| 223 | 223 | ]), |
| 224 | 224 | ]); | ... | ... |
common/modules/fileloader/controllers/FileloaderController.php
| ... | ... | @@ -4,6 +4,7 @@ |
| 4 | 4 | use common\modules\fileloader\models\Fileloader; |
| 5 | 5 | use yii\filters\AccessControl; |
| 6 | 6 | use yii\helpers\Html; |
| 7 | + use yii\web\ForbiddenHttpException; | |
| 7 | 8 | use yii\web\UploadedFile; |
| 8 | 9 | |
| 9 | 10 | class FileloaderController extends \yii\web\Controller |
| ... | ... | @@ -15,15 +16,15 @@ |
| 15 | 16 | public function behaviors() |
| 16 | 17 | { |
| 17 | 18 | return [ |
| 18 | - 'access' => [ | |
| 19 | - 'class' => AccessControl::className(), | |
| 20 | - 'rules' => [ | |
| 21 | - [ | |
| 22 | - 'allow' => true, | |
| 23 | - 'roles' => [ '@' ], | |
| 24 | - ], | |
| 25 | - ], | |
| 26 | - ], | |
| 19 | +// 'access' => [ | |
| 20 | +// 'class' => AccessControl::className(), | |
| 21 | +// 'rules' => [ | |
| 22 | +// [ | |
| 23 | +// 'allow' => true, | |
| 24 | +// 'roles' => [ '@' ], | |
| 25 | +// ], | |
| 26 | +// ], | |
| 27 | +// ], | |
| 27 | 28 | 'verbs' => [ |
| 28 | 29 | 'class' => \yii\filters\VerbFilter::className(), |
| 29 | 30 | 'actions' => [ |
| ... | ... | @@ -80,6 +81,9 @@ |
| 80 | 81 | /** |
| 81 | 82 | * @var Fileloader $model |
| 82 | 83 | */ |
| 84 | + if(empty(\Yii::$app->user->identity)) { | |
| 85 | + throw new ForbiddenHttpException(); | |
| 86 | + } | |
| 83 | 87 | $request = \Yii::$app->request; |
| 84 | 88 | $response = \Yii::$app->response; |
| 85 | 89 | $response->format = $response::FORMAT_JSON; | ... | ... |
common/modules/fileloader/resources/handler.js
| ... | ... | @@ -17,11 +17,18 @@ $(function() { |
| 17 | 17 | if(!data.result.error) { |
| 18 | 18 | var id = data.result.result.id; |
| 19 | 19 | var input = $('#'+id); |
| 20 | + var multiple = $(input).attr('multiple') !== undefined; | |
| 20 | 21 | var wrapper = $(input).parents('.fileloader-wrapper').first(); |
| 21 | 22 | var html = '<div class="fileloader-item-wrapper" data-id="'+data.result.result.file_id+'">'+ |
| 22 | 23 | data.result.result.input + '<p class="fileloader-item-name">'+ |
| 23 | 24 | '<a href="'+data.result.result.file_href+'" target="_blank">'+data.result.result.file_name+'</a></p>'+'<span class="fileloader-item-remove glyphicon glyphicon-remove"></span>'+ |
| 24 | 25 | '</div>'; |
| 26 | + if(!multiple) { | |
| 27 | + var inputs = $(wrapper).find('.fileloader-item-remove'); | |
| 28 | + $.each(inputs, function(i, v) { | |
| 29 | + $(v).trigger('click'); | |
| 30 | + }); | |
| 31 | + } | |
| 25 | 32 | $(html).appendTo($(wrapper).find('.fileloader-list')); |
| 26 | 33 | } |
| 27 | 34 | } | ... | ... |
frontend/controllers/AjaxController.php
| ... | ... | @@ -178,7 +178,7 @@ |
| 178 | 178 | $model = new Feedback(); |
| 179 | 179 | if($model->load($request->post())) { |
| 180 | 180 | if($model->save()) { |
| 181 | - return ['result' => ['message' => 'Success']]; | |
| 181 | + return ['result' => ['message' => 'Вопрос успешно отправлен, ответ будет отправлен на Вашу почту']]; | |
| 182 | 182 | } |
| 183 | 183 | } |
| 184 | 184 | $form = $this->renderAjax('feedback_form', [ 'model' => $model ]); | ... | ... |
frontend/views/tender/view.php
| ... | ... | @@ -287,6 +287,11 @@ $this->title = 'My Yii Application'; |
| 287 | 287 | 'guestComment' => false, |
| 288 | 288 | 'status' => \common\modules\comment\models\Comment::STATUS_ACTIVE, |
| 289 | 289 | ], |
| 290 | + 'provider_options' => [ | |
| 291 | + 'pagination' => [ | |
| 292 | + 'pageSize' => 2, | |
| 293 | + ], | |
| 294 | + ], | |
| 290 | 295 | 'success_options' => [ |
| 291 | 296 | 'tag' => 'div', |
| 292 | 297 | 'content' => 'Вопрос успешно создан и появится как только будет получен ответ', | ... | ... |
frontend/web/css/style.css
| ... | ... | @@ -8113,4 +8113,7 @@ li.active-menu-admin:hover a .ico_num { |
| 8113 | 8113 | padding-bottom: 0; |
| 8114 | 8114 | border-bottom: 0; |
| 8115 | 8115 | } |
| 8116 | -.has-child .artbox_comment_container .comments-content:before {display: none} | |
| 8117 | 8116 | \ No newline at end of file |
| 8117 | +.has-child .artbox_comment_container .comments-content:before {display: none} | |
| 8118 | +.hidden { | |
| 8119 | + display: none; | |
| 8120 | +} | |
| 8118 | 8121 | \ No newline at end of file | ... | ... |
frontend/web/js/forms.js
| ... | ... | @@ -117,7 +117,6 @@ $(document).ready( |
| 117 | 117 | function(e) |
| 118 | 118 | { |
| 119 | 119 | e.preventDefault() |
| 120 | - console.log('dsadasdaS'); | |
| 121 | 120 | addRemoveBlocks() |
| 122 | 121 | addContacts() |
| 123 | 122 | } |
| ... | ... | @@ -593,15 +592,18 @@ $(document).ready( |
| 593 | 592 | |
| 594 | 593 | // Remove error for no client validation fields |
| 595 | 594 | $(document).on('change', '.no-client-validation', function() { |
| 596 | - console.log('debug'); | |
| 597 | 595 | $(this).parent().find('.help-block').hide(); |
| 598 | 596 | }); |
| 599 | 597 | |
| 600 | 598 | $(document).on('submit', '.feedback_form', function(e) { |
| 601 | 599 | e.preventDefault(); |
| 602 | - console.log('event'); | |
| 603 | 600 | $.post('/ajax/post-feedback', $(this).serialize(), function(data) { |
| 604 | - console.log(data); | |
| 601 | + if(data.error) { | |
| 602 | + $('.forms-modal-hide').empty().append(data.result.form); | |
| 603 | + } else { | |
| 604 | + addRemoveBlocks(); | |
| 605 | + alert(data.result.message); | |
| 606 | + } | |
| 605 | 607 | }); |
| 606 | 608 | }); |
| 607 | 609 | ... | ... |