diff --git a/module/execution/js/create.js b/module/execution/js/create.js index 3904670691..6cd163c3ad 100644 --- a/module/execution/js/create.js +++ b/module/execution/js/create.js @@ -48,11 +48,22 @@ $(function() { if(systemMode == 'new') { - var maxWidth = $('.chosen-container .chosen-drop.chosen-auto-max-width.in').width() - 70; + $('#teams_chosen ul li').each(function(index) + { + if(index == 0) + { + var maxWidth = $('.chosen-container .chosen-drop.chosen-auto-max-width.in').width() - 70; - $('#teams_chosen ul .label').remove(); - $('#teams_chosen ul li:first').after(' '); - $('#teams_chosen ul > li:first').attr('style', 'display: inline-block; vertical-align: middle; max-width: ' + maxWidth + 'px'); + $('#teams_chosen ul .label').remove(); + $(this).after(' '); + $(this).attr('style', 'display: inline-block; vertical-align: middle; max-width: ' + maxWidth + 'px'); + } + else + { + $(this).html($(this).html().replace('   ', '')); + $(this).prepend('   '); + } + }) } }) diff --git a/module/execution/model.php b/module/execution/model.php index 8626205f41..3341621a83 100644 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -2478,22 +2478,13 @@ class executionModel extends model { if(empty($projectID) and $this->config->systemMode == 'new') return array(); - $objects = $this->dao->select('id,name,type')->from(TABLE_PROJECT) + $teamPairs = $this->dao->select('id,name')->from(TABLE_PROJECT) ->where('deleted')->eq(0) ->andWhere('(project')->eq($projectID) ->orWhere('id')->eq($projectID) ->markRight(1) ->orderBy('project_asc') - ->fetchAll('id'); - - if(empty($objects)) return array(); - - $teamPairs = array(); - foreach($objects as $id => $object) - { - $prefix = ($object->type != 'project' and $this->config->systemMode == 'new') ? '   ' : ''; - $teamPairs[$id] = $prefix . $object->name; - } + ->fetchPairs(); return $teamPairs; }