-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- remove legacy Page Templates functionality - remove Template Cloud functionality for new users & users who weren't using the feature - we have launched a dedicated Templates Cloud plugin that offers advanced permission controls and additional features. which you can try from your Themeisle account - if you already have templates saved in the cloud, you can still use them in this plugin if you already have a license key set up
- Loading branch information
Showing
20 changed files
with
650 additions
and
302 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import {__} from '@wordpress/i18n'; | ||
import {Button} from '@wordpress/components'; | ||
import {close} from '@wordpress/icons'; | ||
import {useState} from '@wordpress/element'; | ||
import {ajaxAction} from '../utils/rest'; | ||
|
||
export default function () { | ||
const [isVisible, setIsVisible] = useState(true); | ||
|
||
const { | ||
show, | ||
ajaxURL, | ||
nonce | ||
} = window.tiobDash.newTCNotice; | ||
|
||
const dismissNotice = () => { | ||
ajaxAction( | ||
ajaxURL, | ||
'dismiss_new_tc_notice', | ||
nonce | ||
).then( (r) => { | ||
console.log(r); | ||
setIsVisible(false); | ||
} ).catch(e => { | ||
console.error(e); | ||
} ); | ||
}; | ||
|
||
if (!show || ! isVisible) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<div className="tiob-new-tc-notice"> | ||
<div> | ||
<p> | ||
{__('We\'ve launched a dedicated Templates Cloud plugin that offers advanced permission controls and additional features. Try it out from your Themeisle account.', 'templates-patterns-collection')} | ||
</p> | ||
|
||
<p className="description"> | ||
{__('If you already have templates saved in the cloud, you can still use them in this plugin.', 'templates-patterns-collection')} | ||
</p> | ||
</div> | ||
|
||
<Button | ||
size="compact" | ||
className="dismiss" | ||
icon={close} | ||
iconSize={20} | ||
label={__('Dismiss', 'templates-patterns-collection')} | ||
onClick={dismissNotice} | ||
/> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
.tiob-new-tc-notice { | ||
padding: 10px 20px; | ||
background: #fff; | ||
border: 1px solid #e5e5e5; | ||
display: flex; | ||
margin-top: 20px; | ||
width: 100%; | ||
gap: 20px; | ||
box-sizing: border-box; | ||
align-items: center; | ||
border-left: 5px solid var(--wp-admin-theme-color, #3858e9); | ||
|
||
p { | ||
margin: 0 0 10px; | ||
font-size: 14px; | ||
} | ||
|
||
.description { | ||
font-size: 12px; | ||
margin: 0; | ||
} | ||
|
||
.dismiss { | ||
flex-shrink: 0; | ||
margin-left: auto; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,63 +1,61 @@ | ||
/* global FLBuilder */ | ||
|
||
if ( parseInt( window.tiTpc.tier ) === 3 ) { | ||
const contextMenu = document.getElementById( 'tmpl-fl-row-overlay' ); | ||
|
||
const tpcExport = ( e ) => { | ||
const row = e.closest( '.fl-row' ); | ||
const node = row.dataset.node; | ||
|
||
const message = `<div class="tpc-template-cloud-export-modal"> | ||
<h1>${ window.tiTpc.exporter.modalLabel }</h1> | ||
<label for="tpc-${ node }">${ window.tiTpc.exporter.textLabel }</label> | ||
<input id="tpc-${ node }" type="text" placeholder="${ window.tiTpc.exporter.textPlaceholder }" /> | ||
</div>`; | ||
|
||
FLBuilder.confirm( { | ||
message, | ||
ok: () => { | ||
const input = document.getElementById( `tpc-${ node }` ); | ||
const title = input.value || 'Template'; | ||
setTimeout( function () { | ||
FLBuilder.showAjaxLoader(); | ||
FLBuilder.ajax( | ||
{ | ||
action: 'ti_export_template', | ||
node, | ||
title, | ||
}, | ||
( res ) => { | ||
if ( undefined !== res.success && ! res.success ) { | ||
FLBuilder.alert( | ||
`<h1>${ window.tiTpc.exporter.exportFailed }</h1> ${ res.data }` | ||
); | ||
} | ||
|
||
FLBuilder.hideAjaxLoader(); | ||
const contextMenu = document.getElementById( 'tmpl-fl-row-overlay' ); | ||
|
||
const tpcExport = ( e ) => { | ||
const row = e.closest( '.fl-row' ); | ||
const node = row.dataset.node; | ||
|
||
const message = `<div class="tpc-template-cloud-export-modal"> | ||
<h1>${ window.tiTpc.exporter.modalLabel }</h1> | ||
<label for="tpc-${ node }">${ window.tiTpc.exporter.textLabel }</label> | ||
<input id="tpc-${ node }" type="text" placeholder="${ window.tiTpc.exporter.textPlaceholder }" /> | ||
</div>`; | ||
|
||
FLBuilder.confirm( { | ||
message, | ||
ok: () => { | ||
const input = document.getElementById( `tpc-${ node }` ); | ||
const title = input.value || 'Template'; | ||
setTimeout( function () { | ||
FLBuilder.showAjaxLoader(); | ||
FLBuilder.ajax( | ||
{ | ||
action: 'ti_export_template', | ||
node, | ||
title, | ||
}, | ||
( res ) => { | ||
if ( undefined !== res.success && ! res.success ) { | ||
FLBuilder.alert( | ||
`<h1>${ window.tiTpc.exporter.exportFailed }</h1> ${ res.data }` | ||
); | ||
} | ||
); | ||
}, 1000 ); | ||
}, | ||
strings: { | ||
ok: window.tiTpc.exporter.buttonLabel, | ||
cancel: window.tiTpc.exporter.cancelLabel, | ||
}, | ||
} ); | ||
}; | ||
|
||
window.tiTpc.tpcExport = tpcExport; | ||
|
||
if ( contextMenu ) { | ||
const text = contextMenu.textContent; | ||
contextMenu.textContent = text.replace( | ||
// eslint-disable-next-line prettier/prettier | ||
'<li><a class="fl-block-row-reset" href="javascript:void(0);">Reset Row Width</a></li>', | ||
// eslint-disable-next-line prettier/prettier | ||
'<li><a class="fl-block-row-reset" href="javascript:void(0);">Reset Row Width</a></li><li><a class="fl-block-row-tpc-export" onclick="window.tiTpc.tpcExport(this)" href="javascript:void(0);">Save to Templates Cloud</a></li>' | ||
); | ||
} | ||
|
||
FLBuilder.addHook( 'tiTpcExport', () => { | ||
window.tiTpc.initModalExport(); | ||
|
||
FLBuilder.hideAjaxLoader(); | ||
} | ||
); | ||
}, 1000 ); | ||
}, | ||
strings: { | ||
ok: window.tiTpc.exporter.buttonLabel, | ||
cancel: window.tiTpc.exporter.cancelLabel, | ||
}, | ||
} ); | ||
}; | ||
|
||
window.tiTpc.tpcExport = tpcExport; | ||
|
||
if ( contextMenu ) { | ||
const text = contextMenu.textContent; | ||
contextMenu.textContent = text.replace( | ||
// eslint-disable-next-line prettier/prettier | ||
'<li><a class="fl-block-row-reset" href="javascript:void(0);">Reset Row Width</a></li>', | ||
// eslint-disable-next-line prettier/prettier | ||
'<li><a class="fl-block-row-reset" href="javascript:void(0);">Reset Row Width</a></li><li><a class="fl-block-row-tpc-export" onclick="window.tiTpc.tpcExport(this)" href="javascript:void(0);">Save to Templates Cloud</a></li>' | ||
); | ||
} | ||
|
||
FLBuilder.addHook( 'tiTpcExport', () => { | ||
window.tiTpc.initModalExport(); | ||
} ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.