I cannot take credit for this as someone else gave this to me, but I thought it needed to be shared with the community. If I could remember who gave it to me I would give you credit here ;)


EasyReturnGif.gif


This will add a button at the top of the internal page that will provide a link to the last Person, Group, Dataview, and Report that you viewed so you can easily go back to viewing it. Follow along to learn how.

Add an HTML block as a site block and put the following code in the HTML block. Make sure to enable RockEntity on the block settings.

<style>
    #quickreturn {
        width:140px;
        margin-right:1.5em;
        color: initial;
        background-color: transparent;
    }
    #quickreturn b {
        padding-left:0.75em;
    }
</style>
{% assign lastperson = CurrentPerson | GetUserPreference:'lastperson' | PersonById %}
{% assign lastgroup = CurrentPerson | GetUserPreference:'lastgroup' | GroupById %}
{% assign lastdv = CurrentPerson | GetUserPreference:'lastdv' %}
{% assign lastreport = CurrentPerson | GetUserPreference:'lastreport' %}


<div class="smartsearch" id="quickreturn">
<ul class="nav pull-right smartsearch-type">
<li class="dropdown"><a class="dropdown-toggle navbar-link" data-toggle="dropdown">Easy Return <b class="fa fa-caret-down"></b></a>
<ul class="dropdown-menu">
{% if lastperson %}
<li><b>Person</b></li>
<li><a href="/person/{{ lastperson.Id }}">{{ lastperson.FullName }}</a></li>
{% endif %}
{% if lastgroup %}
<li><b>Group</b></li>
<li><a href="/page/113?GroupId={{ lastgroup.Id }}">{{ lastgroup.Name }}</a></li>
{% endif %}
{% if lastdv %}
<li><b>Data View</b></li>
<li>{% dataview id:'{{ lastdv }}' %}<a href="/page/145?DataViewId={{ dataview.Id }}">{{ dataview.Name }}{% enddataview %}</a></li>
{% endif %}
{% if lastreport %}
<li><b>Report</b></li>
<li>{% report id:'{{ lastreport }}' %}<a href="/page/149?ReportId={{ report.Id }}">{{ report.Name }}{% endreport %}</a></li>
{% endif %}
</ul>
</li>
</ul>
</div>


Next go to anyone's Person Profile Page and edit the Person Bio Block. Go to Advanced Settings Pre-HTML and add:

{{ CurrentPerson | SetUserPreference:'lastperson',PageParameter.PersonId }}

Next go to Group Viewer and view a group. Edit the Group Detail Right Block and in Advanced Settings Pre-HTML add:

{% if PageParameter.GroupId and PageParameter.GroupId <> 0 %}{{ CurrentPerson | SetUserPreference:'lastgroup',PageParameter.GroupId }}{% endif %}

Next go to Dataviews and view a dataview. Edit the Data Views Block and in Advanced Settings Pre-HTML add:

{% if PageParameter.DataViewId and PageParameter.DataViewId <> 0 %}{{ CurrentPerson | SetUserPreference:'lastdv',PageParameter.DataViewId }}{% endif %}

Next go to Reports and view a report. Edit the Report Detail Block and in Advanced Settings Pre-HTML add:

{% if PageParameter.ReportId and PageParameter.ReportId <> 0 %}{{ CurrentPerson | SetUserPreference:'lastreport',PageParameter.ReportId }}{% endif %}


This will add a user preference of the last person, group, dataview, and report that enables the easy return function to work.