Skip to content

Commit

Permalink
beautify
Browse files Browse the repository at this point in the history
  • Loading branch information
stoodkev committed Aug 14, 2018
1 parent 7a0291b commit 357bdf4
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 44 deletions.
67 changes: 33 additions & 34 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,24 +65,23 @@ app.get("/", function(req, res) {
sToken: req.cookies.access_token
});
},
error: function(error) {
}
error: function(error) {}
});
});
});

//Launch the community creation page
app.get("/create", function(req, res) {
isLoggedIn(req).then(function(loggedIn) {
if(loggedIn)
res.render("create.ejs", {
loggedIn: loggedIn,
account: req.session.account,
sToken: req.cookies.access_token
});
else {
res.redirect("error/login");
}
if (loggedIn)
res.render("create.ejs", {
loggedIn: loggedIn,
account: req.session.account,
sToken: req.cookies.access_token
});
else {
res.redirect("error/login");
}
});
});

Expand Down Expand Up @@ -115,32 +114,32 @@ app.post("/createCommunity", function(req, res) {
});

app.get("/view/:name", function(req, res) {
isLoggedIn(req).then(function(loggedIn) {
const community = Parse.Object.extend("Communities");
const query = new Parse.Query(community);
query.equalTo("name",req.params.name);
query.limit(1);
query.find({
success: function(communities) {
if(communities.length==0)
res.redirect("/error/no_community");
else{
console.log(communities[0]);
res.render("view.ejs",{
loggedIn:loggedIn,
community:communities[0]
})
isLoggedIn(req).then(function(loggedIn) {
const community = Parse.Object.extend("Communities");
const query = new Parse.Query(community);
query.equalTo("name", req.params.name);
query.limit(1);
query.find({
success: function(communities) {
if (communities.length == 0)
res.redirect("/error/no_community");
else {
console.log(communities[0]);
res.render("view.ejs", {
loggedIn: loggedIn,
community: communities[0]
})
}
},
error: function() {
res.redirect("/error/wrong");
}
},
error:function(){
res.redirect("/error/wrong");
}
});
});
});
});
});

app.get("/edit/:name", function(req, res) {
//TODO : Edit Page
//TODO : Edit Page
});

app.get("/error/:error_message", function(req, res) {
Expand Down Expand Up @@ -225,4 +224,4 @@ function shuffle(array) {
array[randomIndex] = temporaryValue;
}
return array;
}
}
12 changes: 6 additions & 6 deletions messages.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const messages={
creation_error:"There was a problem and your community could not be created. Please try again!",
login:"Please login to access to this page!",
sth_wrong:"Something went wrong! Please try again later!",
no_community:"We cannot find the community you're looking for! "
const messages = {
creation_error: "There was a problem and your community could not be created. Please try again!",
login: "Please login to access to this page!",
sth_wrong: "Something went wrong! Please try again later!",
no_community: "We cannot find the community you're looking for! "
};

module.exports = messages;
module.exports = messages;
8 changes: 4 additions & 4 deletions public/assets/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -1118,9 +1118,9 @@ hr {
}

#view_img {
width: 341px;
height: 192px;
margin: 0;
width: 341px;
height: 192px;
margin: 0;
background-repeat: no-repeat;
background-size: 341px 192px;
}
}

0 comments on commit 357bdf4

Please sign in to comment.