-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
404b31e
commit e4d8496
Showing
14 changed files
with
286 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,18 @@ | ||
$(function() { | ||
$(".popup").hAlign().vAlign(); | ||
|
||
$(".popup form").submit(function(e) { | ||
e.preventDefault(); | ||
e.stopPropagation(); | ||
|
||
var form = $(this); | ||
|
||
$.post($(this).attr("action"), $(this).serialize(), function(response) { | ||
if(response.success) { | ||
window.location.href = response.next; | ||
} else { | ||
form.find(".button").eq(0).addClass("error").val(response.message); | ||
} | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
@import '../compless/all'; | ||
@import '../core/colors'; | ||
|
||
body { | ||
background-image: url("/img/background.png"); | ||
|
||
.popup { | ||
width: 280px; | ||
|
||
form { | ||
overflow: hidden; | ||
background: #fff; | ||
border: solid 1px darken(@popup, 10%); | ||
.box-shadow(~"2px 0 4px rgba(0,0,0,0.05), -2px 0 4px rgba(0,0,0,0.05)"); | ||
.border-radius(4px); | ||
|
||
.header { | ||
color: lighten(@popup, 40%); | ||
padding: 10px 0; | ||
text-align: center; | ||
text-shadow: 0 -1px 0 darken(@popup, 10%); | ||
border-bottom: solid 1px darken(@popup, 10%); | ||
.linear-gradient(0deg, darken(@popup, 5%), darken(@popup, 3%)); | ||
.box-shadow(inset 0 1px 0 lighten(@popup, 3%)); | ||
} | ||
|
||
.info { | ||
padding: 15px; | ||
background: #FAFAFA; | ||
|
||
.input { | ||
width: 100%; | ||
font-size: 13px; | ||
color: #333; | ||
background: #fff; | ||
padding: 10px; | ||
margin-bottom: 10px; | ||
border: solid 1px darken(@popup_info, 5%); | ||
.box-shadow(inset 0 1px 3px darken(@popup_info, 2%)); | ||
.border-radius(2px); | ||
|
||
&:focus { | ||
border: solid 1px spin(lighten(@popup, 10%), 0%); | ||
} | ||
|
||
&:last-child { | ||
margin-bottom: 0; | ||
} | ||
} | ||
} | ||
|
||
.submit { | ||
padding: 10px 15px; | ||
background: lighten(@popup, 55%); | ||
border-top: solid 1px lighten(@popup, 52%); | ||
|
||
.button { | ||
width: 100%; | ||
text-align: center; | ||
padding: 8px 0; | ||
font-size: 14px; | ||
color: #fff; | ||
cursor: pointer; | ||
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.2); | ||
border: solid 1px @popup; | ||
.border-radius(2px); | ||
.linear-gradient(0deg, lighten(@popup, 5%), lighten(@popup, 15%)); | ||
|
||
&:not(.error):hover { | ||
.linear-gradient(0deg, lighten(@popup, 5%), lighten(@popup, 10%)); | ||
|
||
&:active { | ||
.linear-gradient(0deg, lighten(@popup, 5%), lighten(@popup, 2%)); | ||
} | ||
} | ||
|
||
&.error { | ||
border: solid 1px darken(@popup_error, 10%); | ||
.linear-gradient(0deg, darken(@popup_error, 5%), darken(@popup_error, 2%)); | ||
|
||
&:hover { | ||
.linear-gradient(0deg, darken(@popup_error, 8%), darken(@popup_error, 5%)); | ||
|
||
&:active { | ||
.linear-gradient(0deg, darken(@popup_error, 11%), darken(@popup_error, 8%)); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
.link { | ||
color: lighten(@popup, 30%); | ||
margin-top: 10px; | ||
text-align: center; | ||
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.2); | ||
|
||
a { | ||
color: lighten(@popup, 40%); | ||
|
||
&:hover { | ||
text-decoration: underline; | ||
|
||
&:active { | ||
color: lighten(@popup, 50%); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
exports.login = function(req, res, next) { | ||
res.render("auth/login", { | ||
title: "Login", | ||
js: req.js.renderTags("core", "auth"), | ||
css: req.css.renderTags("core", "auth"), | ||
js: req.js.renderTags("core"), | ||
css: req.css.renderTags("core"), | ||
next: req.param("next") || "" | ||
}); | ||
} | ||
|
||
exports.register = function(req, res, next) { | ||
res.render("auth/register", { | ||
title: "Register", | ||
js: req.js.renderTags("core", "auth"), | ||
css: req.css.renderTags("core", "auth") | ||
js: req.js.renderTags("core"), | ||
css: req.css.renderTags("core") | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,36 @@ | ||
exports.index = function(req, res, next) { | ||
res.render("dashboard/index", { | ||
title: "Dashboard", | ||
js: req.js.renderTags("core", "dashboard"), | ||
css: req.css.renderTags("core", "dashboard"), | ||
current_project: {} | ||
req.models.users.get(req.session.user.id, function(error, user) { | ||
if(!error && user) { | ||
if(!user.projects.empty) { | ||
if(req.param("project")) { | ||
res.render("dashboard/index", { | ||
title: "Dashboard", | ||
js: req.js.renderTags("core", "dashboard"), | ||
css: req.css.renderTags("core", "dashboard"), | ||
user: user, | ||
current_project: $.map(user.projects, function(project) { | ||
if(project.pub_id == req.param("project")) { | ||
return project; | ||
} | ||
})[0] | ||
}); | ||
} else { | ||
res.redirect("/dashboard/%s/".sprintf(user.projects[0].pub_id)); | ||
} | ||
} else { | ||
res.redirect("/dashboard/create/"); | ||
} | ||
} else { | ||
res.error(500, null, error); | ||
} | ||
}); | ||
} | ||
|
||
exports.create = function(req, res, next) { | ||
res.render("dashboard/create", { | ||
title: "Create Project", | ||
js: req.js.renderTags("core"), | ||
css: req.css.renderTags("core"), | ||
forced: req.session.user.projects.empty | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
module.exports = function(app, routes) { | ||
app.get('/dashboard', routes.auth.util.restrict, routes.auth.util.reload, routes.dashboard.index); | ||
app.get('/dashboard', routes.auth.util.restrict, routes.dashboard.index); | ||
app.get('/dashboard/create', routes.auth.util.restrictReload, routes.dashboard.create); | ||
app.get('/dashboard/:project', routes.auth.util.restrict, routes.dashboard.index); | ||
|
||
app.post('/dashboard/create', routes.auth.util.restrict, routes.dashboard.util.create); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
var url = require('fast-url-parser'); | ||
|
||
exports.create = function(req, res, next) { | ||
var host = req.param("host").toLowerCase(); | ||
|
||
if(host.indexOf("http://") == -1 || host.indexOf("https://") == -1) { | ||
host = "http://" + host; | ||
} | ||
|
||
req.models.projects.create({ | ||
name: req.param("name"), | ||
host: url.parse(host).hostname, | ||
owner_id: req.session.user.id | ||
}, function(error, project) { | ||
if(!error && project) { | ||
res.success({ | ||
next: "/dashboard/%s/".sprintf(project.pub_id) | ||
}); | ||
} else { | ||
res.error(200, "Failed to Create Project", error); | ||
} | ||
}); | ||
} |
Oops, something went wrong.