Skip to content

Commit

Permalink
MWPW-124580 - Promote Publish Milo changes (adobecom#782)
Browse files Browse the repository at this point in the history
- Added Promote Publish Option
 - Passing this to Promote Action

Co-authored-by: armohamm <armohamm@adobe.com>
  • Loading branch information
2 people authored and vgoodric committed Feb 1, 2024
1 parent 418a7eb commit 36886d1
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tools/floodgate/css/floodgate.css
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,15 @@
margin: 15% auto;
padding: 20px;
border: 1px solid #888;
width: 20%;
width: 25%;
text-align: center;
}

.fg-modal-buttons button {
margin: 10px;
}

.promote-publish-options {
display: none;
padding-top: 20px;
}
4 changes: 4 additions & 0 deletions tools/floodgate/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ <h2 class="title">Project Status</h2>
<button id="yes-btn">Yes</button>
<button id="no-btn">No</button>
</div>
<div id="promote-publish-options" class="promote-publish-options">
<input class="promote-publish-radio" type="radio" name="promotePublishRadio" value="promoteOnly" checked>Promote Only?</input>
<input class="promote-publish-radio" type="radio" name="promotePublishRadio" value="promotePublish">Promote and Publish Promoted Pages?</input>
</div>
</div>
</div>
</main>
Expand Down
13 changes: 13 additions & 0 deletions tools/floodgate/js/floodgate.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ async function promoteContentAction(project, config) {
params.spToken = getAccessToken();
// consider fgRoot as the project path for promote action.
params.projectRoot = config.sp.fgRootFolder;
// Based on User selection on the Promote Dialog,
// passing the param if user also wants to Publish the Promoted pages.
params.doPublish = 'promotePublish' ===
document.querySelector('input[name="promotePublishRadio"]:checked')?.value;
const promoteStatus = await postData(config.sp.aioPromoteAction, params);
updateProjectStatusUIFromAction({ promoteStatus });
}
Expand Down Expand Up @@ -89,14 +93,23 @@ function setListeners(project, config) {
document.querySelector('#promoteFiles button').addEventListener('click', (e) => {
modal.getElementsByTagName('p')[0].innerText = `Confirm to ${e.target.textContent}`;
modal.style.display = 'block';
togglePromotePublishRadioVisibility('block');
document.querySelector('#fg-modal #yes-btn').addEventListener('click', handlePromoteConfirm);
});
document.querySelector('#fg-modal #no-btn').addEventListener('click', () => {
modal.style.display = 'none';
togglePromotePublishRadioVisibility('none');
});
document.querySelector('#loading').addEventListener('click', loadingOFF);
}

function togglePromotePublishRadioVisibility(visibility) {
const promotePublishOptions = document.getElementById('promote-publish-options');
promotePublishOptions.style.display = visibility;
const promotePublishRadio = document.getElementById('promotePublishRadio');
promotePublishRadio.checked = true;
}

async function init() {
try {
// Read the Floodgate Sharepoint Config
Expand Down

0 comments on commit 36886d1

Please sign in to comment.