Skip to content

Commit

Permalink
Fixes #40729
Browse files Browse the repository at this point in the history
  • Loading branch information
BrunoSpy committed May 13, 2020
1 parent cb9c75e commit 70eece8
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 22 deletions.
9 changes: 7 additions & 2 deletions module/Application/public/assets/js/jquery.ui.timeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -1552,8 +1552,13 @@
var catid = value.id;
$.getJSON(url + '/getQuickModels?id='+catid+'&include='+self.options.showOnlyRootCategories+'&cats='+self.options.tabCats, function(data){
var txt = '';
$.each(data, function(key, value){
txt += '<p><a class="btn btn-sm use-model" data-id="'+key+'" data-name="'+value+'" title="'+value+'"><span class="pull-left title">'+value+'</span> <span class="pull-right glyphicon glyphicon-share-alt"></span></a></p>';
let res = [];
$.each(data, function(index, value){
res.push(value);
});
res.sort(function(a,b){return a.place - b.place;});
$.each(res, function(index, value){
txt += '<p><a class="btn btn-sm use-model" data-id="'+value.key+'" data-name="'+value.name+'" title="'+value.name+'"><span class="pull-left title">'+value.name+'</span> <span class="pull-right glyphicon glyphicon-share-alt"></span></a></p>';
});
$("#category"+catid).popover({
trigger: 'focus',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,10 @@ public function getQuickAccessModelsFromCategoryAsArray(Category $category, $cat
'place' => 'ASC'
));
$list = parent::matching($criteria);
$place = 0;
foreach ($list as $element) {
$res[$element->getId()] = $element->getName();
$res[] = array("place" => $place, "key" => $element->getId(), "name" => $element->getName());
$place++;
}
if($cats !== null) {
foreach ($category->getChildren() as $cat) {
Expand All @@ -106,7 +108,8 @@ public function getQuickAccessModelsFromCategoryAsArray(Category $category, $cat
));
$list = parent::matching($criteria);
foreach ($list as $element) {
$res[$element->getId()] = $element->getName();
$res[] = array("place" => $place, "key" => $element->getId(), "name" => $element->getName());
$place++;
}
}
}
Expand Down
34 changes: 16 additions & 18 deletions module/Application/view/application/events/subform.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,19 @@ switch ($this->part) {
echo '<p>Aucun modèle défini.</p>';
echo '</div>';
} else {
$count = 0;
if(!empty($this->values)) {
$count += count($this->values);
}
if(!empty($this->subvalues)) {
$count += count($this->subvalues);
}
$i = 1;
$separated = false;
echo '<div class="col-md-6">';
echo '<table>';
echo '<tbody>';
if(!empty($this->values)) {
echo '<div class="col-md-6">';
echo '<table>';
echo '<tbody>';
$count = count($this->values);
$i = 1;
$separated = false;
foreach ($this->values as $key => $value) {
echo '<tr>';
echo '<td class="hidden-xs">';
Expand All @@ -43,17 +49,8 @@ switch ($this->part) {
}
$i ++;
}
echo '</tbody>';
echo '</table>';
echo '</div>';
}
if(!empty($this->subvalues)) {
echo '<div class="col-md-6">';
echo '<table>';
echo '<tbody>';
$count = count($this->subvalues);
$i = 0;
$separated = false;
foreach ($this->subvalues as $key => $value) {
echo '<tr>';
echo '<td class="hidden-xs">';
Expand All @@ -74,10 +71,11 @@ switch ($this->part) {
}
$i ++;
}
echo '</tbody>';
echo '</table>';
echo '</div>';

}
echo '</tbody>';
echo '</table>';
echo '</div>';
}
break;
case 'custom_fields':
Expand Down

0 comments on commit 70eece8

Please sign in to comment.