Last active
December 28, 2015 06:09
-
-
Save venomjke/7454875 to your computer and use it in GitHub Desktop.
generation table with columns
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="editprofile-content shop-categories"> | |
<table> | |
<?php if (count($products_categories) > 0): ?> | |
<tr> | |
<td> | |
<?php $i = 0; ?> | |
<?php foreach($products_categories as $category): ?> | |
<?php if ($i != 0 && $i % (count($products_categories)/2) == 0): ?> | |
</td> | |
<td> | |
<?php endif ?> | |
<div class="editprofile-item"> | |
<div data-category-id="<?php echo $category->id; ?>" data-edit-category-url="<?php echo site_url('company/edit/shop/' . $company->id . '/edit/category/' . $category->id); ?>" data-delete-category-url="<?php echo site_url('company/edit/shop/' . $company->id . '/del/category/'); ?>" class="editprofile-controls"> | |
<a href="#" class="" onclick="return company.shop.editCategory($(this).parent());"> | |
<img src="/assets/site/images/icon16/edit.png" alt="Редактировать категорию" title="Редактировать категорию"> | |
</a> | |
<a href="#" class="" onclick="return company.shop.delCategory($(this).parent());"> | |
<img src="/assets/site/images/icon16/cross.png" alt="" title="Удалить категорию"> | |
</a> | |
</div> | |
<input id="del-category-<?php echo $category->id; ?>" type="checkbox" class="del-categories" value="<?php echo $category->id; ?>"> | |
<label for="del-category-<?php echo $category->id; ?>"><?php echo $category->name; ?></label> | |
</div> | |
<?php ++$i; ?> | |
<?php | |
endforeach; ?> | |
</td> | |
</tr> | |
<?php else: ?> | |
<tr> | |
<td>Пока не добавлено ни одной категории.</td> | |
</tr> | |
<?php endif; ?> | |
</table> | |
<script type="text/javascript"> | |
$(function(){ | |
var width = 100; | |
var countItems = $('.shop-categories > table tr > td').length; | |
$('.shop-categories > table tr > td').each(function(){ | |
$(this).css('width', width / countItems + '%'); | |
}); | |
}); | |
</script> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment