|
|
|
@ -165,42 +165,60 @@ |
|
|
|
{% endif %} |
|
|
|
{% endif %} |
|
|
|
|
|
|
|
|
|
|
|
<div class="galleryWork2 disTab"> |
|
|
|
<div class="galleryWork2 disTab"> |
|
|
|
{% for p in contractor.portfolios.all %} |
|
|
|
{% if False %} |
|
|
|
<div class="col-lg-4"> |
|
|
|
{% for p in contractor.portfolios.all %} |
|
|
|
<div class="insetCol box-sizing disTab"> |
|
|
|
<div class="col-lg-4"> |
|
|
|
{% thumbnail p.get_cover "224x224" crop="center" as im %} |
|
|
|
<div class="insetCol box-sizing disTab"> |
|
|
|
<div class="imgGal" |
|
|
|
{% thumbnail p.get_cover "224x224" crop="center" as im %} |
|
|
|
style="background:rgba(0, 0, 0, 0) url('{{ im.url }}') no-repeat scroll center center / cover ;"> |
|
|
|
<div class="imgGal" |
|
|
|
<a class="open-modal-image" href="{{ p.get_cover.url }}"><div class="imgFigure"></div></a> |
|
|
|
style="background:rgba(0, 0, 0, 0) url('{{ im.url }}') no-repeat scroll center center / cover ;"> |
|
|
|
</div> |
|
|
|
<a class="open-modal-image" href="{{ p.get_cover.url }}"><div class="imgFigure"></div></a> |
|
|
|
{% endthumbnail %} |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
{% endthumbnail %} |
|
|
|
<div class="insetCol2 box-sizing disTab"> |
|
|
|
</div> |
|
|
|
<a href="{% url 'projects:contractor-portfolio-detail' p.pk %}">{{ p }}</a> |
|
|
|
|
|
|
|
{% if request.user.pk == contractor.pk %} |
|
|
|
<div class="insetCol2 box-sizing disTab"> |
|
|
|
<div class="buttonsImg" disTab> |
|
|
|
<a href="{% url 'projects:contractor-portfolio-detail' p.pk %}">{{ p }}</a> |
|
|
|
<a href="{% url 'projects:contractor-portfolio-edit' p.pk %}"> |
|
|
|
|
|
|
|
<div class="insetBI insetBI1"> |
|
|
|
{% if request.user.pk == contractor.pk %} |
|
|
|
<i class="fa fa-pencil"></i> |
|
|
|
<div class="buttonsImg" disTab> |
|
|
|
|
|
|
|
<a href="{% url 'projects:contractor-portfolio-edit' p.pk %}"> |
|
|
|
|
|
|
|
<div class="insetBI insetBI1"> |
|
|
|
|
|
|
|
<i class="fa fa-pencil"></i> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
</a> |
|
|
|
|
|
|
|
<div class="insetBI insetBI2"> |
|
|
|
|
|
|
|
<form action="{% url 'projects:contractor-portfolio-trash' pk=p.pk %}" method="POST" novalidate> |
|
|
|
|
|
|
|
{% csrf_token %} |
|
|
|
|
|
|
|
<input type="hidden" name="next" value="{{ request.path }}"> |
|
|
|
|
|
|
|
<a href="#" onclick="$(this).closest('form').submit(); return false"><i class="fa fa-times"></i></a> |
|
|
|
|
|
|
|
</form> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</a> |
|
|
|
|
|
|
|
<div class="insetBI insetBI2"> |
|
|
|
|
|
|
|
<form action="{% url 'projects:contractor-portfolio-trash' pk=p.pk %}" method="POST" novalidate> |
|
|
|
|
|
|
|
{% csrf_token %} |
|
|
|
|
|
|
|
<input type="hidden" name="next" value="{{ request.path }}"> |
|
|
|
|
|
|
|
<a href="#" onclick="$(this).closest('form').submit(); return false"><i class="fa fa-times"></i></a> |
|
|
|
|
|
|
|
</form> |
|
|
|
|
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
{% endif %} |
|
|
|
{% endif %} |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
{% empty %} |
|
|
|
{% empty %} |
|
|
|
<div class="col-lg-4"> |
|
|
|
<div class="col-lg-4"> |
|
|
|
<p style="text-align: center;">Работ в портфолио пока нет</p> |
|
|
|
<p style="text-align: center;">Работ в портфолио пока нет</p> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
{% endfor %} |
|
|
|
{% endfor %} |
|
|
|
{% endif %} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<script type="text/template" class="-portfolio-item-templ"> |
|
|
|
|
|
|
|
{# <div class="col-lg-4">#} |
|
|
|
|
|
|
|
{# <div class="insetCol box-sizing disTab">#} |
|
|
|
|
|
|
|
{# <div class="imgGal" style="background:rgba(0, 0, 0, 0) url('<%= portfolio.photos[0].img %>') no-repeat scroll center center / cover">#} |
|
|
|
|
|
|
|
{# <div class="imgFigure"></div>#} |
|
|
|
|
|
|
|
{# </div>#} |
|
|
|
|
|
|
|
{# </div>#} |
|
|
|
|
|
|
|
{# #} |
|
|
|
|
|
|
|
{# <div class="insetCol2 box-sizing disTab text-center">#} |
|
|
|
|
|
|
|
{# <a href="<%= portfAbsUrl %>"><%= trunc({length: 50}, portfolio.name) %></a>#} |
|
|
|
|
|
|
|
{# </div>#} |
|
|
|
|
|
|
|
{# </div>#} |
|
|
|
|
|
|
|
</script> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<div class="col-lg-9 col-lg-offset-3"> |
|
|
|
<div class="col-lg-9 col-lg-offset-3"> |
|
|
|
@ -793,4 +811,82 @@ |
|
|
|
return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method)); |
|
|
|
return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method)); |
|
|
|
} |
|
|
|
} |
|
|
|
</script> |
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- Pagination ------------------------------------------------------------> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<script> |
|
|
|
|
|
|
|
(function() { |
|
|
|
|
|
|
|
var $portfoliosContainer = $('.-portfolios-container').first() |
|
|
|
|
|
|
|
var portfolioItemTempl = _.template($portfoliosContainer.find('.-portfolio-item-templ').first().html()) |
|
|
|
|
|
|
|
var $morePortfBtn = $('.-more-portfolios-btn').first() |
|
|
|
|
|
|
|
var portfAbsUrl = '/projects/portfolio/' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var $workSellsContainer = $('.-work-sells-container').first() |
|
|
|
|
|
|
|
var workSellItemTempl = _.template($workSellsContainer.find('.-work-sell-item-templ').first().html()) |
|
|
|
|
|
|
|
var $moreWorkSellsfBtn = $('.-more-work-sells-btn').first() |
|
|
|
|
|
|
|
var workSellAbsUrl = '/work_sell/' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var teamId = {{ contractor.team.pk }} |
|
|
|
|
|
|
|
var contractorIds |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var portfUrl = new URI('/api/portfolios/') |
|
|
|
|
|
|
|
var workSellUrl = new URI('/api/work-sells/') |
|
|
|
|
|
|
|
var pageSize = 3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$.get('/api/teams/' + teamId + '/').then(function(res) { |
|
|
|
|
|
|
|
contractorIds = _.map(function(contractor) { |
|
|
|
|
|
|
|
return contractor.id |
|
|
|
|
|
|
|
}, res.contractors) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
.then(loadMorePortfolios) |
|
|
|
|
|
|
|
.then(loadMoreWorkSells) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function loadMorePortfolios() { |
|
|
|
|
|
|
|
var query = portfUrl.query(true) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
portfUrl.setQuery('user__id__in', _.join(',', contractorIds)) |
|
|
|
|
|
|
|
portfUrl.setQuery('page_size', pageSize) |
|
|
|
|
|
|
|
portfUrl.setQuery('page', query.page ? Number(query.page) + 1 : 2) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$.get(portfUrl.href()).then(function(res) { |
|
|
|
|
|
|
|
_.each(function(portfolio) { |
|
|
|
|
|
|
|
$portfoliosContainer.append(portfolioItemTempl({ |
|
|
|
|
|
|
|
portfolio: portfolio, |
|
|
|
|
|
|
|
portfAbsUrl: portfAbsUrl + portfolio.id + '/', |
|
|
|
|
|
|
|
trunc: _.truncate, |
|
|
|
|
|
|
|
})) |
|
|
|
|
|
|
|
}, res.results) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!res.next) |
|
|
|
|
|
|
|
$morePortfBtn.css('display', 'none') |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function loadMoreWorkSells() { |
|
|
|
|
|
|
|
var query = workSellUrl.query(true) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
workSellUrl.setQuery('contractor__in', _.join(',', contractorIds)) |
|
|
|
|
|
|
|
workSellUrl.setQuery('page_size', pageSize) |
|
|
|
|
|
|
|
workSellUrl.setQuery('page', query.page ? Number(query.page) + 1 : 2) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$.get(workSellUrl.href()).then(function(res) { |
|
|
|
|
|
|
|
_.each(function(ws) { |
|
|
|
|
|
|
|
$workSellsContainer.append(workSellItemTempl({ |
|
|
|
|
|
|
|
workSell: ws, |
|
|
|
|
|
|
|
workSellAbsUrl: workSellAbsUrl + ws.id + '/', |
|
|
|
|
|
|
|
trunc: _.truncate, |
|
|
|
|
|
|
|
})) |
|
|
|
|
|
|
|
}, res.results) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!res.next) |
|
|
|
|
|
|
|
$moreWorkSellsfBtn.css('display', 'none') |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
window.loadMorePortfolios = loadMorePortfolios |
|
|
|
|
|
|
|
window.loadMoreWorkSells = loadMoreWorkSells |
|
|
|
|
|
|
|
}()) |
|
|
|
|
|
|
|
</script> |
|
|
|
{% endblock %} |
|
|
|
{% endblock %} |
|
|
|
|