Skip to content

Commit

Permalink
Re-designed the profile page and added new hooks for profile stats an…
Browse files Browse the repository at this point in the history
…d links
  • Loading branch information
ChristopherDay committed Jan 14, 2020
1 parent 08f98f2 commit 2f1744a
Show file tree
Hide file tree
Showing 5 changed files with 111 additions and 58 deletions.
6 changes: 6 additions & 0 deletions modules/installed/mail/mail.hooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,10 @@
"sort" => -1
);
});
new hook("profileLink", function ($user) {
return array(
"url" => "?page=mail&action=new&name=" . $user->info->U_name,
"text" => "Mail"
);
});
?>
9 changes: 9 additions & 0 deletions modules/installed/profile/profile.hooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,13 @@
"sort" => 900
);
});
new hook("profileLink", function ($profile) {
global $user;
if ($user->id == $profile->info->U_id) {
return array(
"url" => "?page=profile&action=edit",
"text" => "Edit Profile"
);
}
});
?>
7 changes: 6 additions & 1 deletion modules/installed/profile/profile.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ public function constructModule() {
}
}

$links = new Hook("profileLink");
$stats = new Hook("profileStat");

$this->html .= $this->page->buildElement('profile', array(
"picture" => $pic,
"user" => $profile->user,
Expand All @@ -66,7 +69,9 @@ public function constructModule() {
"bio" => $bio,
"role" => $profile->info->UR_desc,
"showRole" => $profile->info->UR_id != 1,
"edit" => $edit
"edit" => $edit,
"profileLinks" => $links->run($profile),
"profileStats" => $stats->run($profile)
));

}
Expand Down
16 changes: 16 additions & 0 deletions modules/installed/profile/profile.styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.user-profile .panel-body {
padding: 5px;
}

.profile-user-stats,
.user-profile .nav li a {
margin-bottom:0px;
}

.panel-body.profile-pic {
padding: 0px;
}

.profile-user-stats li {
padding: 7px;
}
131 changes: 74 additions & 57 deletions modules/installed/profile/profile.tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,81 +123,98 @@ class profileTemplate extends template {

public $profile = '
<div class="panel panel-default">
<div class="panel-heading">{user.name}\' Profile</div>
<div class="panel panel-default user-profile">
<div class="panel-heading">Links</div>
<div class="panel-body">
<div class="row">
<div class="col-md-4 col-lg-3">
<img src="{picture}" style="max-height: 150px; max-width: 100%;" class="img-rounded img-thumbnail" alt="{user.name}\'s Profile" />
</div>
<div class="col-md-8 col-lg-9">
<table class="table table-borderless table-condensed">
<tr>
<th width="100px">Username</th>
<td class="text-left">
<a href="?page=mail&action=new&name={user.name}" class="user user-status-{user.status} user-level-{user.userLevel}" style="color: {user.color};">
{user.name}
</a>
<ul class="nav nav-pills">
{#each profileLinks}
<li><a href="{url}">{text}</a></li>
{/each}
</ul>
</div>
</div>
<div class="row">
<div class="col-md-8 col-lg-9">
<div class="panel panel-default">
<div class="panel-heading">{user.name}</div>
<div class="panel-body">
<ul class="list-group text-left profile-user-stats">
<li class="list-group-item">
<strong>Username</strong>
<span class="pull-right">
{>userName}
<sup><{status}></sup>
</td>
</tr>
<tr>
<th width="100px">Last Active</th>
<td class="text-left">{_ago laston} ago</td>
</tr>
<tr>
<th width="100px">Status</th>
<td class="text-left">
</span>
</li>
<li class="list-group-item">
<strong>Last Active</strong>
<span class="pull-right">{_ago laston} ago</span>
</li>
<li class="list-group-item">
<strong>Status</strong>
<span class="pull-right">
{#if dead}
<strong style="color: #900;">DEAD</strong> <{killedBy}>
{/if}
{#unless dead}
<strong style="color: #090;">Alive</strong>
{/unless}
</td>
</tr>
</span>
</li>
{#if showRole}
<tr>
<th width="100px">Role</th>
<td class="text-left">{role}</td>
</tr>
<li class="list-group-item">
<strong>Role</strong>
<span class="pull-right">
{role}
</span>
</li>
{/if}
<tr>
<th width="100px">Rank</th>
<td class="text-left">{rank}</td>
</tr>
<tr>
<th width="100px">Wealth</th>
<td class="text-left">{moneyRank}</td>
</tr>
<tr>
<th width="100px">Gang</th>
<td class="text-left">
<a href="?page=gangs&action=view&id={gangID}">
{gang}
</a>
</td>
</tr>
</table>
<li class="list-group-item">
<strong>Rank</strong>
<span class="pull-right">
{rank}
</span>
</li>
<li class="list-group-item">
<strong>Wealth</strong>
<span class="pull-right">
{moneyRank}
</span>
</li>
{#each profileStats}
<li class="list-group-item">
<strong>{text}</strong>
<span class="pull-right">
<{stat}>
</span>
</li>
{/each}
</ul>
</div>
</div>
</div>
<div class="col-md-4 col-lg-3">
<div class="panel panel-default">
<div class="panel-heading">Profile Picture</div>
<div class="panel-body profile-pic">
<img src="{picture}" style="max-height: 250px" class="img-responsive" alt="{user.name}\'s Profile" />
</div>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">Bio</div>
<div class="panel-body">
{#if bio}
[{bio}]
{/if}
{#unless bio}
<em><small>The user has not set up their bio yet!</small></em>
{/unless}
{#if edit}
<div class="row">
<div class="col-md-12 text-right ">
<a href="?page=profile&action=edit" class="btn">Edit Profile</a>
</div>
</div>
{/if}
</div>
</div>
';
Expand Down

1 comment on commit 2f1744a

@agscs
Copy link
Contributor

@agscs agscs commented on 2f1744a Feb 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice love this new Design

Please sign in to comment.