Guides/Listview

* display class/spec in category if applicable
 * make class/spec searchable
 * unify class/spec display with tooltips
This commit is contained in:
Sarjuuk
2023-04-18 17:16:04 +02:00
parent 9c8656f4b5
commit 5be5c2b59e
2 changed files with 36 additions and 11 deletions

View File

@@ -103,6 +103,12 @@ class GuideList extends BaseType
'date' => $this->getField('date'), // ok 'date' => $this->getField('date'), // ok
'when' => date(Util::$dateFormatInternal, $this->getField('date')) 'when' => date(Util::$dateFormatInternal, $this->getField('date'))
); );
if ($this->getField('category') == 1)
{
$data[$this->id]['classs'] = $this->getField('classId');
$data[$this->id]['spec'] = $this->getField('specId');
}
} }
return $data; return $data;
@@ -137,19 +143,20 @@ class GuideList extends BaseType
if ($this->getField('classId') && $this->getField('category') == 1) if ($this->getField('classId') && $this->getField('category') == 1)
{ {
$c = $this->getField('classId'); if ($c = $this->getField('classId'))
if (($s = $this->getField('specId')) > -1)
{ {
$i = Game::$specIconStrings[$c][$s];
$n = Lang::game('classSpecs', $c, $s);
}
else
{
$i = 'class_'.Game::$classFileStrings[$c];
$n = Lang::game('cl', $c); $n = Lang::game('cl', $c);
} $specStr .= '&nbsp;&nbsp;&nbsp;&nbsp;<span class="icontiny c'.$c.'" style="background-image: url('.STATIC_URL.'/images/wow/icons/tiny/class_'.Game::$classFileStrings[$c].'.gif)">%s</span>';
$specStr = '&nbsp;&nbsp;&nbsp;&nbsp;<span class="icontiny c'.$c.'" style="background-image: url('.STATIC_URL.'/images/wow/icons/tiny/'.$i.'.gif)">'.$n.'</span>'; if (($s = $this->getField('specId')) > -1)
{
$i = Game::$specIconStrings[$c][$s];
$n = '';
$specStr .= '<span class="icontiny c'.$c.'" style="background-image: url('.STATIC_URL.'/images/wow/icons/tiny/'.$i.'.gif)">'.Lang::game('classSpecs', $c, $s).'</span>';
}
$specStr = sprintf($specStr, $n);
}
} }
$tt = '<table><tr><td><div style="max-width: 320px"><b class="q">'.$this->getField('title').'</b><br>'; $tt = '<table><tr><td><div style="max-width: 320px"><b class="q">'.$this->getField('title').'</b><br>';

View File

@@ -10255,10 +10255,28 @@ Listview.templates = {
compute: function(guide, td) compute: function(guide, td)
{ {
$(td).append($('<a>').attr('href', '?guides=' + guide.category).text(l_guide_categories[guide.category]).css('color', 'white')); $(td).append($('<a>').attr('href', '?guides=' + guide.category).text(l_guide_categories[guide.category]).css('color', 'white'));
if (guide.classs && g_chr_specs[guide.classs])
{
$(td).append('&nbsp;' + LANG.dash + '&nbsp;').append($(Icon.create('class_' + g_file_classes[guide.classs], 0, null, '?class=' + guide.classs, null, null, false, null, true)));
let txt = $('<span>').attr('class', 'c' + guide.classs).text(' ' + g_chr_classes[guide.classs]);
if (guide.spec >= 0 && g_chr_specs[guide.classs][guide.spec])
{
$(td).append($(Icon.create(g_file_specs[guide.classs][guide.spec], 0, null, 'javascript:;', null, null, false, null, true)));
txt = $('<span>').attr('class', 'c' + guide.classs).text(' ' + g_chr_specs[guide.classs][guide.spec]);
}
$(td).append(txt);
}
}, },
getVisibleText: function(guide) getVisibleText: function(guide)
{ {
return l_guide_categories[guide.category]; let b = l_guide_categories[guide.category];
if (guide.classs)
b += ' ' + g_chr_classes[guide.classs];
if (guide.spec >= 0)
b += ' ' + g_chr_specs[guide.classs][guide.spec];
return b;
}, },
sortFunc: function(a, b) sortFunc: function(a, b)
{ {