Skip to content

Commit

Permalink
Refactoring done
Browse files Browse the repository at this point in the history
  • Loading branch information
Mahtab Alam committed Dec 23, 2016
0 parents commit b7fbd03
Show file tree
Hide file tree
Showing 44 changed files with 9,408 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 1,2 @@
node_modules/*
public/vendor/*
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 1 @@
web: node server.js
27 changes: 27 additions & 0 deletions bower.json
Original file line number Diff line number Diff line change
@@ -0,0 1,27 @@
{
"name": "linko",
"description": "Dont lose your bookmarks again",
"main": "server.js",
"authors": [
"Mahtab Alam"
],
"license": "MIT",
"moduleType": [],
"homepage": "",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
],
"dependencies": {
"bootstrap": "^3.3.7",
"angular": "^1.6.0",
"angular-strap": "^2.3.10",
"bootstrap-additions": "^0.3.1",
"angular-ladda": "^0.4.3",
"AngularJS-Toaster": "angularjs-toaster#^2.1.0",
"angular-ui-router": "^0.3.2"
}
}
77 changes: 77 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 1,77 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Linkository: Dont lose your bookmarks again</title>
<link rel="stylesheet" href="vendor/bootstrap/dist/css/bootstrap.css" media="screen" title="no title" charset="utf-8">
<link rel="stylesheet" href="css/united.css" media="screen" title="no title" charset="utf-8">
<link rel="stylesheet" href="css/app.css" media="screen" title="no title" charset="utf-8">
<link href="https://netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css" rel="stylesheet" />
<link rel="stylesheet" href="vendor/AngularJS-Toaster/toaster.min.css" charset="utf-8">
<link rel="stylesheet" href="css/modal.css" media="screen" title="no title" charset="utf-8">
<link rel="stylesheet" href="vendor/bootstrap-additions/dist/bootstrap-additions.css" charset="utf-8">
<style>
.modal-backdrop.am-fade {
opacity: .7;
transition: opacity .35s linear;
}
.modal-backdrop.am-fade.ng-enter {
opacity: 0;
}
.modal-backdrop.am-fade.ng-enter.ng-enter-active {
opacity: .5;
}

.modal-backdrop.am-fade.ng-leave {
opacity: .5;
}
.modal-backdrop.am-fade.ng-leave.ng-leave-active {
opacity: 0;
}


.modal.center .modal-dialog {
position:fixed;
top:30%;
left:50%;
min-width:320px;
max-width:630px;
width:50%;
-webkit-transform:translateX(-50%) translateY(-50%);
transform:translateX(-50%) translateY(-50%)
}

</style>
</head>
<body ng-app="linkositoryApp">

<toaster-container toaster-options="{'close-button': true,'time-out':3000}"></toaster-container>

<div ui-view="">

</div>

<script src="vendor/jquery/dist/jquery.min.js"></script>
<script src="vendor/angular/angular.js"></script>
<script src="vendor/angular-ui-router/release/angular-ui-router.js" ></script>
<script src="vendor/angular-animate/angular-animate.min.js" charset="utf-8"></script>
<script src="vendor/AngularJS-Toaster/toaster.min.js"></script>
<script src="vendor/angular-strap/dist/angular-strap.js"></script>
<script src="vendor/angular-strap/dist/angular-strap.tpl.js" charset="utf-8"></script>

<script src="js/constant.js" ></script>
<script src="js/service.js" ></script>
<script src="js/factory/factory.js" ></script>
<script src="js/directives/directive.js" ></script>
<script src="js/controllers/LoginController.js" ></script>
<script src="js/controllers/LogoutController.js" ></script>
<script src="js/controllers/SignupController.js" ></script>
<script src="js/controllers/TagController.js" ></script>
<script src="js/controllers/ListController.js" ></script>
<script src="js/controllers/BookmarkController.js" ></script>
<script src="js/controllers/EditController.js" ></script>
<script src="js/app.js" ></script>


</body>
</html>
77 changes: 77 additions & 0 deletions models/db.js
Original file line number Diff line number Diff line change
@@ -0,0 1,77 @@
var chalk = require('chalk');
var mongoose = require( 'mongoose' );
var bcrypt=require('bcrypt');
var SALT_WORK_FACTOR = 10;

var dbURI = 'mongodb://localhost/test';
//var dbURI =process.env.dbURI
//var dbURI = 'mongodb://your_username:[email protected]:43615/leavethemarks';
mongoose.connect(dbURI);

mongoose.connection.on('connected', function () {
console.log(chalk.yellow('Mongoose connected to ' dbURI));
});

mongoose.connection.on('error',function (err) {
console.log(chalk.red('Mongoose connection error: ' err));
});

mongoose.connection.on('disconnected', function () {
console.log(chalk.red('Mongoose disconnected'));
});

var userSchema = new mongoose.Schema({
username: {type: String, unique:true},
email: {type: String, unique:true},
password: String,
created_at:{type:Date,default:Date.now}
});

var tagSchema = new mongoose.Schema({
tag: {type: String},
created_at:{type:Date,default:Date.now},
created_by:String
});

tagSchema.index({ tag: 1, created_by: 1}, { unique: true });

var bookmarkSchema = new mongoose.Schema({
link: {type: String},
description: {type: String},
tags: String,
created_at:{type:Date,default:Date.now},
created_by:String
});

userSchema.pre('save', function(next) {
var user = this;
console.log("Before Registering the user");
// only hash the password if it has been modified (or is new)
if (!user.isModified('password')) return next();

// generate a salt
bcrypt.genSalt(SALT_WORK_FACTOR, function(err, salt) {
if (err) return next(err);
// hash the password using our new salt
console.log("Salt " salt);
bcrypt.hash(user.password, salt, function(err, hash) {
if (err) return next(err);

// override the cleartext password with the hashed one
user.password = hash;
console.log("Hash : " hash);
next();
});
});
});

userSchema.methods.comparePassword = function(candidatePassword, cb) {
bcrypt.compare(candidatePassword, this.password, function(err, isMatch) {
if (err) return cb(err);
cb(null, isMatch);
});
};

mongoose.model('User', userSchema,'users' );
mongoose.model('Tag', tagSchema,'tags' );
mongoose.model('Bookmark', bookmarkSchema,'bookmarks' );
21 changes: 21 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 1,21 @@
{
"name": "linko",
"version": "1.0.0",
"description": "Dont lose your bookmarks again",
"main": "server.js",
"scripts": {
"postinstall": "./node_modules/bower/bin/bower install"
},
"author": "Mahtab Alam",
"license": "MIT",
"dependencies": {
"bcrypt": "^1.0.1",
"body-parser": "^1.15.2",
"bower": "^1.8.0",
"chalk": "^1.1.3",
"express": "^4.14.0",
"express-jwt": "^5.1.0",
"jsonwebtoken": "^7.2.1",
"mongoose": "^4.7.2"
}
}
88 changes: 88 additions & 0 deletions public/css/app.css
Original file line number Diff line number Diff line change
@@ -0,0 1,88 @@
.main-page-logo{
margin-top: 140px;
display: flex;
align-items: center;
justify-content: center;
overflow-x: hidden;
}

.main-page-logo__text{
font-size: 10px;
}


.tagline{
display: flex;
align-items: center;
justify-content: center;
}


.controls{
margin-top: 50px;
display: flex;
align-items: center;
justify-content: center;
}

a:active{
-webkit-box-shadow: 0 0 5px rgba(0,0,0, .75);
-moz-box-shadow: 0 0 5px rgba(0,0,0, .75);
box-shadow: 0 0 5px rgba(0,0,0, .75);
}

.button {
padding: 8px 30px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 18px;
margin-left:10px;
cursor: pointer;
}

.login {
background-color: white;
color: black;
border: 1px solid ;
border-radius: 5px
}

.signup {
background-color: white;
color: black;
border: 1px solid ;
border-radius: 5px
}

a{
text-decoration: none !important;
}



.badge {
display: inline-block;
min-width: 10px;
padding: 3px 7px;
font-size: 15px;
font-weight: bold;
color: #ffffff;
line-height: 1;
vertical-align: middle;
white-space: nowrap;
text-align: center;
/* background-color: #aea79f; */
border-radius: 6px;
}


.btn-circle {
width: 40px;
height: 40px;
text-align: center;
padding: 6px 0;
font-size: 12px;
line-height: 1.42;
border-radius: 20px;
}
3 changes: 3 additions & 0 deletions public/css/modal.css
Original file line number Diff line number Diff line change
@@ -0,0 1,3 @@
.modal-error-message{
color:#e95420;
}
Loading

0 comments on commit b7fbd03

Please sign in to comment.