PR Conflict resolution

This commit is contained in:
Tyler Todd 2023-02-17 22:53:08 +00:00
parent d0961ca5e7
commit 9b696a42a4

View File

@ -103,6 +103,28 @@
</select> </select>
</div> </div>
</div> </div>
<div class="card-body">
<p>Domains on the right are associated with the account. Red marked domain names are already associated with other accounts.
Moving already associated domains to this account will overwrite the previous associated account.
</p>
<p>Hover over the red domain names to show the associated account. Click on domains to move between columns.</p>
<div class="form-group col-2">
<select multiple="multiple" class="form-control" id="account_domains"
name="account_domains">
{% for domain in domains %}
{% if account != None and domain.account_id != None and account.id != domain.account_id %}
{% with account_id=domain.account_id %}
<option style="color: red" data-toggle="tooltip" title="Associated with: {{ accounts[account_id].name }}"
value="{{ domain.name }}">{{ domain.name }}</option>
{% endwith %}
{% else %}
<option {% if account.id == domain.account_id %}selected{% endif %}
value="{{ domain.name }}">{{ domain.name }}</option>
{% endif %}
{% endfor %}
</select>
</div>
</div>
<div class="card-footer"> <div class="card-footer">
<button type="button" class="btn btn-secondary float-left" onclick="window.location.href='{{ url_for('admin.manage_account') }}'"> <button type="button" class="btn btn-secondary float-left" onclick="window.location.href='{{ url_for('admin.manage_account') }}'">
Cancel Cancel
@ -145,40 +167,44 @@
{% endblock %} {% endblock %}
{% block extrascripts %} {% block extrascripts %}
<script> <script>
$("#account_multi_user").multiSelect({ function addMultiSelect(id, placeholder) {
selectableHeader: "<input type='text' class='search-input' autocomplete='off' placeholder='Username'>", $(id).multiSelect({
selectionHeader: "<input type='text' class='search-input' autocomplete='off' placeholder='Username'>", selectableHeader: `<input type='text' class='search-input' autocomplete='off' placeholder='${placeholder}'>`,
afterInit: function (ms) { selectionHeader: `<input type='text' class='search-input' autocomplete='off' placeholder='${placeholder}'>`,
var that = this, afterInit: function (ms) {
$selectableSearch = that.$selectableUl.prev(), var that = this,
$selectionSearch = that.$selectionUl.prev(), $selectableSearch = that.$selectableUl.prev(),
selectableSearchString = '#' + that.$container.attr('id') + ' .ms-elem-selectable:not(.ms-selected)', $selectionSearch = that.$selectionUl.prev(),
selectionSearchString = '#' + that.$container.attr('id') + ' .ms-elem-selection.ms-selected'; selectableSearchString = '#' + that.$container.attr('id') + ' .ms-elem-selectable:not(.ms-selected)',
selectionSearchString = '#' + that.$container.attr('id') + ' .ms-elem-selection.ms-selected';
that.qs1 = $selectableSearch.quicksearch(selectableSearchString) that.qs1 = $selectableSearch.quicksearch(selectableSearchString)
.on('keydown', function (e) { .on('keydown', function (e) {
if (e.which === 40) { if (e.which === 40) {
that.$selectableUl.focus(); that.$selectableUl.focus();
return false; return false;
} }
}); });
that.qs2 = $selectionSearch.quicksearch(selectionSearchString) that.qs2 = $selectionSearch.quicksearch(selectionSearchString)
.on('keydown', function (e) { .on('keydown', function (e) {
if (e.which == 40) { if (e.which == 40) {
that.$selectionUl.focus(); that.$selectionUl.focus();
return false; return false;
} }
}); });
}, },
afterSelect: function () { afterSelect: function () {
this.qs1.cache(); this.qs1.cache();
this.qs2.cache(); this.qs2.cache();
}, },
afterDeselect: function () { afterDeselect: function () {
this.qs1.cache(); this.qs1.cache();
this.qs2.cache(); this.qs2.cache();
} }
}); });
}
addMultiSelect("#account_multi_user", "Username")
addMultiSelect("#account_domains", "Domain")
</script> </script>
{% endblock %} {% endblock %}