summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2021-04-14 22:23:18 +0200
committerJules Laplace <julescarbon@gmail.com>2021-04-14 22:23:18 +0200
commit4931a78b1606359391066506cc3935f0f3e759e9 (patch)
tree56fcd2c00cc357069b25b21bfa6e909de82e8c36
parent6b434e1996fdcc7b14819c32f7808475fa726339 (diff)
toggle popup
-rw-r--r--cli/app/site/export.py2
-rw-r--r--frontend/app/views/tile/components/tile.form.js3
-rw-r--r--frontend/app/views/tile/forms/tile.constants.js2
-rw-r--r--frontend/site/viewer/viewer.container.js6
4 files changed, 12 insertions, 1 deletions
diff --git a/cli/app/site/export.py b/cli/app/site/export.py
index 89db305..354c0a5 100644
--- a/cli/app/site/export.py
+++ b/cli/app/site/export.py
@@ -99,6 +99,8 @@ def sanitize_graph(graph):
tile['href'] = '__open_popup'
elif tile['target_page_id'] == -3:
tile['href'] = '__close_popup'
+ elif tile['target_page_id'] == -4:
+ tile['href'] = '__toggle_popup'
elif tile['target_page_id'] > 0:
tile['href'] = page_path_lookup[tile['target_page_id']]
if 'url' in tile['settings'] and tile['settings']['url'].startswith('/static'):
diff --git a/frontend/app/views/tile/components/tile.form.js b/frontend/app/views/tile/components/tile.form.js
index 54b736e..2e6dfef 100644
--- a/frontend/app/views/tile/components/tile.form.js
+++ b/frontend/app/views/tile/components/tile.form.js
@@ -22,7 +22,8 @@ import {
IMAGE_TILE_STYLES, VIDEO_STYLES,
TEXT_FONT_FAMILIES, TEXT_FONT_STYLES,
CURSORS, UNITS,
- NO_LINK, EXTERNAL_LINK, OPEN_POPUP_LINK, CLOSE_POPUP_LINK,
+ NO_LINK, EXTERNAL_LINK,
+ OPEN_POPUP_LINK, CLOSE_POPUP_LINK, TOGGLE_POPUP_LINK,
PAGE_LIST_TOP_OPTIONS,
NO_POPUP, POPUP_LIST_TOP_OPTIONS,
} from 'app/views/tile/forms/tile.constants'
diff --git a/frontend/app/views/tile/forms/tile.constants.js b/frontend/app/views/tile/forms/tile.constants.js
index 273085c..322a081 100644
--- a/frontend/app/views/tile/forms/tile.constants.js
+++ b/frontend/app/views/tile/forms/tile.constants.js
@@ -80,11 +80,13 @@ export const NO_LINK = 0
export const EXTERNAL_LINK = -1
export const OPEN_POPUP_LINK = -2
export const CLOSE_POPUP_LINK = -3
+export const TOGGLE_POPUP_LINK = -4
export const PAGE_LIST_TOP_OPTIONS = [
{ name: NO_LINK, label: 'No link' },
{ name: EXTERNAL_LINK, label: 'External link' },
{ name: OPEN_POPUP_LINK, label: 'Open popup' },
{ name: CLOSE_POPUP_LINK, label: 'Close popup' },
+ { name: TOGGLE_POPUP_LINK, label: 'Toggle popup' },
{ name: -99, label: '──────────', disabled: true },
]
diff --git a/frontend/site/viewer/viewer.container.js b/frontend/site/viewer/viewer.container.js
index c5dbd92..c075cfd 100644
--- a/frontend/site/viewer/viewer.container.js
+++ b/frontend/site/viewer/viewer.container.js
@@ -128,6 +128,12 @@ class ViewerContainer extends Component {
[tile.settings.target_popup]: false,
})
}
+ else if (tile.href === '__toggle_popup') {
+ actions.site.setPopups({
+ ...this.props.popups,
+ [tile.settings.target_popup]: !this.props.popups[tile.settings.target_popup],
+ })
+ }
else if (!tile.settings.navigate_when_audio_finishes) {
history.push(tile.href)
}