Add JavaScript files and edit profile CSS

1) finished edit profile with delete profile
This commit is contained in:
newtbot
2024-01-23 01:44:11 +08:00
parent d819ac71b2
commit 5b262eb803
14 changed files with 296 additions and 334 deletions

View File

@ -3813,3 +3813,12 @@
.card-text {
color: #000000;
}
/* edit profile */
.profile {
margin: auto;
width: 40%;
border: 1px solid #000000;
padding: 10px;
}

View File

@ -1,100 +0,0 @@
.btn-delete {
background-color: red;
color: white;
}
.ui-w-80 {
width: 80px !important;
height: auto;
}
.btn-default {
border-color: rgba(24,28,33,0.1);
background: rgba(0,0,0,0);
color: #4E5155;
}
label.btn {
margin-bottom: 0;
}
.btn-outline-primary {
border-color: #26B4FF;
background: transparent;
color: #26B4FF;
}
.btn {
cursor: pointer;
}
.text-light {
color: #babbbc !important;
}
.btn-facebook {
border-color: rgba(0,0,0,0);
background: #3B5998;
color: #fff;
}
.btn-instagram {
border-color: rgba(0,0,0,0);
background: #000;
color: #fff;
}
.card {
background-clip: padding-box;
box-shadow: 0 1px 4px rgba(24,28,33,0.012);
}
.row-bordered {
overflow: hidden;
}
.account-settings-fileinput {
position: absolute;
visibility: hidden;
width: 1px;
height: 1px;
opacity: 0;
}
.account-settings-links .list-group-item.active {
font-weight: bold !important;
}
html:not(.dark-style) .account-settings-links .list-group-item.active {
background: transparent !important;
}
.account-settings-multiselect ~ .select2-container {
width: 100% !important;
}
.light-style .account-settings-links .list-group-item {
padding: 0.85rem 1.5rem;
border-color: rgba(24, 28, 33, 0.03) !important;
}
.light-style .account-settings-links .list-group-item.active {
color: #4e5155 !important;
}
.material-style .account-settings-links .list-group-item {
padding: 0.85rem 1.5rem;
border-color: rgba(24, 28, 33, 0.03) !important;
}
.material-style .account-settings-links .list-group-item.active {
color: #4e5155 !important;
}
.dark-style .account-settings-links .list-group-item {
padding: 0.85rem 1.5rem;
border-color: rgba(255, 255, 255, 0.03) !important;
}
.dark-style .account-settings-links .list-group-item.active {
color: #fff !important;
}
.light-style .account-settings-links .list-group-item.active {
color: #4E5155 !important;
}
.light-style .account-settings-links .list-group-item {
padding: 0.85rem 1.5rem;
border-color: rgba(24,28,33,0.03) !important;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

View File

@ -159,7 +159,15 @@ app.auth = (function (app) {
if (getToken()) {
return app.api.get("user/me", function (error, data) {
if (!error) app.auth.user = data;
//$.scope.getUsername.push(data);
//for navbar to show username
$.scope.getUsername.update(data);
//for edit profile to show user details
//if not in edit profile page, it will not show
if (location.pathname === "/profile")
{
$.scope.getUserDetails.update(data);
}
return callback(error, data);
});
} else {
@ -167,16 +175,6 @@ app.auth = (function (app) {
}
}
function showUser(){
app.api.get("user/me", function (error, data) {
if (!error) app.auth.user = data;
$.scope.getUsername.push(data);
});
}
function logOut(callback) {
//call logout route
$.ajax({
@ -217,19 +215,13 @@ app.auth = (function (app) {
}
function homeRedirect() {
window.location.href = location.href.replace(location.replace(`/`)) || "/";
//window.location.href = location.href.replace(location.replace(`/`)) || "/";
location.replace(`/`);
}
/*
function redirectIfLoggedIn() {
if (getToken()){
homeRedirect();
}
logInRedirect();
function profileRedirect() {
location.replace(`/profile`);
}
*/
return {
getToken: getToken,
@ -239,11 +231,33 @@ app.auth = (function (app) {
forceLogin,
logInRedirect,
homeRedirect,
showUser,
profileRedirect,
//showUser,
//redirectIfLoggedIn,
};
})(app);
app.user = (function (app) {
//delete profile
function deleteProfile() {
app.api.delete("user/delete", function (error, data) {
if (error) {
app.util.actionMessage(error.message, $("#deleteProfile"), "danger");
} else {
app.auth.logOut(function () {
location.replace(`/login`);
});
}
});
}
return {
deleteProfile,
};
})(app);
//ajax form submit and pass to api
function formAJAX(btn, del) {
event.preventDefault(); // avoid to execute the actual submit of the form.
@ -251,11 +265,6 @@ function formAJAX(btn, del) {
var formData = $form.find("[name]").serializeObject(); // builds query formDataing
var method = $form.attr("method") || "post";
// if( !$form.validate()) {
// app.util.actionMessage('Please fix the form errors.', $form, 'danger')
// return false;
// }
app.util.actionMessage("Loading...", $form, "info");
//console.log('Data being sent to', $form.attr('action'), formData)