Skip to content

Commit 35a2f19

Browse files
committed
Make filterbox work with new custom label in User Switcher.
1 parent 7d5be6b commit 35a2f19

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

TracyDebugger.module.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public static function getModuleInfo() {
2727
'summary' => __('Tracy debugger from Nette with many PW specific custom tools.', __FILE__),
2828
'author' => 'Adrian Jones',
2929
'href' => 'https://processwire.com/talk/forum/58-tracy-debugger/',
30-
'version' => '4.26.80',
30+
'version' => '4.26.81',
3131
'autoload' => 100000, // in PW 3.0.114+ higher numbers are loaded first - we want Tracy first
3232
'singular' => true,
3333
'requires' => 'ProcessWire>=2.7.2, PHP>=5.4.4',

panels/UserSwitcherPanel.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,8 @@ public function getPanel() {
110110

111111
foreach($selectableUsers->sort('name') as $u) {
112112
if($u->hasStatus('unpublished')) continue;
113-
if(count($u->roles)>1) $out .= '<option id="user_'.$u->id.'" value="'.$u->name.'" style="padding: 2px; ' . ($this->wire('user')->name === $u->name ? 'background:'.TracyDebugger::COLOR_WARN.'; color: #FFFFFF;" selected="selected"' : '"') . '>'.str_replace('()', '', wirePopulateStringTags(\TracyDebugger::getDataValue('userSwitcherUserLabel'), $u)).'</option>';
113+
$user_label = str_replace('()', '', wirePopulateStringTags(\TracyDebugger::getDataValue('userSwitcherUserLabel'), $u));
114+
if(count($u->roles)>1) $out .= '<option id="user_'.$u->id.'" data-label="'.$user_label.'" value="'.$u->name.'" style="padding: 2px; ' . ($this->wire('user')->name === $u->name ? 'background:'.TracyDebugger::COLOR_WARN.'; color: #FFFFFF;" selected="selected"' : '"') . '>'.$user_label.'</option>';
114115
}
115116
$out .= '
116117
</select>

scripts/user-switcher-search.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ addFilterBox({
44
selector: "#tracy-debug-panel-UserSwitcherPanel select[name='userSwitcher']",
55
items: "option"
66
},
7+
extraFilterAttrs: [
8+
'data-label'
9+
],
710
wrapper: {
811
attrs: {
912
id: "tracyUserSwitcherFilterBoxWrap",

0 commit comments

Comments
 (0)