mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-18 06:48:50 +02:00
N°3123 : Fix create shortcuts and set preferences
This commit is contained in:
@@ -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;
|
||||
}
|
||||
@@ -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 %}
|
||||
Reference in New Issue
Block a user