diff --git a/module/tree/control.php b/module/tree/control.php index 02542e5fbe..659af48970 100644 --- a/module/tree/control.php +++ b/module/tree/control.php @@ -72,7 +72,7 @@ class tree extends control $this->view->currentProduct = $currentProduct; $this->view->productModules = $this->tree->getOptionMenu($currentProduct, 'story'); - $title = $product->name . $this->lang->colon . $this->lang->tree->manageProduct; + $title = $this->lang->tree->manageProduct; $position[] = html::a($this->createLink('product', 'browse', "product=$rootID"), $product->name); $position[] = $this->lang->tree->manageProduct; } @@ -84,7 +84,7 @@ class tree extends control if($this->config->global->flow == 'onlyTest') $this->lang->set('menugroup.tree', 'bug'); if($this->config->global->flow != 'onlyTest') $this->lang->set('menugroup.tree', 'qa'); - $title = $product->name . $this->lang->colon . $this->lang->tree->manageBug; + $title = $this->lang->tree->manageBug; $position[] = html::a($this->createLink('bug', 'browse', "product=$rootID"), $product->name); $position[] = $this->lang->tree->manageBug; } @@ -96,7 +96,7 @@ class tree extends control if($this->config->global->flow == 'onlyTest') $this->lang->set('menugroup.tree', 'testcase'); if($this->config->global->flow != 'onlyTest') $this->lang->set('menugroup.tree', 'qa'); - $title = $product->name . $this->lang->colon . $this->lang->tree->manageCase; + $title = $this->lang->tree->manageCase; $position[] = html::a($this->createLink('testcase', 'browse', "product=$rootID"), $product->name); $position[] = $this->lang->tree->manageCase; } @@ -107,7 +107,7 @@ class tree extends control $this->lang->tree->menuOrder = $this->lang->testsuite->menuOrder; $this->lang->set('menugroup.tree', 'qa'); - $title = $lib->name . $this->lang->colon . $this->lang->tree->manageCaseLib; + $title = $this->lang->tree->manageCaseLib; $position[] = html::a($this->createLink('testsuite', 'library', "libID=$rootID"), $lib->name); $position[] = $this->lang->tree->manageCaseLib; } @@ -119,7 +119,7 @@ class tree extends control $this->lang->tree->menuOrder = $this->lang->doc->menuOrder; $this->lang->set('menugroup.tree', 'doc'); - $title = $lib->name . $this->lang->colon . $this->lang->tree->manageCustomDoc; + $title = $this->lang->tree->manageCustomDoc; $position[] = html::a($this->createLink('doc', 'browse', "libID=$rootID"), $lib->name); $position[] = $this->lang->tree->manageCustomDoc; } @@ -138,7 +138,7 @@ class tree extends control $this->view->currentProduct = $currentProduct; $this->view->productModules = $this->tree->getOptionMenu($currentProduct, 'line'); - $title = $this->lang->product->common . $this->lang->colon . $this->lang->tree->manageLine; + $title = $this->lang->tree->manageLine; $position[] = $this->lang->tree->manageLine; } diff --git a/module/tree/css/common.css b/module/tree/css/common.css index d013e995ed..16ed45f934 100644 --- a/module/tree/css/common.css +++ b/module/tree/css/common.css @@ -1,21 +1,14 @@ -.parentModule {width:10%; vertical-align:middle;} -.copy {display:block; margin-bottom:5px;} +.row-module {max-width: 500px; min-width: 400px;} +.row-module + .row-module {margin-top: 5px;} +.col-module {min-width: 200px;} +.col-module .form-control {border-radius: 2px 0 0 2px;} +.col-module select.form-control {border-radius: 0 2px 2px 0; border-left-width: 0;} +.col-module select.form-control:focus {margin-left: -1px; border-left-width: 1px;} +.col-shorts .form-control {border-radius: 0 2px 2px 0; border-left-width: 0;} +.col-shorts .form-control:focus {margin-left: -1px; border-left-width: 1px;} +.col-shorts {width: 110px;} +.col-actions {width: 80px; padding-left: 5px;} -.outer .row .col-md-8 .table-form {max-width: 600px} - -#sonModule, #moduleBox > span > input, #moduleBox > table{max-width: 500px} -#sonModule .row-table .input-group input {border-right: none} -#moduleBox span > .form-control {margin-bottom: 5px;} - -.w-260px {width: 260px!important} -table.copy td {padding: 0!important} -table.copy td .form-control {border-right: 0} - -.tree-toggle {cursor: pointer;} -.tree-actions, .tree li.hover > .tree-actions {opacity: 1} -.tree-item-branch > .tree-actions [data-type='sort'] {display: none} -.tree-item-branch > .tree-actions [data-type='add'] > .icon-plus:before {content: '\e6c7'} - -#childrenForm table .chosen-container .chosen-single {border-right-color: transparent} -#childrenForm table .chosen-container .chosen-single {border-right-color: transparent} -#childrenForm .col-table + .col-table .form-control {border-left: transparent;} +.col-module .chosen-container-single .chosen-single {border-radius: 2px 0 0 2px; border-right-width: 0; padding-right: 1px;} +.col-module .chosen-container-active .chosen-single {border-right-width: 1px; padding-right: 0;} +.col-shorts .chosen-container-single .chosen-single {border-radius: 0 2px 2px 0;} diff --git a/module/tree/js/browse.js b/module/tree/js/browse.js index 5fce104d12..a581c7bbed 100644 --- a/module/tree/js/browse.js +++ b/module/tree/js/browse.js @@ -7,15 +7,17 @@ function syncModule(rootID, type) $.getJSON(link, function(modules) { if(modules.length == 0) return false; + $('.helplink').addClass('hidden'); - var $inputgroup = $('
').append($('.input-group .icon-remove:first').closest('.row-table').clone()).html(); + var $inputgroup = $('
').append($('.col-actions .icon-trash:first').closest('.table-row').clone()).html(); + $.each(modules, function(key, module) { - $('.row-table').each(function() + $('#sonModule > .table-row').each(function() { moduleName = $(this).find('input[id^=modules]').val(); if(moduleName == module.name) modules[key] = null; - if(!moduleName) $(this).closest('.row-table').remove(); + if(!moduleName) $(this).closest('#sonModule > .table-row').not('.copy').remove(); }) }); @@ -25,16 +27,16 @@ function syncModule(rootID, type) { /* Duplicate removal for mdoule name. */ var unique = true; - $('#sonModule > .row-table').each(function() + $('#sonModule > .table-row').not('.copy').each(function() { - if($(this).find('.col-table:first').find(':input').val() == module.name) unique = false; + if($(this).find('.table-col:first').find(':input').val() == module.name) unique = false; }) if(unique) { $('#sonModule').append($inputgroup); - $('#sonModule .row-table:last input[id^=modules]').val(module.name); - $('#sonModule .row-table:last input[id^=shorts]').val(module.short); + $('#sonModule .table-row:last input[id^=modules]').val(module.name); + $('#sonModule .table-row:last input[id^=shorts]').val(module.short); } } }) @@ -63,7 +65,7 @@ function syncProductOrProject(obj, type) function toggleCopy() { - var $copy = $('table.copy'); + var $copy = $('.table-row.copy'); if($copy.size() == 0) return false; $copy.toggle(); } diff --git a/module/tree/js/common.js b/module/tree/js/common.js index 974d7526b7..b5e7d8a86e 100644 --- a/module/tree/js/common.js +++ b/module/tree/js/common.js @@ -1,22 +1,8 @@ -function addItem(obj) -{ - var $inputgroup = $(obj).closest('.row-table'); - $inputgroup.after($inputgroup.clone()).next('.row-table').find('input').val(''); -} - -function insertItem(obj) -{ - var $inputgroup = $(obj).closest('.row-table'); - var insertHtml = $('#insertItemBox').children('.row-table').clone(); - $inputgroup.after(insertHtml).next('.row-table').find('input').val(''); - - updateItemOrder(); -} - function updateItemOrder() { var order = 10; - $('#sonModule').children('.row-table').each(function(){ + $('#sonModule').children('.row-table').each(function() + { if($(this).find("input[name*='order']").length > 0) { console.log(order); @@ -28,8 +14,35 @@ function updateItemOrder() $('#maxOrder').val(order - 10); } +function addItem(obj) +{ + var $inputRow = $(obj).closest('.row-module'); + var $newRow = $('#insertItemBox').children('.row-module').clone().insertAfter($inputRow).addClass('highlight'); + $newRow.find('input').val(''); + setTimeout(function() + { + $newRow.removeClass('highlight'); + }, 1600); + updateItemOrder(); +} + +function insertItem(obj) +{ + var $inputgroup = $(obj).closest('.row-table'); + var insertHtml = $('#insertItemBox').children('.row-table').clone(); + $inputgroup.after(insertHtml).next('.row-table').find('input').val(''); + + updateItemOrder(); +} + function deleteItem(obj) { - if($(obj).closest('.row-table').siblings('.row-table.addedItem').find('i.icon-remove').size() <= 0) return; - $(obj).closest('.row-table').remove(); + var $inputRow = $(obj).closest('.row-module'); + if ($inputRow.siblings('.row-module.row-module-new').find('.btn-delete').length > 0) + { + $inputRow.addClass('highlight').fadeOut(500, function() + { + $inputRow.remove(); + }); + } } diff --git a/module/tree/lang/zh-cn.php b/module/tree/lang/zh-cn.php index 1ccbb583be..44f262f082 100644 --- a/module/tree/lang/zh-cn.php +++ b/module/tree/lang/zh-cn.php @@ -32,7 +32,7 @@ $lang->tree->manageBugChild = '维护Bug子模块'; $lang->tree->manageCaseChild = '维护用例子模块'; $lang->tree->manageCaselibChild = '维护测试库子模块'; $lang->tree->manageTaskChild = "维护{$lang->projectCommon}子模块"; -$lang->tree->syncFromProduct = '复制'; +$lang->tree->syncFromProduct = '复制模块'; $lang->tree->dragAndSort = "拖放排序"; $lang->tree->sort = "排序"; $lang->tree->addChild = "增加子模块"; diff --git a/module/tree/view/browse.html.php b/module/tree/view/browse.html.php index c11daffb87..c2f9cc2506 100644 --- a/module/tree/view/browse.html.php +++ b/module/tree/view/browse.html.php @@ -14,125 +14,131 @@ type) && $root->type != 'normal')) ? true : false;?> tree->line : ($viewType == 'doc' ? $lang->tree->cate : $lang->tree->name);?> -
-
tree->manageLine : $lang->tree->common;?>
+ -
-
-
-
-
-
-
    -
    +
    +
    +
    +
    +
    +
    +
    +
      -
      -
      '> -
      -
      - +
      +
      +
      +
      doc->manageType : $lang->tree->$manageChild;?> - -
      tree->syncFromProduct, '', "class='btn btn-sm'")?>
      -
      -
      + +
      tree->syncFromProduct, '', "class='btn btn-sm'")?>
      + +
      +
      + '> - - "; - echo "'; - echo "'; - echo "'; - echo '
      - + createLink('tree', 'browse', "root=$rootID&viewType=$viewType"), empty($root->name) ? '' : $root->name); - echo $lang->arrow; + echo html::a($this->createLink('tree', 'browse', "root=$rootID&viewType=$viewType"), empty($root->name) ? '' : $root->name) . ""; foreach($parentModules as $module) { - echo html::a($this->createLink('tree', 'browse', "root=$rootID&viewType=$viewType&moduleID=$module->id"), $module->name); - echo $lang->arrow; + echo html::a($this->createLink('tree', 'browse', "root=$rootID&viewType=$viewType&moduleID=$module->id"), $module->name) . " "; } ?> - -
      " . html::select('allProduct', $allProduct, '', "class='form-control chosen' onchange=\"syncProductOrProject(this,'product')\"") . '" . html::select('productModule', $productModules, '', "class='form-control chosen'") . '" . html::commonButton($lang->tree->syncFromProduct, "id='copyModule' onclick='syncModule($currentProduct, \"story\")'") . '
      '; - } - $maxOrder = 0; - echo '
      '; - foreach($sons as $sonModule) - { - if($sonModule->order > $maxOrder) $maxOrder = $sonModule->order; - $disabled = $sonModule->type == $viewType ? '' : 'disabled'; - echo "
      "; - echo "
      " . html::input("modules[id$sonModule->id]", $sonModule->name, 'class="form-control" autocomplete="off"' . $disabled) . '
      '; - if($hasBranch) echo "
      " . html::select("branch[id$sonModule->id]", $branches, $sonModule->branch, 'class="form-control" disabled') . '
      '; - echo "
      " . html::input("shorts[id$sonModule->id]", $sonModule->short, "class='form-control' placeholder='{$lang->tree->short}' $disabled autocomplete='off'") . html::hidden("order[id$sonModule->id]", $sonModule->order); - echo ""; - echo '
      '; - echo '
      '; - } - for($i = 0; $i < TREE::NEW_CHILD_COUNT ; $i ++) - { - echo "
      "; - echo "
      " . html::input("modules[]", '', "class='form-control' placeholder='{$name}' autocomplete='off'") . '
      '; - if($hasBranch) echo '
      ' . html::select("branch[]", $branches, $branch, 'class="form-control"') . '
      '; - echo "
      " . html::input("shorts[]", '', "class='form-control' placeholder='{$lang->tree->short}' autocomplete='off'"); - echo ""; - echo ""; - echo '
      '; - echo '
      '; - } + +
      + +
      +
      +
      +
      + +
      +
      + - echo "'; + + + order > $maxOrder) $maxOrder = $sonModule->order;?> + type == $viewType ? '' : 'disabled';?> +
      +
      id]", $sonModule->name, 'class="form-control" autocomplete="off"' . $disabled);?>
      + +
      id]", $branches, $sonModule->branch, 'class="form-control" disabled');?>
      + +
      id]", $sonModule->short, "class='form-control' placeholder='{$lang->tree->short}' $disabled autocomplete='off'") . html::hidden("order[id$sonModule->id]", $sonModule->order);?>
      +
      + +
      +
      + + +
      +
      + +
      + +
      tree->short}' autocomplete='off'");?>
      +
      + + +
      +
      + +
      - echo '
      '; - ?> +
      +
      +
      + +
      + +
      tree->short}' autocomplete='off'");?>
      +
      + + +
      +
      +
      - - session->{$viewType . 'List'} ? html::linkButton($this->lang->goback, $this->session->{$viewType .'List'}) : html::backButton(); - echo html::hidden('parentModuleID', $currentModuleID); - echo html::hidden('maxOrder', $maxOrder); - ?> - + + + session->{$viewType . 'List'} ? html::linkButton($this->lang->goback, $this->session->{$viewType .'List'}, 'btn btn-wide btn-gray') : html::backButton('', '', 'btn btn-wide btn-gray');?> + + + -
      +
      - +
      - - - +