From 363c906500a2fc6a68431e3249b1fc01232c86f9 Mon Sep 17 00:00:00 2001 From: wangzemei Date: Wed, 28 Sep 2022 15:05:40 +0800 Subject: [PATCH] * add kanban setting input limit --- module/execution/js/setkanban.js | 13 ++++++------- module/execution/view/setkanban.html.php | 6 +++--- module/kanban/js/create.js | 13 ++++++------- module/kanban/js/setting.js | 10 +++++++--- module/kanban/view/create.html.php | 6 +++--- module/kanban/view/setting.html.php | 6 +++--- www/theme/default/style.css | 1 + 7 files changed, 29 insertions(+), 26 deletions(-) diff --git a/module/execution/js/setkanban.js b/module/execution/js/setkanban.js index 8a837eb03e..cedf7f5d5c 100644 --- a/module/execution/js/setkanban.js +++ b/module/execution/js/setkanban.js @@ -2,15 +2,14 @@ $(function() { var heightType = $("[name='heightType']:checked").val(); setCardCount(heightType); - - var fluidBoard = $("#fluidBoard").val() || 0; + $('#colWidth, #minColWidth, #maxColWidth').attr('onkeyup', 'value=value.match(/^\\d+$/) ? value : ""'); + $('#colWidth, #minColWidth, #maxColWidth').attr('maxlength', '3'); + var fluidBoard = $("#mainContent input[name='fluidBoard'][checked='checked']").val() || 0; $('#colWidth').attr('disabled', fluidBoard == 1); - $('#minColWidth').attr('disabled', fluidBoard == 0); - $('#maxColWidth').attr('disabled', fluidBoard == 0); - $(document).on('change', "#mainContent input[name^=fluidBoard]", function(e) + $('#minColWidth, #maxColWidth').attr('disabled', fluidBoard == 0); + $(document).on('change', "#mainContent input[name='fluidBoard']", function(e) { $('#colWidth').attr('disabled', e.target.value == 1); - $('#minColWidth').attr('disabled', e.target.value == 0); - $('#maxColWidth').attr('disabled', e.target.value == 0); + $('#minColWidth, #maxColWidth').attr('disabled', e.target.value == 0); }) }); diff --git a/module/execution/view/setkanban.html.php b/module/execution/view/setkanban.html.php index 87851af893..446cc47535 100644 --- a/module/execution/view/setkanban.html.php +++ b/module/execution/view/setkanban.html.php @@ -25,13 +25,13 @@
$lang->kanbancolumn->fluidBoardList['0']), "class='inline-block'", $execution->fluidBoard);?> - colWidth, "class='form-control inline-block setting-input' required autocomplete='off'");?>px + colWidth ? $execution->colWidth : 264), "class='form-control inline-block setting-input' required autocomplete='off'");?>px
$lang->kanbancolumn->fluidBoardList['1']), "class='inline-block'", $execution->fluidBoard);?> - minColWidth, "class='form-control inline-block setting-input' required placeholder='180' autocomplete='off'");?>px + minColWidth ? $execution->minColWidth : 180), "class='form-control inline-block setting-input' required autocomplete='off'");?>px ~ - maxColWidth, "class='form-control inline-block setting-input' required placeholder='384' autocomplete='off'");?>px + maxColWidth ? $execution->maxColWidth : 384), "class='form-control inline-block setting-input' required autocomplete='off'");?>px
diff --git a/module/kanban/js/create.js b/module/kanban/js/create.js index 229ecd04c3..f6191aae4c 100644 --- a/module/kanban/js/create.js +++ b/module/kanban/js/create.js @@ -49,16 +49,15 @@ $(function() { setCopyKanban($(this).data('id')); $('#copyKanbanModal').modal('hide'); }); - - var fluidBoard = $("#fluidBoard").val() || 0; + $('#colWidth, #minColWidth, #maxColWidth').attr('onkeyup', 'value=value.match(/^\\d+$/) ? value : ""'); + $('#colWidth, #minColWidth, #maxColWidth').attr('maxlength', '3'); + var fluidBoard = $("#mainContent input[name='fluidBoard'][checked='checked']").val() || 0; $('#colWidth').attr('disabled', fluidBoard == 1); - $('#minColWidth').attr('disabled', fluidBoard == 0); - $('#maxColWidth').attr('disabled', fluidBoard == 0); - $(document).on('change', "#mainContent input[name^=fluidBoard]", function(e) + $('#minColWidth, #maxColWidth').attr('disabled', fluidBoard == 0); + $(document).on('change', "#mainContent input[name='fluidBoard']", function(e) { $('#colWidth').attr('disabled', e.target.value == 1); - $('#minColWidth').attr('disabled', e.target.value == 0); - $('#maxColWidth').attr('disabled', e.target.value == 0); + $('#minColWidth, #maxColWidth').attr('disabled', e.target.value == 0); }) }) diff --git a/module/kanban/js/setting.js b/module/kanban/js/setting.js index 30419fe6ee..b8a879af16 100644 --- a/module/kanban/js/setting.js +++ b/module/kanban/js/setting.js @@ -39,11 +39,15 @@ $(function() return false; } }) - $(document).on('change', "#mainContent input[name^=fluidBoard]", function(e) + $('#colWidth, #minColWidth, #maxColWidth').attr('onkeyup', 'value=value.match(/^\\d+$/) ? value : ""'); + $('#colWidth, #minColWidth, #maxColWidth').attr('maxlength', '3'); + var fluidBoard = $("#mainContent input[name='fluidBoard'][checked='checked']").val() || 0; + $('#colWidth').attr('disabled', fluidBoard == 1); + $('#minColWidth, #maxColWidth').attr('disabled', fluidBoard == 0); + $(document).on('change', "#mainContent input[name='fluidBoard']", function(e) { $('#colWidth').attr('disabled', e.target.value == 1); - $('#minColWidth').attr('disabled', e.target.value == 0); - $('#maxColWidth').attr('disabled', e.target.value == 0); + $('#minColWidth, #maxColWidth').attr('disabled', e.target.value == 0); }) }) diff --git a/module/kanban/view/create.html.php b/module/kanban/view/create.html.php index a8ab4c04ca..cbe8ff8fff 100644 --- a/module/kanban/view/create.html.php +++ b/module/kanban/view/create.html.php @@ -69,13 +69,13 @@
$lang->kanbancolumn->fluidBoardList['0']), isset($copyKanban->fluidBoard) ? $copyKanban->fluidBoard : 0);?> - colWidth, "class='form-control inline-block setting-input' required placeholder='264' autocomplete='off'");?>px + colWidth ? $copyKanban->colWidth : 264), "class='form-control inline-block setting-input' required autocomplete='off'");?>px
$lang->kanbancolumn->fluidBoardList['1']), isset($copyKanban->fluidBoard) ? $copyKanban->fluidBoard : 0);?> - minColWidth, "class='form-control inline-block setting-input' required placeholder='180' autocomplete='off'");?>px + minColWidth ? $copyKanban->minColWidth : 180), "class='form-control inline-block setting-input' required autocomplete='off'");?>px ~ - maxColWidth, "class='form-control inline-block setting-input' required placeholder='384' autocomplete='off'");?>px + maxColWidth ? $copyKanban->maxColWidth : 384), "class='form-control inline-block setting-input' required autocomplete='off'");?>px
diff --git a/module/kanban/view/setting.html.php b/module/kanban/view/setting.html.php index d72c60899e..95f220d113 100644 --- a/module/kanban/view/setting.html.php +++ b/module/kanban/view/setting.html.php @@ -30,13 +30,13 @@
$lang->kanbancolumn->fluidBoardList['0']), $kanban->fluidBoard);?> - colWidth, "class='form-control inline-block setting-input' required placeholder='264' autocomplete='off'");?>px + colWidth ? $kanban->colWidth: 264), "class='form-control inline-block setting-input' required autocomplete='off'");?>px
$lang->kanbancolumn->fluidBoardList['1']), $kanban->fluidBoard);?> - minColWidth, "class='form-control inline-block setting-input' required placeholder='180' autocomplete='off'");?>px + minColWidth ? $kanban->minColWidth : 180), "class='form-control inline-block setting-input' required autocomplete='off'");?>px ~ - maxColWidth, "class='form-control inline-block setting-input' required placeholder='384' autocomplete='off'");?>px + maxColWidth ? $kanban->maxColWidth: 384), "class='form-control inline-block setting-input' required autocomplete='off'");?>px
diff --git a/www/theme/default/style.css b/www/theme/default/style.css index ff78fc00c3..b026617180 100644 --- a/www/theme/default/style.css +++ b/www/theme/default/style.css @@ -122,3 +122,4 @@ body.xxc-embed.m-productplan-view,body.xxc-embed.m-bug-browse,body.xxc-embed.m-p .radio-text-divider {width: 1px; height: 13px; display: inline-block; margin: -2px 9px 0; background: #D9D9D9; vertical-align: middle;} .input-divider {margin: 0 4px;} .setting-input {width: 64px; height: 20px; margin: 0 4px; text-align: center;} +.setting-input.disabled,.setting-input[disabled="disabled"] {color: #C4C4C4;}