Page 1 of 1
Replace icon user by photo and username
Posted: Sat Aug 19, 2017 6:41 am
by smpsrllc
The v2018 generates the icon like this:
<a href="#" class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
<span class="glyphicon glyphicon-user" aria-hidden="true"></span>
</a>
As a change to generate it as it does adminLTE:
<a href="#" class="dropdown-toggle" data-toggle="dropdown" aria-expanded="true">
<img src="dist/img/user2-160x160.jpg" class="user-image" alt="User Image">
<span class="hidden-xs">Alexander Pierce</span>
</a>
I tray only for the photo this form:
client scripts -> Global -> Pages with header/footer -> Startup Script
remove icon user is working
$(".glyphicon-user").remove();
$(".dropdown-toggle").before('<img src="dist/img/user2-160x160.jpg" class="user-image" alt="User Image">');
No working good.
Thank you for your help.
Re: Replace icon user by photo and username
Posted: Sat Aug 19, 2017 9:18 am
by Webmaster
Use Page_Foot server event (read Server Events and Client Scripts in the help file) to add your own auto render template:
<script type="text/html" class="ewJsTemplate" data-name="login" data-data="login" data-method="appendTo" data-target=".navbar-custom-menu .nav">
...your template...
</script>
See the original template in footer.php as example.
You can use Startup Script also but you should use a more specific class name since "dropdown-toggle" is a general Bootstrap class for dropdown and there may be more than one.
Re: Replace icon user by photo and username
Posted: Sun Aug 20, 2017 4:58 am
by hemin
lets say we used this :
{{if isLoggedIn}}
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<img src=" userprofile " class="user-image" alt=" " >
</a>
.............
how can i get another value like {{:currentUserName}} for instance {{:currentUserProfilePic}} where should i declare this variable?
Re: Replace icon user by photo and username
Posted: Mon Aug 21, 2017 9:27 am
by Webmaster
You can set current user info to $LoginStatus, e.g. in Page_Loading server event (requires v2018.0.2)
LoginStatus("currentUserProfilePic", Profile("pic")); // Assume "pic" is a varchar field (not BLOB field) in the user table
Re: Replace icon user by photo and username
Posted: Tue Aug 22, 2017 4:29 am
by smpsrllc
Hello
The scritp right is
<script type="text/html" class="ewJsTemplate" data-name="dropdown-toggle" data-method="replaceAll" data-target=".glyphicon-user" data-seq="5">
<img src="dist/img/user2-160x160.jpg" class="user-image" alt="User Image">
<span class="hidden-xs">Alexander Pierce</span>
</script>
Thanks