hid create new article ui from normal users

This commit is contained in:
Abhishek Sinha 2020-01-21 15:15:46 +05:30
parent 2fcc91850b
commit 1f600dce5a

View File

@ -603,32 +603,8 @@
<button onclick="cloudArticleApp."></button> <button onclick="cloudArticleApp."></button>
<button onclick="cloudArticleApp.export_as_file()">Export Selections as file</button> <button onclick="cloudArticleApp.export_as_file()">Export Selections as file</button>
</div> </div>
<section class="popup-container hide" id="article_creation_div"> <div id="admindiv"></div>
<div id="article_creation_modal" class="popup">
<h3>Create a new article</h3>
<input type="text" id="article_name" placeholder="Article name">
<input type="number" id="section_nums" placeholder="Number of sections">
<button onclick="hidePopup('article_creation_modal')">Cancel</button>
<button id="reset_data_btn">Create</button>
</div>
</section>
<div class="popup-container hide">
<div id="edit_article" class="popup">
<header>
<h3>Edit section names</h3>
<button onclick="cloudArticleApp.update_section_names()">
<svg viewBox="0 0 45.91 32.62">
<polyline points="0.71,17.21 14.71,31.21 45.21,0.71 "/>
</svg>
Done</button>
</header>
<div id="edit_section_container"></div>
</div>
</div>
<nav id="navbar"> <nav id="navbar">
<svg id="icon" viewBox="0 0 99.555 117.877"> <svg id="icon" viewBox="0 0 99.555 117.877">
<style type="text/css"> <style type="text/css">
@ -666,80 +642,122 @@
<div id="current_data"></div> <div id="current_data"></div>
</section> </section>
<script> <script>
// function required for popups or modals to appear
function showPopup(popup) { // function required for popups or modals to appear
let thisPopup = document.getElementById(popup); function showPopup(popup) {
thisPopup.parentNode.classList.remove('hide'); let thisPopup = document.getElementById(popup);
thisPopup.classList.add('no-transformations'); thisPopup.parentNode.classList.remove('hide');
window.onclick = function(event) { thisPopup.classList.add('no-transformations');
if (event.target == thisPopup.parentNode) window.onclick = function(event) {
hidePopup(popup); if (event.target == thisPopup.parentNode)
} hidePopup(popup);
} }
}
// hides the popup or modal
function hidePopup(popup) { // hides the popup or modal
let thisPopup = document.getElementById(popup); function hidePopup(popup) {
thisPopup.parentNode.classList.add('hide'); let thisPopup = document.getElementById(popup);
thisPopup.classList.remove('no-transformations'); thisPopup.parentNode.classList.add('hide');
thisPopup.classList.remove('no-transformations');
}
function prevArticle(container){
let observer = new IntersectionObserver((entries) => {
if(entries[0].isIntersecting)
container.children[1].classList.add('hide')
else
container.children[1].classList.remove('hide')
},{
root: container,
threshold: 1
})
observer.observe(container.children[0].firstElementChild)
container.children[0].scrollBy({
top: 0,
left: -400,
behavior: 'smooth'
});
}
function nextArticle(container){
container.children[1].classList.remove('hide')
let observer = new IntersectionObserver((entries) => {
if(entries[0].isIntersecting)
container.children[2].classList.add('hide')
else
container.children[2].classList.remove('hide')
}, {
root: container,
threshold: 1
})
observer.observe(container.children[0].lastElementChild)
container.children[0].scrollBy({
top: 0,
left: 400,
behavior: 'smooth'
});
}
function showMessage(msg) {
document.getElementById('show_log_events').textContent = msg;
if(document.getElementById('loader_container').classList.contains('hide')){
showLoader()
setTimeout(() => {
hideLoader()
}, 1000);
} }
function prevArticle(container){ }
let observer = new IntersectionObserver((entries) => { function showLoader(){
if(entries[0].isIntersecting) let spinner = document.getElementById('loader_container');
container.children[1].classList.add('hide') spinner.firstElementChild.classList.add('pulse');
else spinner.classList.remove('hide');
container.children[1].classList.remove('hide') }
},{ function hideLoader(){
root: container, let spinner = document.getElementById('loader_container');
threshold: 1 spinner.firstElementChild.classList.remove('pulse');
}) spinner.classList.add('hide');
observer.observe(container.children[0].firstElementChild) }
container.children[0].scrollBy({
top: 0, function buidAdminUI() {
left: -400,
behavior: 'smooth' if(floGlobals.subAdmins.includes(myFloID)) {
}); let admindivui = `<section class="popup-container hide" id="article_creation_div">
<div id="article_creation_modal" class="popup">
<h3>Create a new article</h3>
<input type="text" id="article_name" placeholder="Article name">
<input type="number" id="section_nums" placeholder="Number of sections">
<button onclick="hidePopup('article_creation_modal')">Cancel</button>
<button id="reset_data_btn">Create</button>
</div>
</section>
<div class="popup-container hide">
<div id="edit_article" class="popup">
<header>
<h3>Edit section names</h3>
<button onclick="cloudArticleApp.update_section_names()">
<svg viewBox="0 0 45.91 32.62">
<polyline points="0.71,17.21 14.71,31.21 45.21,0.71 "/>
</svg>
Done</button>
</header>
<div id="edit_section_container"></div>
</div>
</div>`;
document.getElementById('admindiv').innerHTML = admindivui;
const reset_data_btn = document.getElementById('reset_data_btn');
reset_data_btn.onclick = function() {
cloudArticleApp.resetArticleContent();
hidePopup('edit_article')
}
} }
function nextArticle(container){
container.children[1].classList.remove('hide')
let observer = new IntersectionObserver((entries) => { };
if(entries[0].isIntersecting) </script>
container.children[2].classList.add('hide')
else
container.children[2].classList.remove('hide')
}, {
root: container,
threshold: 1
})
observer.observe(container.children[0].lastElementChild)
container.children[0].scrollBy({
top: 0,
left: 400,
behavior: 'smooth'
});
}
function showMessage(msg) {
document.getElementById('show_log_events').textContent = msg;
if(document.getElementById('loader_container').classList.contains('hide')){
showLoader()
setTimeout(() => {
hideLoader()
}, 1000);
}
}
function showLoader(){
let spinner = document.getElementById('loader_container');
spinner.firstElementChild.classList.add('pulse');
spinner.classList.remove('hide');
}
function hideLoader(){
let spinner = document.getElementById('loader_container');
spinner.firstElementChild.classList.remove('pulse');
spinner.classList.add('hide');
}
</script>
<script id="init_lib"> <script id="init_lib">
//All util libraries required for Standard operations (DO NOT EDIT ANY) //All util libraries required for Standard operations (DO NOT EDIT ANY)
@ -9423,6 +9441,7 @@ Bitcoin.Util = {
console.log(result) console.log(result)
showMessage(result) showMessage(result)
showMessage(`Welcome FLO_ID: ${myFloID}`) showMessage(`Welcome FLO_ID: ${myFloID}`)
buidAdminUI();
cloudArticleApp.retrieveLatestContent(); cloudArticleApp.retrieveLatestContent();
}).catch(error => console.error(error)) }).catch(error => console.error(error))
} }
@ -9892,16 +9911,5 @@ Bitcoin.Util = {
</script> </script>
<script>
(function() {
const reset_data_btn = document.getElementById('reset_data_btn');
reset_data_btn.onclick = function() {
cloudArticleApp.resetArticleContent();
hidePopup('edit_article')
}
})();
</script>
</body> </body>
</html> </html>