formatd/useractionhistory

Last activity on 8 August 2018
  • 1
  • 184
composer require formatd/useractionhistory

A request history for Neos FLow applications.

v1.0.0

A request history for Neos FLow applications.

Version
v1.0.0
Type
neos-package
Release Date
10.08.2018 09:48:23
Source
git
Distribution
zip
Requires
Requires (dev)
None
Suggest
None
Provides
None
Conflicts
None
Replaces
None
MIT f281cfd153e468dad0c018cdd692de1ff63ff9c8

FormatD.UserActionHistory

A request history for Neos FLow applications. This package was mainly build for CRUD like backend interfaces but can be used for a lot of use cases.

What does it do?

It provides a session scope object with the possibility to add requests into a history stack. With this history it is possible for example to handle back-links or redirects back to the previous page after some action.

Adding Entries

Inject the UserActionHistory into your controller and add entries like that. You should not add unsafe requests (e.g. POST) to the history because if you redirect to them later it will have unexpected results.

    $this->userActionHistory->addEntry('Edit Backend-User: ' . $user->getName(), $this->request, $user);

Redirecting to previous request

If you want to redirect to the previous request for example in an updateAction you can do the following. Notice that you can provide action patterns to skip (for example if you do not want to redirect to the editAction but to the request previous to that).

    if ($lastRequest = $this->userActionHistory->getLastActionRequest('UserManagement->edit')) {
        $this->redirectToRequest($lastRequest);
    } else {
        $this->redirect('index');
    }

Displaying a linked list of history items

If you want to build a menu of your last visited pages (or last edited records in a CRUD application) you would to it like that.

In Controller:

    $this->view->assign('userActionHistoryEntries', $this->userActionHistory->getLastEntries(15, '*->index'));

In Template:

    <ul>
        <f:for each="{userActionHistoryEntries}" as="entry">
            <li>
                <f:link.action controller="History" action="redirectToActionHistoryEntry" package="FormatD.UserActionHistory" arguments="{entryId: entry.id}">
                    {entry.description}
                </f:link.action>
            </li>
        </f:for>
    </ul>

(Don't forget to make the HistoryController accessable in your routes configuration and if necessary in your policy configuration)

The content of the readme is provided by Github
The same vendor provides 9 package(s).