remotes/origin/PR-39
ArturBaybulatov 9 years ago
parent 0850b10273
commit cd61dba858
  1. 3
      assets/css/extra.css
  2. 57
      assets/index.js
  3. 14
      projects/templates/project_detail.html

@ -240,3 +240,6 @@ li a:active .count-tab, li a:hover .count-tab{
color: white; color: white;
} }
.select2-drop {
width: 400px !important;
}

@ -51,7 +51,6 @@ $('[data-tooltip]').tooltip({
results: _.map(function(item) { results: _.map(function(item) {
return { return {
id: item.id, id: item.id,
//text: item.name,
text: _.repeat(item.level-1, '---') + item.name, text: _.repeat(item.level-1, '---') + item.name,
origItem: item, origItem: item,
} }
@ -146,6 +145,34 @@ $('[data-tooltip]').tooltip({
placeholder: 'Выберите специализацию', // Required by `allowClear` placeholder: 'Выберите специализацию', // Required by `allowClear`
allowClear: true, allowClear: true,
ajax: {
url: '/api/specializations/',
dataType: 'json',
quietMillis: 250,
cache: true,
data: function(term, page) {
return {
name__icontains: term,
page: page,
}
},
results: function(data, page) {
return {
results: _.map(function(item) {
return {
id: item.id,
text: _.repeat(item.level-1, '---') + item.name,
origItem: item,
}
}, data.results),
more: (page * API_PAGE_SIZE) < data.count,
}
},
},
//initSelection: function(element, callback) { //initSelection: function(element, callback) {
// var id = $(element).val() // var id = $(element).val()
// //
@ -185,30 +212,20 @@ $('[data-tooltip]').tooltip({
function initSimpleSpecSelect2($select, specId) { function initSimpleSpecSelect2($select, specId) {
return $.ajax({url: '/api/specializations/', method: 'GET', dataType: 'json'}) $select.select2(simpleSpecSelectsOptions)
.then(function(res) {
var specs = res.results if (specId) {
return $.get(format('/api/specializations/%s/', specId))
$select.select2(_.merge(simpleSpecSelectsOptions, { .then(function(spec) {
data: _.map(function(spec) {
return {
id: spec.id,
text: _.repeat(spec.level-1, '---') + spec.name,
origItem: spec,
}
}, specs),
}))
if (specId) {
var spec = _.find({id: specId}, specs)
$select.select2('data', { $select.select2('data', {
id: spec.id, id: spec.id,
text: _.repeat(spec.level-1, '---') + spec.name, text: _.repeat(spec.level-1, '---') + spec.name,
origItem: spec, origItem: spec,
}) })
} })
}) } else {
return $.when()
}
} }
}()) }())

@ -345,14 +345,14 @@
<div class="col-lg-10 col-lg-offset-1 {% if not message.is_sender_customer %}-highlighted-message{% endif %}"> <div class="col-lg-10 col-lg-offset-1 {% if not message.is_sender_customer %}-highlighted-message{% endif %}">
{% if message.is_sender_customer %} {% if message.is_sender_customer %}
<p class="nameComm"> <p class="nameComm">
{% firstof project.customer.get_full_name.strip project.customer.username %} | seen?: {{ message.seen_by_contractor }} {% firstof project.customer.get_full_name.strip project.customer.username %}
</p> </p>
{% else %} {% else %}
<p class="nameComm nameCommAct"> <p class="nameComm nameCommAct">
{% if answer.author|class_name == 'User' %} {% if answer.author|class_name == 'User' %}
{% firstof answer.author.get_full_name.strip answer.author.username %} | seen?: {{ message.seen_by_contractor }} {% firstof answer.author.get_full_name.strip answer.author.username %}
{% elif answer.author|class_name == 'Team' %} {% elif answer.author|class_name == 'Team' %}
{% firstof answer.author.name.strip answer.author.owner.username %} | seen?: {{ message.seen_by_contractor }} {% firstof answer.author.name.strip answer.author.owner.username %}
{% endif %} {% endif %}
</p> </p>
{% endif %} {% endif %}
@ -651,7 +651,7 @@
<p> <p>
{% if answer.term_type == 'project' %} {% if answer.term_type == 'project' %}
Срок: <span>За проект</span> Срок: <span>За проект</span>
{% else %} {% elif answer.term and answer.term_type %}
Срок: <span>{% morph answer.term TERM_TYPE_MORPHS|get:answer.term_type %}</span> Срок: <span>{% morph answer.term TERM_TYPE_MORPHS|get:answer.term_type %}</span>
{% endif %} {% endif %}
</p> </p>
@ -718,14 +718,14 @@
<div class="col-lg-10 col-lg-offset-1 {% if message.is_sender_customer %}-highlighted-message{% endif %}"> <div class="col-lg-10 col-lg-offset-1 {% if message.is_sender_customer %}-highlighted-message{% endif %}">
{% if message.is_sender_customer %} {% if message.is_sender_customer %}
<p class="nameComm nameCommAct"> <p class="nameComm nameCommAct">
{% firstof project.customer.get_full_name.strip project.customer.username %} | seen?: {{ message.seen_by_customer }} {% firstof project.customer.get_full_name.strip project.customer.username %}
</p> </p>
{% else %} {% else %}
<p class="nameComm"> <p class="nameComm">
{% if answer.author|class_name == 'User' %} {% if answer.author|class_name == 'User' %}
{% firstof answer.author.get_full_name.strip answer.author.username %} | seen?: {{ message.seen_by_customer }} {% firstof answer.author.get_full_name.strip answer.author.username %}
{% elif answer.author|class_name == 'Team' %} {% elif answer.author|class_name == 'Team' %}
{% firstof answer.author.name.strip answer.author.owner.username %} | seen?: {{ message.seen_by_customer }} {% firstof answer.author.name.strip answer.author.owner.username %}
{% endif %} {% endif %}
</p> </p>
{% endif %} {% endif %}

Loading…
Cancel
Save