mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-28 05:37:34 +03:00
Added ability to show / hide signup form in a post (#16792)
closes https://github.com/TryGhost/Team/issues/3200 https://ghost.slack.com/archives/C02G9E68C/p1684150226572149 - a little prototype to see if we can hide the new WIP signup form in a post, if a user is already logged in and portal is loaded. - the idea is that the signup card will be hidden by default in a post/page and only initiated by Portal if the defined conditions are met.
This commit is contained in:
parent
ef0b863c2b
commit
6289d756ed
@ -183,6 +183,18 @@ export default class App extends React.Component {
|
||||
this.updateStateForPreviewLinks();
|
||||
};
|
||||
window.addEventListener('hashchange', this.hashHandler, false);
|
||||
|
||||
// spike ship - to test if we can show / hide signup forms inside post / page
|
||||
if (!member) {
|
||||
// the signup card will ship hidden by default, so we need to show it if the user is not logged in
|
||||
// not sure why a user would have more than one form on a post, but just in case we'll find them all
|
||||
const formElements = document.querySelectorAll('[data-lexical-signup-form]');
|
||||
if (formElements.length > 0){
|
||||
formElements.forEach((element) => {
|
||||
element.style.display = '';
|
||||
});
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
/* eslint-disable no-console */
|
||||
console.error(`[Portal] Failed to initialize:`, e);
|
||||
|
Loading…
Reference in New Issue
Block a user