Kaynağa Gözat

Reset color options on modal after saving

master^2
Mike Koch 1 yıl önce
ebeveyn
işleme
0c04660f3f
No account linked to committer's email address
2 değiştirilmiş dosya ile 17 ekleme ve 12 silme
  1. 1
    0
      admin/manage_categories.php
  2. 16
    12
      internal-api/js/manage-categories.js

+ 1
- 0
admin/manage_categories.php Dosyayı Görüntüle

@@ -477,6 +477,7 @@ echo mfh_get_hidden_fields_for_language(array(
'geco',
'cpric',
'no_manager',
'e_udel',
));

require_once(HESK_PATH . 'inc/footer.inc.php');

+ 16
- 12
internal-api/js/manage-categories.js Dosyayı Görüntüle

@@ -122,7 +122,8 @@ function loadTable() {
if (this.manager === null) {
$template.find('[data-property="manager"]').text(mfhLang.text('no_manager'));
} else {
$template.find('[data-property="manager"]').text(users[this.manager].name);
var managerName = users[this.manager] === undefined ? mfhLang.text('e_udel') : users[this.manager].name;
$template.find('[data-property="manager"]').text(managerName);
}

if (this.id === 1) {
@@ -190,7 +191,7 @@ function bindEditModal() {
colorpickerOptions = {
format: 'hex'
};
if (foregroundColor != '' && foregroundColor !== 'AUTO') {
if (foregroundColor !== '' && foregroundColor !== 'AUTO') {
colorpickerOptions.color = foregroundColor;
}

@@ -246,16 +247,18 @@ function bindCreateModal() {
}

function bindModalCancelCallback() {
$('.cancel-callback').click(function() {
var $editCategoryModal = $('#category-modal');

$editCategoryModal.find('input[name="background-color"]').val('').colorpicker('destroy').end();
$editCategoryModal.find('input[name="foreground-color"]').val('').colorpicker('destroy').end();
$editCategoryModal.find('input[name="display-border"][value="1"]').prop('checked');
$editCategoryModal.find('input[name="display-border"][value="0"]').prop('checked');
$editCategoryModal.find('input[name="autoassign"][value="1"]').prop('checked');
$editCategoryModal.find('input[name="autoassign"][value="0"]').prop('checked');
});
$('.cancel-callback').click(resetModal);
}

function resetModal() {
var $editCategoryModal = $('#category-modal');

$editCategoryModal.find('input[name="background-color"]').val('').colorpicker('destroy').end();
$editCategoryModal.find('input[name="foreground-color"]').val('').colorpicker('destroy').end();
$editCategoryModal.find('input[name="display-border"][value="1"]').prop('checked');
$editCategoryModal.find('input[name="display-border"][value="0"]').prop('checked');
$editCategoryModal.find('input[name="autoassign"][value="1"]').prop('checked');
$editCategoryModal.find('input[name="autoassign"][value="0"]').prop('checked');
}

function bindFormSubmit() {
@@ -310,6 +313,7 @@ function bindFormSubmit() {
format = mfhLang.html('category_updated');
mfhAlert.success(format.replace('%s', data.name));
}
resetModal();
$modal.modal('hide');
loadTable();
},

Loading…
İptal
Kaydet