DiscipleTools / DiscipleTools/disciple-tools-theme

Magic Links V2

Open
#2,798 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
PHP
Stars
48
Forks
66
Avg merge
2m
Merged PRs (30d)
2

Description

Current
`/root/type/key`
Magic links are a url that opens up a small portal or app. The key is is unique to each record/user and determines access to data and what is shown.

V2

## All magic links start with `/apps`.
Currently every url is check to see if it matches an existing magic link. This is inefficient and tends to lead to unneeded database calls.

## Streamline App registration in code
Make registration simpler. We currently have a bunch of class variables, hooks, magic functions. Here as some examples:

```
public $post_type = '';
public $type = '';
public $type_name = '';
private $meta_key;
public $page_title = '';
public $page_description = '';
public $type_actions = [
'' => 'Manage',
];
public $show_bulk_send = false; // enables bulk send of magic links from list page
public $show_app_tile = false; // enables addition to "app" tile sharing features

public $module = ''; // Lets a magic url be a module as well
public $instance_id = ''; // Allows having multiple versions of the same magic link for a user. Creating different meta_keys.
public $meta = [];

public function __construct( $template = null ) {
$this->meta = [
'app_type' => 'magic_link',
'class_type' => 'template',
'show_in_home_apps' => $show_in_apps,
'icon' => 'mdi mdi-account-network',
];
}

public function dt_settings_apps_list( $apps_list ) {
$apps_list[ $this->meta_key ] = [
'key' => $this->meta_key,
'url_base' => $this->root . '/' . $this->type,
'label' => $this->page_title,
'description' => $this->page_description,
'settings_display' => true
];

return $apps_list;
}
```

## Separate the registration and the running of the magic links
Registration lets magic links show in the home screen, user and contact tiles, user settings, etc

Loading the magic link page and running the api calls should only happen when the specific magic link is being loaded or user.

## All form magic links use same code to display fields and handle field updates.
Currently we have multiple implementations of field rendering and magic link submits

## Pull magic link template creating into core
- this will be 🔥

## Rename magic links to `Apps`

## Remove theme js and css for loading on magic links unless explicitly requested.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.