Skip to content

Commit

Permalink
Merge pull request #1 from shivang2joshi/bugfix-template3
Browse files Browse the repository at this point in the history
load from db: condition checked
  • Loading branch information
shivang2joshi authored Jun 21, 2020
2 parents 57eb567 + 320473c commit 2a80e61
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 48 deletions.
47 changes: 25 additions & 22 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,29 @@ var config = {
firebase.initializeApp(config);
var currentUser;
setTimeout(() => {
firebase.auth().onAuthStateChanged(function (user) {
// calling other window in here will run abruptly
if (user) {
//'printf(user);
//signed in
currentUser = user;
if (document.getElementById('user-photo')) { //to be sure we have such element on this page.
document.getElementById('user-photo').src = user.photoURL;
}
if (document.getElementById('user-name')) {
document.getElementById('user-name').innerHTML = user.displayName;
}
if (document.getElementById('user-id')) {
document.getElementById('user-id').innerHTML = user.email;
}
console.log("runs one time");
} else {
//not signed in
printf('not signed in');
currentUser = null;
firebase.auth().onAuthStateChanged(function (user) {
// calling other window in here will run abruptly
if (user) {
//'printf(user);
//signed in
currentUser = user;
if (document.getElementById('user-photo')) { //to be sure we have such element on this page.
document.getElementById('user-photo').src = user.photoURL;
}
});
}, 1000);
if (document.getElementById('user-name')) {
document.getElementById('user-name').innerHTML = user.displayName;
}
if (document.getElementById('user-id')) {
document.getElementById('user-id').innerHTML = user.email;
}
console.log("runs one time");
} else {
//not signed in
printf('not signed in');
currentUser = null;

if (window.location.pathname !== '/index.html')
window.location = "./index.html";
}
});
}, 800);
8 changes: 4 additions & 4 deletions dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
<h4 class="card-title">DA-IICT Regular</h4>
<p class="card-text fontwhite">DA-IICT | Student Placement Cell
recommanded resume format for on-campus interviews</p>
<a id="prev-resume-daiict" title="Click to preview" href="#">
<a id="prev-resume-daiict" title="Click to preview" href="#">
<img src="img/resumes/daiict.png" class="card-img-top get-big">
</a>
<a id="select-link-1" href="resume_daiict_regular.html" class="btn-select fontwhite">Select</a>
Expand All @@ -120,7 +120,7 @@ <h4 class="card-title">DA-IICT Regular</h4>
<h4 class="card-title">DA-IICT Classic</h4>
<p class="card-text fontwhite">DA-IICT | Classic version of
recommanded resume format for on-campus interviews</p>
<a id="prev-resume-daiict-classic" title="Click to preview" >
<a id="prev-resume-daiict-classic" title="Click to preview">
<img src="img/resumes/daiict_classic.png" class="card-img-top get-big" alt=".......">
</a>
<a id="select-link-2" href="resume_daiict_classic.html" class="btn-select fontwhite">Select</a>
Expand All @@ -133,7 +133,7 @@ <h4 class="card-title">DA-IICT Classic</h4>
<div class="card-body">
<h4 class="card-title">Elon Musk Style</h4>
<p class="card-text fontwhite">Standard one page resume. Best suited for professional employees.</p>
<a id="prev-resume-elon-musk" title="Click to preview" href="#">
<a id="prev-resume-elon-musk" title="Click to preview" href="#">
<img src="img/resumes/elon-musk-one-page-resume.png" class="card-img-top get-big" alt=".......">
</a>
<a id="select-link-3" href="resume_elon_musk.html" class="btn-select fontwhite">Select</a>
Expand Down Expand Up @@ -208,7 +208,7 @@ <h4 class="card-title">Elon Musk Style</h4>
document.getElementById('preview-div').style.opacity = 1;
document.getElementById('prev-cover').style.opacity = 1;
document.getElementById('preview-div').style.zIndex = 1000;
document.getElementById('prev-cover').style.zIndex = 1000;
document.getElementById('prev-cover').style.zIndex = 1000;
document.getElementById('close-preview').style.opacity = 1;
document.getElementById('close-preview').style.zIndex = 1000;
};
Expand Down
72 changes: 50 additions & 22 deletions elonmusk.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,18 @@ function Addinterest3() {
}

