N°3123 : Fix create shortcuts and set preferences

This commit is contained in:
acognet
2020-12-11 19:23:20 +01:00
parent 43a2b5cda6
commit c173f0b5d6
2 changed files with 77 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
<?php
/**
* @copyright Copyright (C) 2010-2020 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
namespace Combodo\iTop\Application\UI\Preferences\BlockShortcuts;
use Combodo\iTop\Application\UI\Base\Component\Panel\Panel;
use Combodo\iTop\Application\UI\Base\UIBlock;
/**
* Class BlockShortcuts
*
* @package Combodo\iTop\Application\UI\Preferences\BlockShortcuts
*/
class BlockShortcuts extends Panel
{
// Overloaded constants
public const BLOCK_CODE = 'ibo-block-shortcuts';
public const DEFAULT_JS_TEMPLATE_REL_PATH = 'application/preferences/block-shortcuts/layout';
public $sIdShortcuts;
}

View File

@@ -0,0 +1,52 @@
{# @copyright Copyright (C) 2010-2020 Combodo SARL #}
{# @license http://opensource.org/licenses/AGPL-3.0 #}
{% apply spaceless %}
var selectionCount{{ oUIBlock.sIdShortcuts }} = $('#{{ oUIBlock.sIdShortcuts }} [name="selectionCount"]');
selectionCount{{ oUIBlock.sIdShortcuts }}.bind('change',function()
{
let iCountSelected = selectionCount{{ oUIBlock.sIdShortcuts }}.val();
if (iCountSelected == 0)
{
$('#shortcut_btn_rename').prop('disabled', true);
$('#shortcut_btn_delete').prop('disabled', true);
}
else if (iCountSelected == 1)
{
$('#shortcut_btn_rename').prop('disabled', false);
$('#shortcut_btn_delete').prop('disabled', false);
}
else
{
$('#shortcut_btn_rename').prop('disabled', true);
$('#shortcut_btn_delete').prop('disabled', false);
}
}
);
$('#shortcut_btn_rename').prop('disabled', true);
$('#shortcut_btn_delete').prop('disabled', true);
$('#shortcut_btn_rename').bind('click', function() {
var oParams = getMultipleSelectionParams('{{ oUIBlock.sIdShortcuts }}')
oParams.operation = 'shortcut_rename_dlg';
$.post(GetAbsoluteUrlAppRoot()+'pages/ajax.render.php', oParams, function(data){
$('body').append(data);
});
return false;
});
$('#shortcut_btn_delete').bind('click', function() {
if (confirm('{{'UI:ShortcutDelete:Confirm' |dict_s }}'))
{
var oParams = getMultipleSelectionParams('{{ oUIBlock.sIdShortcuts }}')
oParams.operation = 'shortcut_delete_go';
$.post(GetAbsoluteUrlAppRoot()+'pages/ajax.render.php', oParams, function(data){
$('body').append(data);
});
}
return false;
});
{% endapply %}