Skip to content

Commit

Permalink
bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Andre Souza Bonon Borges committed Aug 27, 2016
1 parent c7de5df commit f9066ef
Show file tree
Hide file tree
Showing 6 changed files with 103 additions and 40 deletions.
2 changes: 1 addition & 1 deletion routes/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ var router = express.Router();
/* GET home page. */
router.get('/', function(req, res) {
console.log('Home', req.query, req.params);
res.render('home', { title: 'SPOTBUY' });
res.render('home', { title: 'SPOTIBUY' });
});

module.exports = router;
2 changes: 1 addition & 1 deletion routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ router.get('/', function(req, res) {
const offset = Number(req.query.offset) || 0;
Promise.all([spotify.getUserData(token), spotify.getTopArtists(token, offset)])
.then((values) => {
res.render('home', { title: 'SPOTBUY',
res.render('home', { title: 'SPOTIBUY',
user : values[0],
topArtists : values[1],
offset : offset
Expand Down
15 changes: 12 additions & 3 deletions routes/shirts.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
var express = require('express');
var spotify = require('../services/spotify');
var shirts = require('../services/shirts');

var router = express.Router();

/* GET home page. */
router.get('/', function(req, res, next) {
if (!req.cookies.access_token) {
res.redirect('/login');
}
const token = {access_token : req.cookies.access_token};
const offset = Number(req.query.offset) || 0;
const query = req.query || {q: ''};
shirts.findShirts(query.q)
.then((result) => {
res.render('shirts', result);
Promise.all([spotify.getUserData(token), shirts.findShirts(query.q)])
.then((values) => {
res.render('shirts', { title: 'SPOTIBUY',
user : values[0],
results : values[1].results
});
})
.catch((e) => {
console.log(e);
Expand Down
16 changes: 13 additions & 3 deletions routes/tickets.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
var express = require('express');
var spotify = require('../services/spotify');
var tickets = require('../services/tickets');

var router = express.Router();

/* GET home page. */
router.get('/', function(req, res, next) {
if (!req.cookies.access_token) {
res.redirect('/login');
}
const token = {access_token : req.cookies.access_token};
const offset = Number(req.query.offset) || 0;
const query = req.query || {q: ''};
tickets.findTickets(query.q)
.then((result) => {
res.render('tickets', {results: result});
Promise.all([spotify.getUserData(token), tickets.findTickets(query.q)])
.then((values) => {
console.log(values[1]);
res.render('tickets', { title: 'SPOTIBUY',
user : values[0],
results : values[1]
});
})
.catch((e) => {
console.log(e);
Expand Down
48 changes: 35 additions & 13 deletions views/shirts.pug
Original file line number Diff line number Diff line change
@@ -1,18 +1,40 @@
extends layout

block content
h1(style='text-align: center;') Camisetas
nav.navbar.navbar-default.navbar-fixed
.container-fluid
.navbar-header
button.navbar-toggle.collapsed(type='button', data-toggle='collapse', data-target='#bs-example-navbar-collapse-1', aria-expanded='false')
span.sr-only Toggle navigation
span.icon-bar
span.icon-bar
span.icon-bar
a.navbar-brand(href='#') SPOTIBUY
ul.nav.navbar-nav.navbar-right
li(style='margin: 10px;') #{user.display_name}
li
img.img-circle(src=user.images.length ? user.images[0].url : '', height='44px')
.container
.row.text-center
for result in results
div.item.item-wrapper.col-lg-3.col-md-4.col-xs-6
div
div.img-wrapper
img(src=result.thumbnail.replace('-I', '-O'), alt=result.title)
div.details
p #{result.title}
h1.text-center Camisetas
.container
.row.text-center
if !results.length
h2 Cara! Você é Hipster demais!
h2 A sua banda não é popular o suficiente.
h2 Tente outra banda. =)
h3
a(href="/") Voltar


for result in results
div.item.item-wrapper.col-lg-3.col-md-4.col-xs-6
div
div.img-wrapper
img(src=result.thumbnail.replace('-I', '-O'), alt=result.title)
div.details
p #{result.title}
div.data
p R$ #{result.price.toFixed(2).replace('.', ',')}
div.data
p R$ #{result.price.toFixed(2).replace('.', ',')}
div.data
a(href=result.permalink)
button(class="btn btn-success") Comprar
a(href=result.permalink)
button(class="btn btn-success") Comprar
60 changes: 41 additions & 19 deletions views/tickets.pug
Original file line number Diff line number Diff line change
@@ -1,22 +1,44 @@
extends layout

block content
h1.text-center Ingressos
div(class="container")
div(class="row")
for result in results
div(class="col-lg-3 col-md-4 col-xs-6 item", style="margin-bottom:10px;")
div
div(style="margin-bottom: 15px;")
img(src='http://s3-eu-west-1.amazonaws.com/statictb.net/categoria/'+result.genreId+'.jpg', style="width:100%;height:148px;")
div(style="margin-left: 10px;")
div(class="details")
a(href=result.url)
p #{result.name}
div(class="details")
p Localização: #{result.venue}
div(class="details")
p Data: #{result.dateFormatted}
div(class="data")
a(href=result.pub_url)
button(class="btn btn-success") Comprar Ingresso
nav.navbar.navbar-default.navbar-fixed
.container-fluid
.navbar-header
button.navbar-toggle.collapsed(type='button', data-toggle='collapse', data-target='#bs-example-navbar-collapse-1', aria-expanded='false')
span.sr-only Toggle navigation
span.icon-bar
span.icon-bar
span.icon-bar
a.navbar-brand(href='#') SPOTIBUY
ul.nav.navbar-nav.navbar-right
li(style='margin: 10px;') #{user.display_name}
li
img.img-circle(src=user.images.length ? user.images[0].url : '', height='44px')
.container
h1.text-center Ingressos
div(class="container")
.row.text-center
if !results.length
h2 Amigo, sua banda não está com nada! =P
h2 Não encontramos nenhum show programado.
h2 Tente outra banda. =)
h3
a(href="/") Voltar


for result in results
div(class="col-lg-3 col-md-4 col-xs-6 item", style="margin-bottom:10px;")
div
div(style="margin-bottom: 15px;")
img(src='http://s3-eu-west-1.amazonaws.com/statictb.net/categoria/'+result.genreId+'.jpg', style="width:100%;height:148px;")
div(style="margin-left: 10px;")
div(class="details")
a(href=result.url)
p #{result.name}
div(class="details")
p Localização: #{result.venue}
div(class="details")
p Data: #{result.dateFormatted}
div(class="data")
a(href=result.pub_url)
button(class="btn btn-success") Comprar Ingresso

0 comments on commit f9066ef

Please sign in to comment.