var workexperienceformat =
'<div class="row"><div class="row side-design-2"><h4 id="position-name" class="w-100" contenteditable="true" onclick="selectAll()"><b>Role at the Company</b></h4><h5 id="company" contenteditable="true" onclick="selectAll()">Company Name</h5><div class="space-between text-12"><span id="work-time" class="color-1" contenteditable="true" onclick="selectAll()"><i>06/2002-Present</i></span><span id="work-location" class="color-1" contenteditable="true" onclick="selectAll()"><i>Company Location</i></span></div></div><div class="pl-75 text-12"><span class="color-1"><i>Accomplishments</i></span><ul class="accomplishments" contenteditable="true" onclick="selectAll()"><li>List of accomplishments here...</li></ul></div></div>';
'<div class="row">' +
'<div class="row side-design-2">' +
'<h4 id="position-name" class="w-100" contenteditable="true" onclick="selectAll()">' +
'<b>Role at the Company</b>' +
'</h4>' +
'<h5 id="company" contenteditable="true" onclick="selectAll()">' +
'Company Name' +
'</h5>' +
'<div class="space-between text-12">' +
'<span id="work-time" class="color-1" contenteditable="true" onclick="selectAll()">' +
'<i>06/2002-Present</i>' +
'</span><span id="work-location" class="color-1" contenteditable="true" onclick="selectAll()"><i>Company Location</i></span></div></div><div class="pl-75 text-12"><span class="color-1"><i>Accomplishments</i></span><ul class="accomplishments" contenteditable="true" onclick="selectAll()"><li>List of accomplishments here...</li></ul></div></div>';

function addWork() {
var lastrowindex = document.getElementById('work-experience').rows.length - 1;
Expand Down Expand Up @@ -110,35 +121,52 @@ function LoadfromDatabase() {
var ref = firebase.database().ref("users/" + user.uid + "/" + template);

ref.on("value", function (snapshot) {
document.getElementById('name')
.innerHTML = snapshot.child('name').val();
document.getElementById('your-position')
.innerHTML = snapshot.child('position').val();
document.getElementById('about')
.innerHTML = snapshot.child('about').val();
if (snapshot.child('name').val())
document.getElementById('name')
.innerHTML = snapshot.child('name').val();
if (snapshot.child('your-position').val())
document.getElementById('your-position')
.innerHTML = snapshot.child('position').val();

if (snapshot.child('about').val())
document.getElementById('about')
.innerHTML = snapshot.child('about').val();
//
document.getElementById('e-mail')
.innerHTML = snapshot.child('email').val();
document.getElementById('phone')
.innerHTML = snapshot.child('phone').val();
document.getElementById('location')
.innerHTML = snapshot.child('location').val();
document.getElementById('twitter-handle')
.innerHTML = snapshot.child('twitter').val();
if (snapshot.child('email').val())
document.getElementById('e-mail')
.innerHTML = snapshot.child('email').val();

if (snapshot.child('phone').val())
document.getElementById('phone')
.innerHTML = snapshot.child('phone').val();

if (snapshot.child('location').val())
document.getElementById('location')
.innerHTML = snapshot.child('location').val();

if (snapshot.child('twitter-handle').val())
document.getElementById('twitter-handle')
.innerHTML = snapshot.child('twitter').val();
//-------------------------------
var work = snapshot.child('work').val();
var rows = document.getElementById('work-experience').rows;
for (var i = 0; i < rows.length - 1; i++) {
rows[i].cells[0].innerHTML = work[i];
}
//
document.getElementById('skillset')
.innerHTML = snapshot.child('skillset').val();
document.getElementById('achievements')
.innerHTML = snapshot.child('achievements').val();
document.getElementById('interestset')
.innerHTML = snapshot.child('interest').val();
}, function (error){
if (snapshot.child('skillset').val())
document.getElementById('skillset')
.innerHTML = snapshot.child('skillset').val();

if (snapshot.child('achievements').val())
document.getElementById('achievements')
.innerHTML = snapshot.child('achievements').val();

if (snapshot.child('interestset').val())
document.getElementById('interestset')
.innerHTML = snapshot.child('interest').val();

}, function (error) {
window.alert("Error : " + error.code);
});

Expand Down

0 comments on commit 2a80e61

Please sign in to comment.