Commit 1d663433 authored by Евгений Мичкарев's avatar Евгений Мичкарев

Merge branch '29_04_16_fix_blog'

parents c64be59c a91ed0f3
...@@ -9,7 +9,7 @@ use common\modules\bids\models\Bid; ...@@ -9,7 +9,7 @@ use common\modules\bids\models\Bid;
<div class="hidden"> <div class="hidden">
<div id="article" class="popup popup_2 blog_form"> <div id="article" class="popup popup_2 blog_form">
<div class="txtbtnclose"><?=\Yii::t('blog', 'Close')?></div>
<span class="popup__title"><?=\Yii::t('blog', 'Suggest an article for the blog')?></span> <span class="popup__title"><?=\Yii::t('blog', 'Suggest an article for the blog')?></span>
<?php <?php
...@@ -81,7 +81,7 @@ use common\modules\bids\models\Bid; ...@@ -81,7 +81,7 @@ use common\modules\bids\models\Bid;
<div id="feedback" class="popup popup_2 blog_form_2"> <div id="feedback" class="popup popup_2 blog_form_2">
<!-- <div class="txtbtnclose">Закрыть</div> --> <div class="txtbtnclose"><?=\Yii::t('blog', 'Close')?></div>
<span class="popup__title"><?=\Yii::t('blog', 'Offer a subject')?></span> <span class="popup__title"><?=\Yii::t('blog', 'Offer a subject')?></span>
<p><strong><?=\Yii::t('blog', "We are ready to share our experience, let us know what a topic you're interested in.")?></strong></p> <p><strong><?=\Yii::t('blog', "We are ready to share our experience, let us know what a topic you're interested in.")?></strong></p>
<br> <br>
......
...@@ -8,6 +8,7 @@ use common\modules\blog\models\Post; ...@@ -8,6 +8,7 @@ use common\modules\blog\models\Post;
/* @var $this yii\web\View */ /* @var $this yii\web\View */
/* @var $model common\modules\blog\models\Post */ /* @var $model common\modules\blog\models\Post */
$this->registerJs("initScrollPager()", yii\web\View::POS_END);
?> ?>
<div class="blog_container"> <div class="blog_container">
......
...@@ -8,6 +8,7 @@ use common\modules\blog\models\Post; ...@@ -8,6 +8,7 @@ use common\modules\blog\models\Post;
/* @var $this yii\web\View */ /* @var $this yii\web\View */
/* @var $model common\modules\blog\models\Post */ /* @var $model common\modules\blog\models\Post */
$this->registerJs("initScrollPager()", yii\web\View::POS_END);
?> ?>
<div class="blog_container"> <div class="blog_container">
......
...@@ -6,6 +6,15 @@ use yii\helpers\Url; ...@@ -6,6 +6,15 @@ use yii\helpers\Url;
/* @var $this yii\web\View */ /* @var $this yii\web\View */
/* @var $model common\modules\blog\models\Post */ /* @var $model common\modules\blog\models\Post */
$this->registerJs("
$('.article_short_txt').find('img').click(function() {
$.magnificPopup.open({
items: {
src: $(this).attr('src')
},
type: 'image'
});
});", yii\web\View::POS_END);
?> ?>
......
...@@ -18,5 +18,6 @@ For example: write about CRM" => "Что хочу почитать? ...@@ -18,5 +18,6 @@ For example: write about CRM" => "Что хочу почитать?
'Load more' => 'Загрузить еще', 'Load more' => 'Загрузить еще',
'Read more...' => 'Читать...', 'Read more...' => 'Читать...',
'Follow us!' => 'Все секреты в наших соц сетях!', 'Follow us!' => 'Все секреты в наших соц сетях!',
'Offer a subject and we will publish about it' => 'Предложите свою тему и мы напишем' 'Offer a subject and we will publish about it' => 'Предложите свою тему и мы напишем',
'Close' => 'Закрыть'
]; ];
\ No newline at end of file
...@@ -58,6 +58,7 @@ use common\modules\bids\models\Bid; ...@@ -58,6 +58,7 @@ use common\modules\bids\models\Bid;
<?php ActiveForm::end(); ?> <?php ActiveForm::end(); ?>
</div> </div>
<?php echo \common\modules\users\widgets\LoginWidget::widget(); ?> <?php //todo ?? ?>
<?php echo \common\modules\users\widgets\RegistrationWidget::widget(); ?> <?php //echo \common\modules\users\widgets\LoginWidget::widget(); ?>
<?php //echo \common\modules\users\widgets\RegistrationWidget::widget(); ?>
</div> </div>
\ No newline at end of file
...@@ -13991,7 +13991,7 @@ a.appl_btn { ...@@ -13991,7 +13991,7 @@ a.appl_btn {
text-decoration: underline; text-decoration: underline;
} }
.article_short_txt { .article_short_txt {
overflow-x: auto;
} }
.article_short_txt img { .article_short_txt img {
margin: 14px 0 11px; margin: 14px 0 11px;
......
...@@ -310,7 +310,17 @@ $(document).ready(function() { ...@@ -310,7 +310,17 @@ $(document).ready(function() {
midClick: true, midClick: true,
removalDelay: 300, removalDelay: 300,
mainClass: 'my-mfp-zoom-in' mainClass: 'my-mfp-zoom-in',
callbacks: {
open: function() {
$('.mfp-close').mouseover(function() {
$(this).parent().find('.txtbtnclose').show();
}).mouseout(function() {
$(this).parent().find('.txtbtnclose').hide();
});
}
}
}); });
$(".toggle-mnu").click(function() { $(".toggle-mnu").click(function() {
$(this).toggleClass("on"); $(this).toggleClass("on");
......
...@@ -68,41 +68,7 @@ $(document).ready(function() { ...@@ -68,41 +68,7 @@ $(document).ready(function() {
return false; return false;
}); });
$('a#load-post').click(function() { $('a#load-post').click(loadPosts);
var button = $(this), loading = $('.loading-post'), offset = button.data('offset'), tag = button.data('tag');
button.hide();
loading.show();
$.ajax({
method: 'POST',
url: $(this).attr('href'),
data: {
offset: offset,
tag: tag
},
success: function(response)
{
$('.loaded').append(response.posts);
button.data('offset', response.offset);
if(response.count <= response.offset)
{
button.hide();
}
else
{
button.show();
}
loading.hide();
}
});
return false;
});
$.ajax({ $.ajax({
url: "/sessions/default/add" url: "/sessions/default/add"
...@@ -133,8 +99,60 @@ $(document).ready(function() { ...@@ -133,8 +99,60 @@ $(document).ready(function() {
}).on('submit', function(e){ }).on('submit', function(e){
return false; return false;
}); });
}); });
var loadProcess = false;
var allPostsLoaded = false;
function initScrollPager() {
var maxPosition = $(window).scrollTop();
$(window).scroll(function() {
var position = $(window).scrollTop() + $(window).height();
if(position >= maxPosition && position >= $(document).height() - 800 && !loadProcess && !allPostsLoaded) {
maxPosition = position;
loadPosts();
}
});
}
function loadPosts() {
var button = $('a#load-post'), loading = $('.loading-post'), offset = button.data('offset'), tag = button.data('tag');
$.ajax({
method: 'POST',
url: button.attr('href'),
data: {
offset: offset,
tag: tag
},
success: function(response) {
$('.loaded').append(response.posts);
button.data('offset', response.offset);
if(response.count <= response.offset) {
allPostsLoaded = true;
button.hide();
}
else {
button.show();
}
},
beforeSend: function() {
button.hide();
loading.show();
loadProcess = true;
}
}).done(function() {
loading.hide();
loadProcess = false;
});
return false;
}
if($('#chart-container').length > 0) if($('#chart-container').length > 0)
{ {
FusionCharts.ready(function () { FusionCharts.ready(function () {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment