diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b596029 --- /dev/null +++ b/.gitignore @@ -0,0 +1,37 @@ +<<<<<<< HEAD +node_modules/ +config.js + +lib-cov +*.seed +*.log +*.csv +*.dat +*.out +*.pid +*.gz + +pids +logs +results + +npm-debug.log +======= +node_modules/ +config.js + +lib-cov +*.seed +*.log +*.csv +*.dat +*.out +*.pid +*.gz + +pids +logs +results + +npm-debug.log +>>>>>>> d8d944f683a6c916ab93725f0d0d0296328a79b7 diff --git a/README.txt b/README.txt new file mode 100644 index 0000000..e69de29 diff --git a/app.js b/app.js index 972efa8..77ba670 100644 --- a/app.js +++ b/app.js @@ -4,10 +4,22 @@ var favicon = require('serve-favicon'); var logger = require('morgan'); var cookieParser = require('cookie-parser'); var bodyParser = require('body-parser'); +var session = require('express-session'); +var passport = require('passport'); + var routes = require('./routes/index'); -var users = require('./routes/users'); +var webadmin = require('./routes/webadmin'); +var sesion = require('./routes/session'); +var form = require('./routes/form'); +var stored = require('./routes/stored'); +var admins = require('./routes/admin-users'); + +//var users = require('./routes/users'); + +require('./passport')(passport); +//var config = require('./config/mongodb-config'); var app = express(); // view engine setup @@ -15,16 +27,37 @@ app.set('views', path.join(__dirname, 'views')); app.set('view engine', 'jade'); // uncomment after placing your favicon in /public -//app.use(favicon(__dirname + '/public/favicon.ico')); + +//app.use(favicon(path.join(__dirname, 'public', 'favicon.ico'))); app.use(logger('dev')); app.use(bodyParser.json()); app.use(bodyParser.urlencoded({ extended: false })); app.use(cookieParser()); +app.use(require('stylus').middleware(path.join(__dirname, 'public'))); app.use(express.static(path.join(__dirname, 'public'))); + +// Indicamos que use sesiones, para almacenar el objeto usuario +// y que lo recuerde aunque abandonemos la página +app.use(session({ resave: true, + saveUninitialized: true, + secret: 'lollllo' })); + +//Inicializa PASSPORT +app.use(passport.initialize()); +app.use(passport.session()); + + app.use('/', routes); -//app.use('/daniel', routes); -app.use('/users', users); +app.use('/webadmin', webadmin); +app.use('/session', sesion); +app.use('/form', form); +app.use('/stored', stored); +app.use('/admin-users', admins); + +//app.use('/users', users); + +//app.use(config); // catch 404 and forward to error handler app.use(function(req, res, next) { @@ -58,5 +91,4 @@ app.use(function(err, req, res, next) { }); - module.exports = app; diff --git a/bin/www b/bin/www index 0fd69e5..945ef1e 100755 --- a/bin/www +++ b/bin/www @@ -5,7 +5,7 @@ */ var app = require('../app'); -var debug = require('debug')('authentication:server'); +var debug = require('debug')('webadmin:server'); var http = require('http'); /** diff --git a/config/mongodb-config.js b/config/mongodb-config.js new file mode 100644 index 0000000..a0d7db6 --- /dev/null +++ b/config/mongodb-config.js @@ -0,0 +1,50 @@ + +var mongoose = require('mongoose'); +var user = ''; +var password = ''; +var dbaddress = ''; +//var dblocal = ''; +var database = 'develop'; + +//var url = 'mongodb://'+user+':'+password+'@'+dbaddress+database; +var localurl = 'mongodb://localhost:27017/'+database; + + +var exports = module.exports = {}; +exports.conectar = function (){ + mongoose.connect('mongodb://localhost/develop'); + +} +exports.desconectar = function(){ + mongoose.connection.close(); +} + +/* +var db = ({ + mongoose: mongoose, + //models + page: //require('../models/web')(mongoose), + function(){ + var model = require('../models/web'); + return model(mongoose); + } + +}); +module.exports.db = db; +*/ +/* + if(!global.hasOwnProperty('db')){ + var mongoose = require('mongoose'); + var database = ''; + //mongoose.connect('mongodb://localhost'+database); + + global.db = { + mongoose: mongoose, + + //models + // web: require('../models/web.js')//(mongoose) + }; + } + + module.exports = global.db; + */ \ No newline at end of file diff --git a/lib/db.js b/lib/db.js index bae438c..c13b19e 100644 --- a/lib/db.js +++ b/lib/db.js @@ -6,12 +6,12 @@ module.exports.Schema = Schema; var dbuser = "dani"; var dbpassword = "123"; -var address = "@ds041871.mongolab.com:41871/labase"; - +// var dbaddress = "@ds059908.mongolab.com:59908/labasebkp"; +var dbaddress = "@ds041871.mongolab.com:41871/labase" connect(); function connect(){ - var url = 'mongodb://' + dbuser + ':' + dbpassword + address; + var url = 'mongodb://' + dbuser + ':' + dbpassword + dbaddress; mongoose.connect(url); } diff --git a/models/User.js b/models/User.js index 90b081d..d4e9275 100644 --- a/models/User.js +++ b/models/User.js @@ -1,25 +1,22 @@ var db = require('../lib/db'); -var UserSchema = new db.Schema({ - username : {type: String, unique: true}, - password : String -}) -var MyUser = db.mongoose.model('User', UserSchema); +//PASSPORT TUTO +// Campos que vamos a guardar en la base de datos +var UserSchema = new db.Schema({ + name : String, // Nombre del usuario + provider : String, // Cuenta del usuario (Twitter o Facebook en este ejemplo) + provider_id : {type: String}, // ID que proporciona Twitter o Facebook + photo : String, // Avatar o foto del usuario + createdAt : {type: Date, default: Date.now} // Fecha de creación +}); -module.exports.addUser = addUser; +// var UserSchema.statics.findByName = function (name, cb) { +// return this.find({ name: new RegExp(name, 'i') }, cb); +// } +// Exportamos el modelo 'User' para usarlo en otras +// partes de la aplicación +var User = db.mongoose.model('User', UserSchema); -function addUser(username, password, callback) { - var instance = new MyUser(); - instance.username = username; - instance.password = password; - instance.save(function(err) { - if (err) { - callback(err); - } - else { - callback(null, instance); - } - }) -} +module.exports = UserSchema diff --git a/models/user.js b/models/user.js new file mode 100644 index 0000000..1527e2f --- /dev/null +++ b/models/user.js @@ -0,0 +1,12 @@ +var mongoose = require('mongoose'), + Schema = mongoose.Schema; + +var userSchema = new Schema({ + name : String, // Nombre del usuario + provider : String, // Cuenta del usuario (Twitter o Facebook en este ejemplo) + provider_id : {type: String}, // ID que proporciona Twitter o Facebook + photo : String, // Avatar o foto del usuario + createdAt : {type: Date, default: Date.now} // Fecha de creación +}); + +module.exports = mongoose.model('user', userSchema); \ No newline at end of file diff --git a/models/web.js b/models/web.js new file mode 100644 index 0000000..1114b5f --- /dev/null +++ b/models/web.js @@ -0,0 +1,78 @@ + +var mongoose = require('mongoose'); +var Schema = mongoose.Schema; + + var webSchema = new Schema({ + name: String + /*type: String, + category: String, + urloffline: String, + owner: String, + urlonline: String, + price: Number, + timessold: Number + */ + }/*,{collection: 'pages'}*/); + +module.exports = mongoose.model('web', webSchema); + + + +/* +module.exports = function(mongoose){ + var Schema = mongoose.Schema; + + var webSchema = new Schema({ + name: String, + type: String, + category: String, + urloffline: String, + owner: String, + urlonline: String, + price: Number, + timessold: Number + },{collection: 'pages'}); + + return mongoose.model('web', webSchema); +} +*/ +//var exports = module.exports = {}; + +/* +exports.addweb = function(webname, type, category, urloff, owner, urlon, price){ + var web = new web({ + name: webname, + type: type, + category: category, + urloffline: urloff, + owner: owner, + urlonline: urlon, + price: price + }); + web.save(function (err) { + if (err) return console.error(err); + console.log('insercion exitosa'); + }); + +} +*/ +//webSchema.methods.add = function(webname, type, category, urloff, owner, urlon, price){ + +/* +function addWeb(webname, type, category, urloff, owner, urlon, price){ + var web = new Web({ + name: webname, + type: type, + category: category, + urloffline: urloff, + owner: owner, + urlonline: urlon, + price: price + }) + web.save(function (err, fluffy) { + if (err) return console.error(err); + console.log('insercion exitosa'); + }); + +} +*/ \ No newline at end of file diff --git a/package.json b/package.json index d4bb947..bea3ab1 100644 --- a/package.json +++ b/package.json @@ -1,10 +1,23 @@ { - "name": "authentication", + "name": "webadmin", "version": "0.0.0", "private": true, "scripts": { - "start": "nodemon ./bin/www" + "start": "nodemon ./bin/www", + "jade": "jade --watch --pretty lib/index.jade lib/form.jade --out ./public", + "stylus": "stylus --use nib --watch ./views/models_jade/styles --out ./public/stylesheets", + "babel": "babel --watch lib --out-dir public" }, + "repository": { + "type": "git", + "url": "git+https://github.com/NerdStudio/webadmin.git" + }, + "author": "Nerd Studio", + "license": "ISC", + "bugs": { + "url": "https://github.com/NerdStudio/webadmin/issues" + }, + "homepage": "https://github.com/NerdStudio/webadmin#readme", "dependencies": { "body-parser": "~1.12.0", "cookie-parser": "~1.3.4", @@ -13,6 +26,16 @@ "jade": "~1.9.2", "morgan": "~1.5.1", "serve-favicon": "~2.2.0", - "mongoose": "~4.1.8" + "mongoose": "~4.1.8", + "normalize-styl": "~3.0.3", + "nib": "~1.1.0", + "passport": "~0.3.0", + "passport-facebook": "~2.0.0", + "passport-twitter": "~1.0.3", + "express-session": "~1.11.3", + "passport-github2": "~0.1.9" + }, + "devDependencies": { + "stylus": "^0.42.3" } } diff --git a/passport.js b/passport.js new file mode 100644 index 0000000..b8f824d --- /dev/null +++ b/passport.js @@ -0,0 +1,134 @@ +var mongoose = require('mongoose'); +//var db = require('./lib/db'); + +var db = require('./config/mongodb-config'); + +//var User = db.mongoose.model('User'); +var User = require('./models/user'); + +// Estrategia de autenticación con Twitter +var TwitterStrategy = require('passport-twitter').Strategy; +// Estrategia de autenticación con Facebook +var FacebookStrategy = require('passport-facebook').Strategy; + +var GitHubStrategy = require('passport-github2').Strategy; +// Fichero de configuración donde se encuentran las API keys +// Este archivo no debe subirse a GitHub ya que contiene datos +// que pueden comprometer la seguridad de la aplicación. +var config = require('./config'); + +// Exportamos como módulo las funciones de passport, de manera que +// podamos utilizarlas en otras partes de la aplicación. +// De esta manera, mantenemos el código separado en varios archivos +// logrando que sea más manejable. +module.exports = function(passport) { + db.conectar(); + // Serializa al usuario para almacenarlo en la sesión + passport.serializeUser(function(user, done) { + done(null, user); + }); + + // Deserializa el objeto usuario almacenado en la sesión para + // poder utilizarlo + passport.deserializeUser(function(obj, done) { + done(null, obj); + }); + + // Configuración del autenticado con Twitter + passport.use(new TwitterStrategy({ + consumerKey : config.twitter.key, + consumerSecret : config.twitter.secret, + callbackURL : '/auth/twitter/callback' + }, function(accessToken, refreshToken, profile, done) { + // Busca en la base de datos si el usuario ya se autenticó en otro + // momento y ya está almacenado en ella + //db.conectar(); + User.findOne({provider_id: profile.id}, function(err, user) { + if(err) throw(err); + // Si existe en la Base de Datos, lo devuelve + if(!err && user!= null) return done(null, user); + + // Si no existe crea un nuevo objecto usuario + var user = new User({ + provider_id : profile.id, + provider : profile.provider, + name : profile.displayName, + photo : profile.photos[0].value + }); + //...y lo almacena en la base de datos + user.save(function(err) { + if(err) throw err; + done(null, user); + }); + //db.desconectar(); + + }/*, function(){db.desconectar();}*/); + })); + + // Configuración del autenticado con Facebook + passport.use(new FacebookStrategy({ + clientID : config.facebook.key, + clientSecret : config.facebook.secret, + callbackURL : '/auth/facebook/callback', + profileFields : ['id', 'displayName', /*'provider',*/ 'photos'] + }, function(accessToken, refreshToken, profile, done) { + // El campo 'profileFields' nos permite que los campos que almacenamos + // se llamen igual tanto para si el usuario se autentica por Twitter o + // por Facebook, ya que cada proveedor entrega los datos en el JSON con + // un nombre diferente. + // Passport esto lo sabe y nos lo pone más sencillo con ese campo + //db.conectar(); + User.findOne({provider_id: profile.id}, function(err, user) { + if(err) throw(err); + if(!err && user!= null) return done(null, user); + + // Al igual que antes, si el usuario ya existe lo devuelve + // y si no, lo crea y salva en la base de datos + var user = new User({ + provider_id : profile.id, + provider : profile.provider, + name : profile.displayName, + photo : profile.photos[0].value + }); + user.save(function(err) { + if(err) throw err; + done(null, user); + }); + //db.desconectar(); + }/*,function(){db.desconectar();}*/); + })); + + passport.use(new GitHubStrategy({ + clientID: config.github.key, + clientSecret: config.github.secret, + callbackURL: "/auth/github/callback" + }, + function(accessToken, refreshToken, profile, done) { + //console.log(profile._json) + //db.conectar(); + User.findOne({provider_id: profile.id}, function(err, user) { + if(err) throw(err); + // Si existe en la Base de Datos, lo devuelve + if(!err && user!= null) return done(null, user); + + //Si no existe crea un nuevo objecto usuario + console.log(user) + var user = new User({ + provider_id : profile.id, + provider : profile.provider, + name : profile.username, + photo : profile._json.avatar_url + }); + //...y lo almacena en la base de datos + user.save(function(err) { + if(err) throw err; + done(null, user); + }); + //console.log(user) + + + }/*,function(){db.desconectar();}*/); + } +)); +}; + diff --git a/public/fonts/icomoon.svg b/public/fonts/icomoon.svg index 41c9218..d82d8de 100644 --- a/public/fonts/icomoon.svg +++ b/public/fonts/icomoon.svg @@ -1,3 +1,4 @@ +<<<<<<< HEAD @@ -274,4 +275,282 @@ +======= + + + +Generated by IcoMoon + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +>>>>>>> d8d944f683a6c916ab93725f0d0d0296328a79b7 \ No newline at end of file diff --git a/public/stylesheets/style.css b/public/stylesheets/style.css index 30e047d..9ebf778 100644 --- a/public/stylesheets/style.css +++ b/public/stylesheets/style.css @@ -1,8 +1,599 @@ +/* normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */ +html { + font-family: sans-serif; + -ms-text-size-adjust: 100%; + -webkit-text-size-adjust: 100%; +} body { - padding: 50px; - font: 14px "Lucida Grande", Helvetica, Arial, sans-serif; + margin: 0; +} +article, +aside, +details, +figcaption, +figure, +footer, +header, +hgroup, +main, +menu, +nav, +section, +summary { + display: block; +} +audio, +canvas, +progress, +video { + display: inline-block; + vertical-align: baseline; +} +audio:not([controls]) { + display: none; + height: 0; +} +[hidden], +template { + display: none; } - a { - color: #00B7FF; -} \ No newline at end of file + background-color: transparent; +} +a:active, +a:hover { + outline: 0; +} +abbr[title] { + border-bottom: 1px dotted; +} +b, +strong { + font-weight: bold; +} +dfn { + font-style: italic; +} +h1 { + font-size: 2em; + margin: 0.67em 0; +} +mark { + background: #ff0; + color: #000; +} +small { + font-size: 80%; +} +sub, +sup { + font-size: 75%; + line-height: 0; + position: relative; + vertical-align: baseline; +} +sup { + top: -0.5em; +} +sub { + bottom: -0.25em; +} +img { + border: 0; +} +svg:not(:root) { + overflow: hidden; +} +figure { + margin: 1em 40px; +} +hr { + box-sizing: content-box; + height: 0; +} +pre { + overflow: auto; +} +code, +kbd, +pre, +samp { + font-family: monospace, monospace; + font-size: 1em; +} +button, +input, +optgroup, +select, +textarea { + color: inherit; + font: inherit; + margin: 0; +} +button { + overflow: visible; +} +button, +select { + text-transform: none; +} +button, +html input[type="button"], +input[type="reset"], +input[type="submit"] { + -webkit-appearance: button; + cursor: pointer; +} +button[disabled], +html input[disabled] { + cursor: default; +} +button::-moz-focus-inner, +input::-moz-focus-inner { + border: 0; + padding: 0; +} +input { + line-height: normal; +} +input[type="checkbox"], +input[type="radio"] { + box-sizing: border-box; + padding: 0; +} +input[type="number"]::-webkit-inner-spin-button, +input[type="number"]::-webkit-outer-spin-button { + height: auto; +} +input[type="search"] { + -webkit-appearance: textfield; + box-sizing: content-box; +} +input[type="search"]::-webkit-search-cancel-button, +input[type="search"]::-webkit-search-decoration { + -webkit-appearance: none; +} +fieldset { + border: 1px solid #c0c0c0; + margin: 0 2px; + padding: 0.35em 0.625em 0.75em; +} +legend { + border: 0; + padding: 0; +} +textarea { + overflow: auto; +} +optgroup { + font-weight: bold; +} +table { + border-collapse: collapse; + border-spacing: 0; +} +td, +th { + padding: 0; +} +.bg-primary { + background-color: rgba(26,35,126,0.7); +} +.bg-secundary { + background-color: rgba(227,242,253,0.4); +} +.box { + background-color: #fff; + padding: 5px 10px; + border-radius: 2px; + box-shadow: 0px 2px 1px rgba(0,0,0,0.1); +} +.minwidth1 { + min-width: 300px; +} +.margin10 { + margin: 10px auto 10px 2px; +} +.margin20 { + margin: 10px auto 10px 20px; +} +.marginbtm { + margin-bottom: 10px; +} +.titulo1 { + font-size: 1.6rem; + padding: 5px; + color: rgba(33,33,33,0.95); +} +.titulo2 { + font-size: 1.1rem; + color: rgba(33,33,33,0.7); +} +.titulo3 { + font-size: 1.4rem; + color: rgba(33,33,33,0.9); + font-weight: 600; +} +.titulo4 { + font-size: 0.9rem; + font-weight: 500; + color: rgba(33,33,33,0.9); +} +.divider { + height: 1px; + overflow: hidden; + background-color: #e0e0e0; +} +.linknone { + text-decoration: none; + color: rgba(229,229,229,0.9); +} +.linksocial { + color: #273e48; +} +.loginsocial { + text-align: center; +} +.styleicon { + font-size: 4rem; + text-align: center; + margin: 10px auto; + color: #273e48; +} +.styleicon:hover { + color: rgba(39,62,72,0.7); +} +.justifytext { + text-align: justify; +} +body { + font-size: 18px; +} +.Main { + display: flex; + align-items: stretch; +} +.Formpanel { + items-align: center; + margin-top: 2rem; + width: 50vw; +} +input { + background-color: transparent; + border-width: 0px; + border-bottom: 1px solid rgba(39,62,72,0.6); + border-radius: 0; + outline: none; + width: 100%; + font-size: 1rem; + margin: 0 0 15px 0; + padding: 0; + box-shadow: none; + height: 1.3rem; + font-family: 'Merriweather' serif; +} +input:focus { + outline: none; + border-width: 0px; + border-bottom: 2px solid rgba(38,166,152,0.9); +} +.btn { + text-decoration: none; + color: #fff; + background-color: #26a69a; + box-shadow: 0px 2px 1px rgba(0,0,0,0.18); + text-align: center; + letter-spacing: 0.5px; + border: none; + border-radius: 2px; + display: inline-block; + height: 36px; + line-height: 36px; + outline: 0; + padding: 0 2rem; + text-transform: capitalize; + width: 200px; +} +.btn:hover { + background-color: #2bbbad; + box-shadow: 0 5px 11px 0 rgba(0,0,0,0.18), 0 4px 15px 0 rgba(0,0,0,0.15); +} +.Form-add { + display: flex; + flex-direction: column; + justify-content: space-around; +} +.inputstyle { + display: flex; + flex-direction: column; + margin: 10px 0px 20px 0px; +} +.btnstyle { + display: flex; + justify-content: flex-end; + items-align: center; + margin: 10px 0px 0px 0px; +} +.btnstyle1 { + display: flex; + justify-content: center; + items-align: center; + margin: 10px 0px 10px 0px; +} +.selectbox { + font-size: 1em; + font-family: 'Merriweather' serif; +} +select option { + font-family: 'Merriweather' serif; +} +select option["selected"] { + font-family: 'Merriweather' serif; +} +.lbl { + font-family: 'Noto Serif'; + margin-bottom: 5px; + font-weight: 600; +} +.Header { + background-color: #273e48; + box-shadow: 0px -5px 7px 5px #777; +} +.Header-sidenav { + padding: 5px 20px; + min-height: 100vh; + width: 15vw; +} +.Header-logo { + color: #fff; + font-size: 6rem; + text-align: center; +} +.Nav { + color: #fff; + margin: 30px auto; + color: rgba(229,229,229,0.7); +} +.Nav-item { + display: flex; + align-items: center; + margin: 10px auto; + color: rgba(229,229,229,0.7); + cursor: pointer; +} +.Nav-item:hover { + color: #f0f0f0; +} +.Nav-item-text { + font-size: 0.8rem; + margin-left: 15px; +} +.Nav-item[data-lastitem] { + margin-top: 15px; +} +.iconstyle { + font-size: 1.4rem; + display: flex; + align-items: center; +} +.iconstyle[data-cross] { + font-size: 1.4rem; +} +.notifi { + background-color: rgba(88,114,125,0.9); + margin-left: 30px; + font-size: 0.8rem; + width: 16px; + text-align: center; + padding: 2px; + border-radius: 2px; +} +.MyCard { + margin-top: 10px; + margin-bottom: 30px; + display: flex; + flex-direction: column; + align-items: center; + text-align: center; +} +.MyCard-photo { + width: 100px; + border-radius: 50%; + padding: 2px; +} +.MyCard-photo-img { + background-color: #e0e0e0; + width: 80px; + border-radius: 50%; +} +.MyCard-name { + display: flex; + flex-direction: column; + text-align: center; + justify-content: center; +} +.MyCard--textStyle { + font-family: 'Roboto Condensed', sans-serif; + color: rgba(229,229,229,0.7); +} +.MyCard-title { + color: #fafafa; + font-family: 'Noto Serif'; + font-style: italic; + margin-top: -7px; + display: flex; + align-items: center; + justify-content: center; +} +.Section { + width: 85vw; + background-color: rgba(229,229,229,0.7); +} +.Section-secciones { + display: flex; + flex-wrap: wrap; + margin: 30px auto; + flex-direction: row; + justify-content: space-around; + align-items: flex-stretch; + align-content: space-around; +} +.Section-item { + width: 250px; + margin: 10px; +} +.Font-playfair { + font-family: 'Playfair Display' serif; +} +.Font-abril { + font-family: 'Abril Fatface' cursive; +} +.Font-bevan { + font-family: 'Bevan' cursive; +} +.Font-alegreya { + font-family: 'Alegreya Sans' sans-serif; +} +.Font-francois { + font-family: 'Francois One' sans-serif; +} +.Font-librebasker { + font-family: 'Libre Baskerville' serif; +} +.Font-lato { + font-family: 'Lato' sans-serif; +} +.Font-merriw { + font-family: 'Merriweather' serif; +} +.Font-merriws { + font-family: 'Merriweather Sans' sans-serif; +} +.Font-openssans { + font-family: 'Open Sans' sans-serif; +} +.Font-roboto { + font-family: 'Roboto Condensed' sans-serif; +} +.FontStylebold { + font-style: bold; + font-weight: 700; +} +.Fontcolor1 { + color: rgba(39,62,72,0.86); +} +@media screen and (max-width: 320px) { + .titulo1 { + font-size: 1.3rem; + } + .titulo2 { + font-size: 0.9rem; + } + .titulo3 { + font-size: 1.1rem; + } + .titulo4 { + font-size: 0.8rem; + } + main { + display: flex; + flex-direction: row; + } + .Section { + width: 100vw; + } + .Section-secciones { + flex-direction: column; + } + .Header { + box-shadow: -1px 4px 2px 0px #777; + max-height: 100%; + } + .Header-sidenav { + width: 100%; + padding: 0px; + } + .MyCard { + margin-top: 0px; + } + .MyCard-photo { + text-align: center; + } + .MyCard-photo-img { + text-align: center; + width: 70px; + } + .Formpanel { + items-align: center; + margin-top: 2rem; + width: 90vw; + } +} +@media screen and (max-width: 720px) { + main { + display: flex; + flex-direction: column; + } + .Section { + width: 100vw; + } + .Section-secciones { + flex-direction: row; + flex-wrap: wrap; + } + .Header { + box-shadow: -1px 4px 2px 0px #777; + max-height: 100%; + } + .Header-sidenav { + padding: 0px; + width: 100%; + } + .Header-logo { + font-size: 4.5rem; + } + .MyCard { + margin-top: 0px; + } + .MyCard-photo { + text-align: center; + } + .MyCard-photo-img { + text-align: center; + width: 70px; + } + .Formpanel { + items-align: center; + margin-top: 2rem; + width: 90vw; + } +} +.Table { + width: 800px; +} +.Table-user-photo { + width: 40px; + border-radius: 50%; +} +.th { + text-align: justify; +} +.td { + margin-top: 10px; +} +.facebook-label { + background-color: #00f; + padding: 4px; + border-radius: 0px 5px; + color: #fff; + text-align: center; + width: 85px; +} +.github-label { + background-color: #000; + padding: 4px; + border-radius: 0px 5px; + color: #fff; + text-align: center; + width: 85px; +} diff --git a/public/stylesheets/style0.css b/public/stylesheets/style0.css deleted file mode 100644 index 0dadb3f..0000000 --- a/public/stylesheets/style0.css +++ /dev/null @@ -1,527 +0,0 @@ -/* normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */ -html { - font-family: sans-serif; - -ms-text-size-adjust: 100%; - -webkit-text-size-adjust: 100%; -} -body { - margin: 0; -} -article, -aside, -details, -figcaption, -figure, -footer, -header, -hgroup, -main, -menu, -nav, -section, -summary { - display: block; -} -audio, -canvas, -progress, -video { - display: inline-block; - vertical-align: baseline; -} -audio:not([controls]) { - display: none; - height: 0; -} -[hidden], -template { - display: none; -} -a { - background-color: transparent; -} -a:active, -a:hover { - outline: 0; -} -abbr[title] { - border-bottom: 1px dotted; -} -b, -strong { - font-weight: bold; -} -dfn { - font-style: italic; -} -h1 { - font-size: 2em; - margin: 0.67em 0; -} -mark { - background: #ff0; - color: #000; -} -small { - font-size: 80%; -} -sub, -sup { - font-size: 75%; - line-height: 0; - position: relative; - vertical-align: baseline; -} -sup { - top: -0.5em; -} -sub { - bottom: -0.25em; -} -img { - border: 0; -} -svg:not(:root) { - overflow: hidden; -} -figure { - margin: 1em 40px; -} -hr { - box-sizing: content-box; - height: 0; -} -pre { - overflow: auto; -} -code, -kbd, -pre, -samp { - font-family: monospace, monospace; - font-size: 1em; -} -button, -input, -optgroup, -select, -textarea { - color: inherit; - font: inherit; - margin: 0; -} -button { - overflow: visible; -} -button, -select { - text-transform: none; -} -button, -html input[type="button"], -input[type="reset"], -input[type="submit"] { - -webkit-appearance: button; - cursor: pointer; -} -button[disabled], -html input[disabled] { - cursor: default; -} -button::-moz-focus-inner, -input::-moz-focus-inner { - border: 0; - padding: 0; -} -input { - line-height: normal; -} -input[type="checkbox"], -input[type="radio"] { - box-sizing: border-box; - padding: 0; -} -input[type="number"]::-webkit-inner-spin-button, -input[type="number"]::-webkit-outer-spin-button { - height: auto; -} -input[type="search"] { - -webkit-appearance: textfield; - box-sizing: content-box; -} -input[type="search"]::-webkit-search-cancel-button, -input[type="search"]::-webkit-search-decoration { - -webkit-appearance: none; -} -fieldset { - border: 1px solid #c0c0c0; - margin: 0 2px; - padding: 0.35em 0.625em 0.75em; -} -legend { - border: 0; - padding: 0; -} -textarea { - overflow: auto; -} -optgroup { - font-weight: bold; -} -table { - border-collapse: collapse; - border-spacing: 0; -} -td, -th { - padding: 0; -} -.bg-primary { - background-color: rgba(26,35,126,0.7); -} -.bg-secundary { - background-color: rgba(227,242,253,0.4); -} -.box { - background-color: #fff; - padding: 5px 10px; - border-radius: 2px; - box-shadow: 0px 2px 1px rgba(0,0,0,0.1); -} -.minwidth1 { - min-width: 300px; -} -.margin10 { - margin: 10px auto 10px 2px; -} -.margin20 { - margin: 10px auto 10px 20px; -} -.marginbtm { - margin-bottom: 10px; -} -.titulo1 { - font-size: 1.6rem; - padding: 5px; - color: rgba(33,33,33,0.95); -} -.titulo2 { - font-size: 1.1rem; - color: rgba(33,33,33,0.7); -} -.titulo3 { - font-size: 1.4rem; - color: rgba(33,33,33,0.9); - font-weight: 600; -} -.titulo4 { - font-size: 0.9rem; - font-weight: 500; - color: rgba(33,33,33,0.9); -} -.divider { - height: 1px; - overflow: hidden; - background-color: #e0e0e0; -} -.styleicon { - font-size: 4rem; - text-align: center; - margin: 10px auto; - color: #273e48; -} -.styleicon:hover { - color: rgba(39,62,72,0.7); -} -.justifytext { - text-align: justify; -} -body { - font-size: 18px; -} -.Main { - display: flex; - align-items: stretch; -} -.Formpanel { - items-align: center; - margin-top: 2rem; - width: 50vw; -} -input { - background-color: transparent; - border-width: 0px; - border-bottom: 1px solid rgba(39,62,72,0.6); - border-radius: 0; - outline: none; - width: 100%; - font-size: 1rem; - margin: 0 0 15px 0; - padding: 0; - box-shadow: none; - height: 1.3rem; - font-family: 'Merriweather' serif; -} -input:focus { - outline: none; - border-width: 0px; - border-bottom: 2px solid rgba(38,166,152,0.9); -} -.btn { - text-decoration: none; - color: #fff; - background-color: #26a69a; - box-shadow: 0px 2px 1px rgba(0,0,0,0.18); - text-align: center; - letter-spacing: 0.5px; - border: none; - border-radius: 2px; - display: inline-block; - height: 36px; - line-height: 36px; - outline: 0; - padding: 0 2rem; - text-transform: capitalize; - width: 200px; -} -.btn:hover { - background-color: #2bbbad; - box-shadow: 0 5px 11px 0 rgba(0,0,0,0.18), 0 4px 15px 0 rgba(0,0,0,0.15); -} -.Form-add { - display: flex; - flex-direction: column; - justify-content: space-around; -} -.inputstyle { - display: flex; - flex-direction: column; - margin: 10px 0px 20px 0px; -} -.btnstyle { - display: flex; - justify-content: flex-end; - items-align: center; - margin: 10px 0px 0px 0px; -} -.btnstyle1 { - display: flex; - justify-content: center; - items-align: center; - margin: 10px 0px 10px 0px; -} -.selectbox { - font-size: 1em; - font-family: 'Merriweather' serif; -} -select option { - font-family: 'Merriweather' serif; -} -select option["selected"] { - font-family: 'Merriweather' serif; -} -.lbl { - font-family: 'Noto Serif'; - margin-bottom: 5px; - font-weight: 600; -} -.Header { - background-color: #273e48; - box-shadow: 0px -5px 7px 5px #777; -} -.Header-sidenav { - padding: 5px 20px; - width: 15vw; -} -.Header-logo { - color: #fff; - font-size: 6rem; - text-align: center; -} -.Nav { - color: #fff; - margin: 30px auto; - color: rgba(229,229,229,0.7); -} -.Nav-item { - display: flex; - align-items: center; - margin: 10px auto; - color: rgba(229,229,229,0.7); - cursor: pointer; -} -.Nav-item:hover { - color: #f0f0f0; -} -.Nav-item-text { - font-size: 0.8rem; - margin-left: 15px; -} -.Nav-item[data-lastitem] { - margin-top: 15px; -} -.iconstyle { - font-size: 1.4rem; - display: flex; - align-items: center; -} -.iconstyle[data-cross] { - font-size: 1.4rem; -} -.notifi { - background-color: rgba(88,114,125,0.9); - margin-left: 30px; - font-size: 0.8rem; - width: 16px; - text-align: center; - padding: 2px; - border-radius: 2px; -} -.MyCard { - margin-top: 10px; - margin-bottom: 30px; - display: flex; - flex-direction: column; - align-items: center; -} -.MyCard-photo { - width: 100px; - border-radius: 50%; - padding: 2px; -} -.MyCard-photo-img { - background-color: #e0e0e0; - width: 100px; - border-radius: 50%; -} -.MyCard-name { - display: flex; - flex-direction: column; - text-align: center; - justify-content: center; -} -.MyCard--textStyle { - font-family: 'Roboto Condensed', sans-serif; - color: rgba(229,229,229,0.7); -} -.MyCard-title { - color: #fafafa; - font-family: 'Noto Serif'; - font-style: italic; - margin-top: -7px; - display: flex; - align-items: center; - justify-content: center; -} -.Section { - width: 85vw; - background-color: rgba(229,229,229,0.7); -} -.Section-secciones { - display: flex; - flex-wrap: wrap; - margin: 30px auto; - flex-direction: row; - justify-content: space-around; - align-items: flex-start; - align-content: space-around; -} -.Section-item { - width: 250px; - margin: 10px; -} -.Font-playfair { - font-family: 'Playfair Display' serif; -} -.Font-abril { - font-family: 'Abril Fatface' cursive; -} -.Font-bevan { - font-family: 'Bevan' cursive; -} -.Font-alegreya { - font-family: 'Alegreya Sans' sans-serif; -} -.Font-francois { - font-family: 'Francois One' sans-serif; -} -.Font-librebasker { - font-family: 'Libre Baskerville' serif; -} -.Font-lato { - font-family: 'Lato' sans-serif; -} -.Font-merriw { - font-family: 'Merriweather' serif; -} -.Font-merriws { - font-family: 'Merriweather Sans' sans-serif; -} -.Font-openssans { - font-family: 'Open Sans' sans-serif; -} -.Font-roboto { - font-family: 'Roboto Condensed' sans-serif; -} -.FontStylebold { - font-style: bold; - font-weight: 700; -} -.Fontcolor1 { - color: rgba(39,62,72,0.86); -} -@media screen and (max-width: 320px) { - main { - display: flex; - flex-direction: row; - } - .Section { - width: 100vw; - } - .Section-secciones { - flex-direction: column; - } - .Header { - box-shadow: -1px 4px 2px 0px #777; - } - .Header-sidenav { - width: 100%; - padding: 0px; - } - .MyCard { - margin-top: 0px; - } - .Formpanel { - items-align: center; - margin-top: 2rem; - width: 90vw; - } -} -@media screen and (max-width: 720px) { - main { - display: flex; - flex-direction: column; - } - .Section { - width: 100vw; - } - .Section-secciones { - flex-direction: row; - flex-wrap: wrap; - } - .Header { - box-shadow: -1px 4px 2px 0px #777; - } - .Header-sidenav { - padding: 0px; - width: 100%; - } - .MyCard { - margin-top: 0px; - } - .Formpanel { - items-align: center; - margin-top: 2rem; - width: 90vw; - } -} diff --git a/routes/admin-users.js b/routes/admin-users.js new file mode 100644 index 0000000..5955e05 --- /dev/null +++ b/routes/admin-users.js @@ -0,0 +1,31 @@ +var express = require('express'); +var router = express.Router(); + +var db = require('../config/mongodb-config'), + User = require('../models/user'); + +router.get('/', function(req, res, next) { + //db.conectar(); + if(req.user){ + console.log(req.user); + User.find({}, function(err, docs){ + if(err) throw(err) + else{ + res.render('admin-users', { + title: 'Stored', + user: req.user, + users: docs + }); + } + }) + } + else{ + res.redirect('/webadmin') + } + + +}); + +module.exports = router; + + \ No newline at end of file diff --git a/routes/form.js b/routes/form.js new file mode 100644 index 0000000..0a7e75b --- /dev/null +++ b/routes/form.js @@ -0,0 +1,59 @@ +var express = require('express'); +var router = express.Router(); + + + +var dbconfig = require('../config/mongodb-config'); +var web = require('../models/web'); +//var mongoose = require('mongoose'); + + +router.get('/', function(req, res, next) { + if(req.user){ + res.render('form', { + title: 'Form get', + user: req.user + }); + } + else{ + res.redirect("/webadmin") + } +}); + + +router.post('/', function(req, res) { + var webname = req.body.namepage; + console.log(webname); + // var propietario = req.body.propietario; + // User.addUser(username, propietario, function(err, user){ + // console.log(username + " " + password); + +// -- abrir conexion a la db +// guardar informacion +// -- cerrar conexion + //dbconfig.conectar; + dbconfig.conectar(); + + var nweb = new web({ + name: webname + /* type: 'type', + category: 'category', + urloffline: 'urloff', + owner: 'owner', + urlonline: 'urlon', + price: 'price' +*/ + }); + console.log(nweb); + nweb.save(function (err) { + if (err) { + console.log('error: '+err) + } + console.log('insercion exitosa'); + res.redirect('/form'); + }); + dbconfig.desconectar(); + +}); + +module.exports = router; diff --git a/routes/index.js b/routes/index.js index e800c04..89bdd98 100644 --- a/routes/index.js +++ b/routes/index.js @@ -1,25 +1,52 @@ var express = require('express'); var router = express.Router(); -var User = require('../models/User.js') + +var passport = require('passport'); /* GET home page. */ router.get('/', function(req, res, next) { - res.render('index', { title: 'Express' }); -}); -router.get('/daniel', function(req, res, next) { - res.render('daniel', { title: 'Daniel' }); -}); -router.get('/form', function(req, res, next) { - res.render('form', { title: 'Form' }); + res.redirect('webadmin'); }); -router.post('/signup', function(req, res) { - var webname = req.body.webname; - var propietario = req.body.propietario; - User.addUser(username, propietario, function(err, user){ - console.log(username + " " + password); - res.render('form', { title: 'Form' }); - }); +router.get('/logout', function(req, res, next) { + //req.user = {} + req.logout(); + res.redirect('/webadmin'); }); + +// Ruta para autenticarse con Twitter (enlace de login) +router.get('/auth/twitter', passport.authenticate('twitter')); +// Ruta para autenticarse con Facebook (enlace de login) +router.get('/auth/facebook', passport.authenticate('facebook')); +// Ruta de callback, a la que redirigirá tras autenticarse con Twitter. +router.get('/auth/github', passport.authenticate('github', { scope: [ 'user:email' ] })); + +// En caso de fallo redirige a otra vista '/login' +router.get('/auth/twitter/callback', passport.authenticate('twitter', + + { successRedirect: '/session', failureRedirect: '/webadmin' } + +)); +// Ruta de callback, a la que redirigirá tras autenticarse con Facebook. +// En caso de fallo redirige a otra vista '/login' +router.get('/auth/facebook/callback', passport.authenticate('facebook', + + { successRedirect: '/session', failureRedirect: '/webadmin' } +)); +router.get('/auth/github/callback', passport.authenticate('github', + { successRedirect: '/session', failureRedirect: '/webadmin' } +));/*, +>>>>>>> d8d944f683a6c916ab93725f0d0d0296328a79b7 + function(req, res) { + // Successful authentication, redirect home. + res.redirect('/index'); + } +<<<<<<< HEAD + ); + +======= +); +*/ + module.exports = router; diff --git a/routes/session.js b/routes/session.js new file mode 100644 index 0000000..8639785 --- /dev/null +++ b/routes/session.js @@ -0,0 +1,24 @@ +var express = require('express'); +var router = express.Router(); + +//var mongoose = require('mongoose'); +//var db = require('./lib/db'); + +var db = require('../config/mongodb-config'); + + +router.get('/', function(req, res, next){ + if(req.user){ + + res.render('session',{ + title: 'Index', + user: req.user + }); + }else{ + res.redirect('/webadmin') + } +}); + + + +module.exports = router; \ No newline at end of file diff --git a/routes/stored.js b/routes/stored.js new file mode 100644 index 0000000..8c76903 --- /dev/null +++ b/routes/stored.js @@ -0,0 +1,26 @@ +var express = require('express'); +var router = express.Router(); + +var db = require('../config/mongodb-config'), + User = require('../models/user'); + +router.get('/', function(req, res, next) { + if(req.user){ + User.find({}, function(err, docs){ + if(err) throw(err) + else{ + res.render('stored', { + title: 'Stored', + user: req.user, + users: docs + }); + } + }); + } + else{ + res.redirect('/webadmin') + } +}); + +module.exports = router; + diff --git a/routes/webadmin.js b/routes/webadmin.js new file mode 100644 index 0000000..125ca27 --- /dev/null +++ b/routes/webadmin.js @@ -0,0 +1,13 @@ +var express = require('express'); +var router = express.Router(); + + + + +router.get("/", function(req, res, next){ + //res.send('respond with a resource'); + + res.render("login"); +}); + +module.exports = router; \ No newline at end of file diff --git a/views/Card/template.jade b/views/Card/template.jade deleted file mode 100644 index 3851594..0000000 --- a/views/Card/template.jade +++ /dev/null @@ -1,6 +0,0 @@ -.MyCard - .MyCard-photo - img(src="./images/cara.png", class="MyCard-photo-img") - .MyCard-name - .MyCard--textStyle.borderStyle.titulo1 Daniel Nava - .MyCard-title.titulo2 Administrador diff --git a/views/admin-users.jade b/views/admin-users.jade new file mode 100644 index 0000000..6fc709f --- /dev/null +++ b/views/admin-users.jade @@ -0,0 +1,7 @@ +extends layout + +block content + + include ./models_jade/Header/template.jade + include ./models_jade/Section-main/template.jade + include ./models_jade/Admin-users/template.jade diff --git a/views/daniel.jade b/views/daniel.jade deleted file mode 100644 index a98fa99..0000000 --- a/views/daniel.jade +++ /dev/null @@ -1,5 +0,0 @@ -extends layout - -block content - nav - h1= title diff --git a/views/form.jade b/views/form.jade index 12a000d..0ec02f2 100644 --- a/views/form.jade +++ b/views/form.jade @@ -14,7 +14,7 @@ block content //- br //- div //- input(type="submit", value="sign up") - include ./Header/template.jade - include ./Section-main/template.jade - include ./Add-nueva-pagina/template.jade + include ./models_jade/Header/template.jade + include ./models_jade/Section-main/template.jade + include ./models_jade/Add-nueva-pagina/template.jade //- script(src="https://code.jquery.com/jquery-2.1.1.min.js") diff --git a/views/index.jade b/views/index.jade index 6941fff..3d63b9a 100644 --- a/views/index.jade +++ b/views/index.jade @@ -1,10 +1,5 @@ extends layout block content - //- h1= title - //- p Welcome to #{title} - include ./Header/template.jade - include ./Section-main/template.jade - include ./Bienvenido/template.jade - //- script(src="https://code.jquery.com/jquery-2.1.1.min.js") - //- script(src="./js/materialize.js") + h1= title + p Welcome to #{title} diff --git a/views/layout.jade b/views/layout.jade index fcf558e..c1d5629 100644 --- a/views/layout.jade +++ b/views/layout.jade @@ -9,12 +9,14 @@ html(lang="en") head meta(charset="UTF-8") meta(name="viewport", content="width=device-width, user-scalable=no") - title Agregar - link(rel="stylesheet", href="/stylesheets/style0.css") + title #{title} + link(rel="stylesheet", href="/stylesheets/style.css") link(rel="stylesheet", href="/stylesheets/style-fonts.css") link(rel="stylesheet", href='https://fonts.googleapis.com/css?family=Playfair+Display:400,700,400italic,700italic|Abril+Fatface|Bevan|Alegreya+Sans:400,700,400italic,500italic,700italic|Francois+One|Libre+Baskerville:400,400italic,700|Lato:400,700,400italic,700italic|Merriweather:400,400italic,700,700italic|Merriweather+Sans:400,400italic,700|Open+Sans:400,400italic,700,700italic|Roboto+Condensed:400,400italic,700,700italic') meta(name="viewport", content="width=device-width, initial-scale=1.0") body main.Main block content + script(src="https://code.jquery.com/jquery-2.1.1.min.js") + diff --git a/views/login.jade b/views/login.jade new file mode 100644 index 0000000..b947f26 --- /dev/null +++ b/views/login.jade @@ -0,0 +1,18 @@ +extends layout + +block content + include ./models_jade/Header/template.jade + //nav Sistema de Administración + include ./models_jade/Section-main/template.jade + .Section-secciones + .Section-item.box.flexbox-colwrp + .styleicon.icon-facebook + .titulo3.margin10.Font-francois.Fontcolor1.loginsocial + a(href='auth/facebook', class="linknone linksocial") Iniciar con Facebook + //.Section-secciones + .Section-item.box.flexbox-colwrp + .styleicon.icon-github + .titulo3.margin10.Font-francois.Fontcolor1.loginsocial + a(href='auth/github', class="linknone linksocial") Iniciar con Github + //- .Section-item.box.flexbox-colwrp + //- a(href='auth/facebook') Login con Facebook diff --git a/views/Add-nueva-pagina/style.styl b/views/models_jade/Add-nueva-pagina/style.styl similarity index 98% rename from views/Add-nueva-pagina/style.styl rename to views/models_jade/Add-nueva-pagina/style.styl index 8b8e23f..455af11 100644 --- a/views/Add-nueva-pagina/style.styl +++ b/views/models_jade/Add-nueva-pagina/style.styl @@ -10,9 +10,9 @@ /*input border-radius 2px border-width 0px - + margin 10px*/ - + input background-color transparent border-width 0px @@ -55,7 +55,7 @@ input:focus display flex flex-direction column justify-content space-around - + .inputstyle display flex flex-direction column @@ -80,4 +80,4 @@ select option["selected"] .lbl font-family 'Noto Serif' margin-bottom 5px - font-weight 600 \ No newline at end of file + font-weight 600 diff --git a/views/Add-nueva-pagina/template.jade b/views/models_jade/Add-nueva-pagina/template.jade similarity index 72% rename from views/Add-nueva-pagina/template.jade rename to views/models_jade/Add-nueva-pagina/template.jade index 91c3678..bf5273e 100644 --- a/views/Add-nueva-pagina/template.jade +++ b/views/models_jade/Add-nueva-pagina/template.jade @@ -1,15 +1,16 @@ -.titulo1.margin20.Font-francois.FontStylebold.Fontcolor1 Agregar nueva página al catálogo - .titulo2.Font-alegreya Sistema de Administración de catálogo -.divider +section + .titulo1.margin20.Font-francois.FontStylebold.Fontcolor1 Agregar nueva página al catálogo + .titulo2.Font-alegreya Sistema de Administración de catálogo + .divider .Section-secciones .Section-agregar.box.Formpanel .titulo3.margin10.Font-francois.Fontcolor1 Formulario .divider .Form - form(id="agregarweb", method="post", action="/signup", class="Form-add") + form(id="agregarweb", method="post", action="/form", class="Form-add") .inputstyle.Fontcolor1 label(for="input-nombre", class="lbl") Nombre de la nueva web: - input(type="text", id="input-nombre", name="webname") + input(type="text", id="input-nombre", name="namepage") .inputstyle.Fontcolor1 label(for="input-nombre", class="lbl") Nombre del propietario: input(type="text", id="input-propietario", placeholder="", name="propietario") diff --git a/views/models_jade/Admin-users/style.styl b/views/models_jade/Admin-users/style.styl new file mode 100644 index 0000000..1ae533d --- /dev/null +++ b/views/models_jade/Admin-users/style.styl @@ -0,0 +1,25 @@ +.Table + width 800px + &-user-photo + width 40px + border-radius 50% +.th + text-align justify +.td + margin-top 10px + +.facebook-label + background-color #00f + padding 4px + border-radius 0px 5px + color white + text-align center + width 85px + +.github-label + background-color #000 + padding 4px + border-radius 0px 5px + color white + text-align center + width 85px diff --git a/views/models_jade/Admin-users/template.jade b/views/models_jade/Admin-users/template.jade new file mode 100644 index 0000000..6a7fac9 --- /dev/null +++ b/views/models_jade/Admin-users/template.jade @@ -0,0 +1,24 @@ +section + .titulo1.margin20.Font-francois.FontStylebold.Fontcolor1 Usuarios Administradores + .titulo2.Font-alegreya Sistema de Administración de catálogo + .divider +.Section-secciones + .box + table(class="Table") + thead + tr + th(class="th" data-field='id') Usuario + th(class="th" data-field='name') Provedor + th(class="th" data-field='price') Foto + tbody + each user in users + tr(class="tr") + td(class="td") #{user.name} + if(user.provider == "facebook") + td(class="td") + div.facebook-label #{user.provider} + else + td(class="td") + div.github-label #{user.provider} + td(class="td") + img(src="#{user.photo}", class="Table-user-photo") diff --git a/views/Bienvenido/style.styl b/views/models_jade/Bienvenido/style.styl similarity index 86% rename from views/Bienvenido/style.styl rename to views/models_jade/Bienvenido/style.styl index c46ef90..8ba9898 100644 --- a/views/Bienvenido/style.styl +++ b/views/models_jade/Bienvenido/style.styl @@ -9,8 +9,8 @@ margin 30px auto flex-direction row justify-content space-around - align-items flex-start + align-items flex-stretch align-content space-around &-item width 250px - margin 10px \ No newline at end of file + margin 10px diff --git a/views/Bienvenido/template.jade b/views/models_jade/Bienvenido/template.jade similarity index 87% rename from views/Bienvenido/template.jade rename to views/models_jade/Bienvenido/template.jade index dd8453b..1d9e6d3 100644 --- a/views/Bienvenido/template.jade +++ b/views/models_jade/Bienvenido/template.jade @@ -9,8 +9,8 @@ p.Font-lato.Fontcolor1 Lorem ipsum dolor sit amet, consectetur adipisicing elit. Perspiciatis .divider .btnstyle1 - button.btn - a(href="/form") Ir + button.btn(onClick="location.href='/form'") Ir + //a(href="/form", class="linknone") Ir .Section-item.box.flexbox-colwrp .titulo3.margin10.Font-francois.Fontcolor1 Agregar categoría .divider @@ -18,7 +18,7 @@ p.Font-lato.Fontcolor1 Lorem ipsum dolor sit amet, consectetur adipisicing elit. Perspiciatis .divider .btnstyle1 - button.btn Ir + button.btn(onClick="location.href='/stored'") Ir .Section-item.box.flexbox-colwrp .titulo3.margin10.Font-francois.Fontcolor1 Ver la base de datos .divider @@ -26,7 +26,7 @@ p.Font-lato.Fontcolor1 Lorem ipsum dolor sit amet, consectetur adipisicing elit. Perspiciatis .divider .btnstyle1 - button.btn Ir + button.btn(onClick="location.href='/stored'") Ir .Section-item.box.flexbox-colwrp .titulo3.margin10.Font-francois.Fontcolor1 Ver estadísticas @@ -43,7 +43,7 @@ p.Font-lato.Fontcolor1 Lorem ipsum dolor sit amet, consectetur adipisicing elit. Perspiciatis .divider .btnstyle1 - button.btn Ir + button.btn(onClick="location.href='/admin-users'") Ir .Section-item.box.flexbox-colwrp .titulo3.margin10.Font-francois.Fontcolor1 Ver archivos .divider diff --git a/views/Card/style.styl b/views/models_jade/Card/style.styl similarity index 86% rename from views/Card/style.styl rename to views/models_jade/Card/style.styl index db8447f..07b55ba 100644 --- a/views/Card/style.styl +++ b/views/models_jade/Card/style.styl @@ -4,6 +4,7 @@ display flex flex-direction column align-items center + text-align center &-photo width 100px border-radius 50% @@ -11,7 +12,7 @@ padding 2px &-photo-img background-color #E0E0E0 - width 100px + width 80px border-radius 50% &-name display flex @@ -21,18 +22,18 @@ justify-content center //background-color #FBC02D //height 50px - &--textStyle + &--textStyle //padding 15px auto //letter-spacing 0.3em font-family: 'Roboto Condensed', sans-serif; color rgba(229,229,229,0.7) - &-title + &-title color #FAFAFA - font-family 'Noto Serif' + font-family 'Noto Serif' font-style italic margin-top -7px //letter-spacing 0.1em //height: 50px; display: flex; align-items: center; - justify-content: center; \ No newline at end of file + justify-content: center; diff --git a/views/models_jade/Card/template.jade b/views/models_jade/Card/template.jade new file mode 100644 index 0000000..4daeb0e --- /dev/null +++ b/views/models_jade/Card/template.jade @@ -0,0 +1,12 @@ +.MyCard + .MyCard-photo + if(user) + img(src="#{user.photo}", class="MyCard-photo-img") + else + img(src="/images/cara.png", class="MyCard-photo-img") + .MyCard-name + if(user) + .MyCard--textStyle.borderStyle.titulo1 #{user.name} + else + .MyCard--textStyle.borderStyle.titulo1 Daniel + .MyCard-title.titulo2 Administrador diff --git a/views/Header/style.styl b/views/models_jade/Header/style.styl similarity index 94% rename from views/Header/style.styl rename to views/models_jade/Header/style.styl index bbd7189..91b0e0f 100644 --- a/views/Header/style.styl +++ b/views/models_jade/Header/style.styl @@ -3,8 +3,7 @@ box-shadow: 0px -5px 7px 5px #777; &-sidenav padding 5px 20px - - // height 150vh + min-height 100vh width 15vw &-logo color white @@ -26,11 +25,11 @@ color rgba(240,240,240,1) &-item-text font-size 0.8rem - margin-left 15px - + margin-left 15px + .Nav-item[data-lastitem] margin-top 15px - + .iconstyle font-size 1.4rem display flex diff --git a/views/Header/template.jade b/views/models_jade/Header/template.jade similarity index 74% rename from views/Header/template.jade rename to views/models_jade/Header/template.jade index f3b6fa2..b9e910f 100644 --- a/views/Header/template.jade +++ b/views/models_jade/Header/template.jade @@ -1,9 +1,11 @@ header.Header .Header-sidenav .Header-logo.icon-logos_Logoytexto.margin10 - include ../Card/template.jade + if(user) + include ../Card/template.jade .divider .Nav + if(user) .Nav-item .iconstyle.icon-user div.Nav-item-text Ver perfil @@ -16,5 +18,8 @@ header.Header .notifi 2 .Nav-item(data-lastitem) .iconstyle(data-cross).icon-cross - div.Nav-item-text Cerrar sesión - \ No newline at end of file + a(href="/logout", class="linknone") + div.Nav-item-text Cerrar sesión + + + diff --git a/views/Section-main/template.jade b/views/models_jade/Section-main/template.jade similarity index 100% rename from views/Section-main/template.jade rename to views/models_jade/Section-main/template.jade diff --git a/views/models_jade/Stored/style.styl b/views/models_jade/Stored/style.styl new file mode 100644 index 0000000..e69de29 diff --git a/views/models_jade/Stored/template.jade b/views/models_jade/Stored/template.jade new file mode 100644 index 0000000..f6eca20 --- /dev/null +++ b/views/models_jade/Stored/template.jade @@ -0,0 +1,24 @@ +section + .titulo1.margin20.Font-francois.FontStylebold.Fontcolor1 Registros en la base de datos + .titulo2.Font-alegreya Sistema de Administración de catálogo + .divider +.Section-secciones + .box + table(class="Table") + thead + tr + th(class="th" data-field='id') Usuario + th(class="th" data-field='name') Provedor + th(class="th" data-field='price') Foto + tbody + each user in users + tr(class="tr") + td(class="td") #{user.name} + if(user.provider == "facebook") + td(class="td") + div.facebook-label #{user.provider} + else + td(class="td") + div.github-label #{user.provider} + td(class="td") + img(src="#{user.photo}", class="Table-user-photo") diff --git a/views/models_jade/styles/style-fuentes.styl b/views/models_jade/styles/style-fuentes.styl new file mode 100644 index 0000000..080396b --- /dev/null +++ b/views/models_jade/styles/style-fuentes.styl @@ -0,0 +1,28 @@ +.Font-playfair + font-family 'Playfair Display' serif +.Font-abril + font-family 'Abril Fatface' cursive +.Font-bevan + font-family 'Bevan' cursive +.Font-alegreya + font-family 'Alegreya Sans' sans-serif +.Font-francois + font-family 'Francois One' sans-serif +.Font-librebasker + font-family 'Libre Baskerville' serif +.Font-lato + font-family 'Lato' sans-serif +.Font-merriw + font-family 'Merriweather' serif +.Font-merriws + font-family 'Merriweather Sans' sans-serif +.Font-openssans + font-family 'Open Sans' sans-serif +.Font-roboto + font-family 'Roboto Condensed' sans-serif + +.FontStylebold + font-style bold + font-weight 700 +.Fontcolor1 + color rgba(#273e48, 0.86) diff --git a/views/models_jade/styles/style.styl b/views/models_jade/styles/style.styl new file mode 100644 index 0000000..96d1111 --- /dev/null +++ b/views/models_jade/styles/style.styl @@ -0,0 +1,165 @@ +@import "../../../node_modules/normalize-styl/normalize.styl" + +// Código de Compra +// 26979700 + +.bg-primary + background-color rgba(#1a237e, 0.7) +.bg-secundary + background-color rgba(#e3f2fd, 0.4) + + +.box + background-color white + padding 5px 10px + border-radius 2px + box-shadow 0px 2px 1px rgba(0,0,0,0.1) +.minwidth1 + min-width 300px +// .widthbox1 +// width 250px +// .flexbox-colwrp +// display flex +// flex-wrap wrap +// flex-direction column +.margin10 + margin 10px auto 10px 2px +.margin20 + margin 10px auto 10px 20px +.marginbtm + margin-bottom 10px +.titulo1 + font-size 1.6rem + padding 5px + color rgba(#212121, .95) +.titulo2 + font-size 1.1rem + color rgba(#212121, 0.7) +.titulo3 + font-size 1.4rem + color rgba(#212121, 0.9) + font-weight 600 +.titulo4 + font-size .9rem + font-weight 500 + color rgba(#212121, 0.9) +.divider + height 1px + overflow hidden + background-color #e0e0e0 + + +.linknone + text-decoration none + color rgba(229,229,229,0.9) +.linksocial + color: #273e48; +.loginsocial + text-align center + +.styleicon + font-size 4rem + text-align center + margin 10px auto + color rgba(#273e48, 1) + &:hover + color rgba(#273e48, .7) +.justifytext + text-align justify + + +body + font-size 18px +.Main + display flex + align-items stretch + + +@import "../Add-nueva-pagina/style.styl" +@import "../Header/style.styl" +@import "../Card/style.styl" +@import "../Bienvenido/style.styl" + +//@import "../Pages-stored/style.styl" +@import "style-fuentes.styl" + + + +@media screen and (max-width: 320px) + .titulo1 + font-size 1.3rem + .titulo2 + font-size 0.9rem + .titulo3 + font-size 1.1rem + .titulo4 + font-size .8rem + + main + display flex + flex-direction row + + .Section + width 100vw + &-secciones + flex-direction column + + .Header + box-shadow: -1px 4px 2px 0px #777; + max-height 100% + &-sidenav + width 100% + padding 0px + .MyCard + margin-top 0px + &-photo + text-align center + &-photo-img + text-align center + width 70px + .Formpanel + // display flex + // justify-content center + // flex-wrap wrap + // flex-direction column + items-align center + margin-top 2rem + width 90vw + +@media screen and (max-width: 720px) + + main + display flex + flex-direction column + .Section + width 100vw + &-secciones + flex-direction row + flex-wrap wrap + .Header + box-shadow: -1px 4px 2px 0px #777; + max-height 100% + &-sidenav + padding 0px + width 100% + &-logo + font-size 4.5rem + .MyCard + margin-top 0px + &-photo + text-align center + &-photo-img + text-align center + width 70px + .Formpanel + // display flex + // justify-content center + // flex-wrap wrap + // flex-direction column + items-align center + margin-top 2rem + width 90vw + + + +@import "../Admin-users/style.styl" diff --git a/views/session.jade b/views/session.jade new file mode 100644 index 0000000..5ac21cb --- /dev/null +++ b/views/session.jade @@ -0,0 +1,10 @@ +extends layout + +block content + //- h1= title + //- p Welcome to #{title} + include ./models_jade/Header/template.jade + include ./models_jade/Section-main/template.jade + include ./models_jade/Bienvenido/template.jade + //- script(src="https://code.jquery.com/jquery-2.1.1.min.js") + //- script(src="./js/materialize.js") diff --git a/views/stored.jade b/views/stored.jade new file mode 100644 index 0000000..f5a0521 --- /dev/null +++ b/views/stored.jade @@ -0,0 +1,8 @@ +extends layout + +block content + + include ./models_jade/Header/template.jade + include ./models_jade/Section-main/template.jade + include ./models_jade/Stored/template.jade +