Skip to content

kimjtest/DMN-WebSite

Repository files navigation

DMN

Variables

Exceptions are sent to a slack channel by default. If you want to turn this off for local development, create a .env.local file and add SEND_SLACK_ERRORS=false to it.

Interactions

DMN tracks various interactions in the system and stores them in the interactions table via the Interaction entity.

The ipad app does this, and the web does this too.

All interactions refer to an Element so we know what was interacted with. In the web, we store all interaction ids in the App\Utility\ElementsReference class.

You can then use the InteractionService to create interactions using the Element Ids and then persist and flush them into the database

Web Design

For the web, there are three ways to track interactions.

Controller

Some interactions are tracked in a controller, such as creating/editing an event.

Sample code:

$tap = $interactionService->tapWeb($this->getUser(), ElementReference::buttonEditEntryEventSave);
$this->persist($tap, true);

HTML Data Attributes

You can trigger an interaction API request by adding data attributes to an element. The templates/mobileframe_base_bootstrap.html.twig file checks for these and creates the event listener.

Sample

    <div
        data-controller="interaction" <!-- This is needed to hook up the event. If there is already a data-controller, you can use data-controller-2 -->
        data-element="5" <!-- use {{elements.elementId}} for twig -->
        data-event="click" <!-- optional. The event to listen to, defaults to click -->
        data-interaction="tap" <!-- optional. The interaction to send. Defaults to 'tap' --> 
        data-token="abc" <!-- optional. The token to send. Defaults to empty string. --> 
        data-type="type" <!-- optional. The type to send. Defaults to empty string -->
    > 
    Click me!
    </div>

Javascript Raw

You can also send an interaction using the API. This is done with the notes.js file since a lot of the logic to hook up events is already in there.

The code is in common.js and the function looks like

function createInteraction(elementId, interaction, token, type)

So you can call it using,

createInteraction(5, 'tap', 'token', 'type');

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •