Skip to content

Commit

Permalink
Fix Status filter JS
Browse files Browse the repository at this point in the history
  • Loading branch information
tafid committed Jan 11, 2016
1 parent 13b18be commit e2e4189
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 42 deletions.
36 changes: 1 addition & 35 deletions src/assets/DomainCheckPluginAssets/js/DomainCheckPlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,41 +3,7 @@
defaults = {
domainRowClass: ".check-item",
finally: function() {
// init Isotope
var grid = $('.domain-list').isotope({
itemSelector: '.domain-iso-line',
layout: 'vertical'
});
// store filter for each group
var filters = {};

$('.filters').on('click', 'a', function() {
// get group key
var $buttonGroup = $(this).parents('.nav');
var $filterGroup = $buttonGroup.attr('data-filter-group');
// set filter for group
filters[$filterGroup] = $(this).attr('data-filter');
// combine filters
var filterValue = concatValues(filters);
// set filter for Isotope
grid.isotope({filter: filterValue});
});
// change is-checked class on buttons
$('.nav').each(function(i, buttonGroup) {
$(buttonGroup).on( 'click', 'a', function(event) {
$(buttonGroup).find('.active').removeClass('active');
$(this).parents('li').addClass('active');
});
});
// flatten object by concatting values
function concatValues(obj) {
var value = '';
for (var prop in obj) {
value += obj[prop];
}

return value;
}
console.log('Done!');
}
};

Expand Down
53 changes: 46 additions & 7 deletions src/views/domain/checkDomain.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

DomainCheckPluginAsset::register($this);
hipanel\frontend\assets\IsotopeAsset::register($this);
Yii::$app->assetManager->forceCopy = true; // todo: remove this string
//Yii::$app->assetManager->forceCopy = true; // todo: remove this string
$this->title = Yii::t('app', 'Domain check');
$this->breadcrumbs->setItems([
$this->title,
Expand All @@ -25,8 +25,47 @@
domainRowClass: '.domain-line',
success: function(data, domain, element) {
var $elem = $(element).find("div[data-domain='" + domain + "']");
$elem.replaceWith($(data).find('.domain-line'));
var $parentElem = $(element).find("div[data-domain='" + domain + "']").parents('div.domain-iso-line').eq(0);
$elem.html($(data).find('.domain-line'));
$parentElem.attr('class', $(data).attr('class'));
return this;
},
finally: function() {
// init Isotope
var grid = $('.domain-list').isotope({
itemSelector: '.domain-iso-line',
layout: 'vertical'
});
// store filter for each group
var filters = {};
$('.filters').on('click', 'a', function() {
// get group key
var $buttonGroup = $(this).parents('.nav');
var $filterGroup = $buttonGroup.attr('data-filter-group');
// set filter for group
filters[$filterGroup] = $(this).attr('data-filter');
// combine filters
var filterValue = concatValues(filters);
// set filter for Isotope
grid.isotope({filter: filterValue});
});
// change is-checked class on buttons
$('.nav').each(function(i, buttonGroup) {
$(buttonGroup).on( 'click', 'a', function(event) {
$(buttonGroup).find('.active').removeClass('active');
$(this).parents('li').addClass('active');
});
});
// flatten object by concatting values
function concatValues(obj) {
var value = '';
for (var prop in obj) {
value += obj[prop];
}
return value;
}
}
});
JS
Expand Down Expand Up @@ -157,7 +196,7 @@ class="col-md-2"><?= Html::submitButton(Yii::t('app', 'Search'), ['class' => 'bt
html { overflow-y: scroll; }
.domain-line {
border-bottom: 1px solid #f2f2f2;
margin-bottom: 10px;
/*margin-bottom: 10px;*/
line-height: 59px;
height: 60px;
font-size: 18px;
Expand All @@ -179,10 +218,10 @@ class="col-md-2"><?= Html::submitButton(Yii::t('app', 'Search'), ['class' => 'bt
clear: both;
}

.domain-line:last-child {
border-bottom: 0;
margin-bottom: 0;
}
/*.domain-line:last-child {*/
/*border-bottom: 0;*/
/*margin-bottom: 0;*/
/*}*/

.domain-line:hover {
border-color: #CCC;
Expand Down

0 comments on commit e2e4189

Please sign in to comment.