mirror of https://github.com/BOINC/boinc.git
web: fix layout problem with forum tables
Forum messages are shown in a table: left column is sender info, right column is the message. The left column was fixed width (10em). On very hi-res monitors people increase their font size. This causes the "Send message" button to overflow the column. Solution: don't use fixed width, and make the right column 100% width. This makes the left column wide enough for its contents to fit, but no wider. This solves the problem, but introduces a (minor) new one: some users have extremely long user names, and this makes the left column too wide, not just for that post but for the whole thread. Solution: in this particular place, if name is > 30 chars, show only the first 30 chars followed by ellipsis.
This commit is contained in:
parent
650127da84
commit
3d06fbf763
|
@ -220,17 +220,15 @@ function show_team_forum_title($forum, $thread=null, $link_thread=false) {
|
|||
echo "</span>";
|
||||
}
|
||||
|
||||
// start a table containing messages, where the layout is fixed
|
||||
// (to accommodate long [pre] lines)
|
||||
// and the left column (author info) has fixed size
|
||||
// start a table of forum posts
|
||||
//
|
||||
function start_forum_table($headings) {
|
||||
$a = array();
|
||||
foreach ($headings as $h) {
|
||||
$a[] = null;
|
||||
}
|
||||
$a[0] = 'style="width: 10em;"';
|
||||
start_table('table-striped', 'table-layout:fixed');
|
||||
$a[1] = 'style="width: 100%"';
|
||||
start_table('table-striped');
|
||||
row_heading_array($headings, $a);
|
||||
}
|
||||
|
||||
|
@ -588,7 +586,7 @@ function show_post(
|
|||
<a name=\"$post->id\"></a>
|
||||
";
|
||||
|
||||
echo user_links($user, 0);
|
||||
echo user_links($user, 0, 30);
|
||||
echo "<br>";
|
||||
if ($user->create_time > time()-ST_NEW_TIME) $fstatus.=ST_NEW."<br>";
|
||||
echo "<span class=\"small\">";
|
||||
|
|
|
@ -326,8 +326,9 @@ function friend_links($user) {
|
|||
|
||||
// show user name, with links to profile if present.
|
||||
// if $badge_height is > 0, show badges
|
||||
// if $name_limit, limit name to N chars
|
||||
//
|
||||
function user_links($user, $badge_height=0) {
|
||||
function user_links($user, $badge_height=0, $name_limit=0) {
|
||||
BoincForumPrefs::lookup($user);
|
||||
if (is_banished($user)) {
|
||||
return "(banished: ID $user->id)";
|
||||
|
@ -337,7 +338,11 @@ function user_links($user, $badge_height=0) {
|
|||
$img_url = url_base()."img/head_20.png";
|
||||
$x .= ' <a href="'.url_base().'view_profile.php?userid='.$user->id.'"><img title="View the profile of '.$user->name.'" src="'.$img_url.'" alt="Profile"></a>';
|
||||
}
|
||||
$x .= " <a href=\"".url_base()."show_user.php?userid=".$user->id."\">".$user->name."</a>";
|
||||
$name = $user->name;
|
||||
if ($name_limit && strlen($name) > $name_limit) {
|
||||
$name = substr($name, 0, $name_limit)."...";
|
||||
}
|
||||
$x .= " <a href=\"".url_base()."show_user.php?userid=".$user->id."\">".$name."</a>";
|
||||
if (function_exists("project_user_links")){
|
||||
$x .= project_user_links($user);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue