Skip to content

Fixed aliases for images and fixed broken preloader #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion views/default/galleryItem.php
Original file line number Diff line number Diff line change
@@ -38,7 +38,7 @@
<a class="image-wrap" href="<?= Url::toRoute(["view", 'id'=>$model->gallery_id]) ?>">
<?php
foreach($model->galleryPhotos as $prevPhoto){
echo \yii\helpers\Html::img('/img/gallery/' . Translator::rus2translit($model->name) . '/thumb/' . $prevPhoto->name);
echo \yii\helpers\Html::img(Yii::getAlias('@web') . '/img/gallery/' . Translator::rus2translit($model->name) . '/thumb/' . $prevPhoto->name);
};
?>
</a>
13 changes: 7 additions & 6 deletions views/default/view.php
Original file line number Diff line number Diff line change
@@ -22,11 +22,11 @@
$this->registerJs(<<<JS
$('#preloader').show();
$('body').css('overflow', 'hidden');
window.onload = function() {
$('body').css('overflow', 'auto');
$(document).ready(function() {
$('body').css('overflow', 'auto');
$('#preloader').hide();
};
$("[data-toggle='tooltip']").tooltip();
});
$("[data-toggle='tooltip']").tooltip();
JS
);
echo Html::beginTag('div', ['class' => 'gallery-view']);
@@ -47,8 +47,8 @@
foreach ($photos as $photo) {
$items[] =
[
'original' => '/img/gallery/' . Translator::rus2translit($galleryName) . '/' . $photo->name,
'thumbnail' => '/img/gallery/' . Translator::rus2translit($galleryName) . '/thumb/' . $photo->name,
'original' => Yii::getAlias('@web') . '/img/gallery/' . Translator::rus2translit($galleryName) . '/' . $photo->name,
'thumbnail' => Yii::getAlias('@web') . '/img/gallery/' . Translator::rus2translit($galleryName) . '/thumb/' . $photo->name,
'options' => [
'title' => $galleryName,
'data-id' => $photo->photo_id,
@@ -152,6 +152,7 @@
});

inputField.on('fileunlock', function(event, data, previewId, index) {
inputField.fileinput('upload');
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fileunlock event is triggered when the upload process is completed (successfully or with error). Why do we need to call upload?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does not upload at all.
All that happens on my side is it reloads - without a POST.
When I call the upload function - it uploads with no errors.

According to the documentation - this is only triggered after an upload - I understood this wrong. However - its not uploading at all.
https://plugins.krajee.com/file-input/plugin-events#fileunlock

Please allow me a few minutes to fix this.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also - the preloader just loads into infinity.
If I use JQuery - it works like a charm.

location.reload();
});
});