Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: huseyinbabal/nodejs-lazyload
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: nodejstr/nodejs-lazyload
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Able to merge. These branches can be automatically merged.
  • 1 commit
  • 4 files changed
  • 1 contributor

Commits on Dec 7, 2013

  1. gitignore

    salimkayabasi committed Dec 7, 2013
    Copy the full SHA
    cc1c194 View commit details
Showing with 33 additions and 8 deletions.
  1. +16 −0 .gitignore
  2. +7 −1 config/runtime.json
  3. +3 −5 controllers/CityController.js
  4. +7 −2 views/city-list.jade
16 changes: 16 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
lib-cov
*.seed
*.log
*.csv
*.dat
*.out
*.pid
*.gz
*.idea

pids
logs
results

npm-debug.log
node_modules
8 changes: 7 additions & 1 deletion config/runtime.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
{

"db": {
"USER": "test",
"PASS": "test",
"HOST": "localhost",
"PORT": "",
"DATABASE": "blog"
}
}
8 changes: 3 additions & 5 deletions controllers/CityController.js
Original file line number Diff line number Diff line change
@@ -33,14 +33,12 @@ CityController = function (app, mongoose, config) {

app.get('/city/loadCity/:index/?', function(req, res, next) {
util.log(req.method + " request to url : " + req.route.path);
var index = req.params.index;
var query = City.find({}).sort({'createDate': -1}).skip(index).limit(30);
query.execFind(function(err, cities) {
console.log(cities)
if (!err) {
res.render('city-list', {
title: "Cities",
cities: cities,

});
res.json(cities);
} else {
res.status(500);
res.render('500', {
9 changes: 7 additions & 2 deletions views/city-list.jade
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
!!! 5
html
head
title City Database
title #{title}
meta(name='viewport', content='width=device-width, initial-scale=1.0')
//
Bootstrap
@@ -77,7 +77,12 @@ html
url: "/city/loadCity/"+lastCityIndex,
success: function(html) {
if (html) {
$("tbody").append(html);
var html_ = "";
$.each(html, function(i, e) {
html_ += '<tr cityindex="' + (i + lastCityIndex) + '"><td>' + e.city + '</td><td>' + e.loc + '</td><td>' + e.pop + '</td><td>' + e.dummy + '</td></tr>';
});

$("tbody").append(html_);
} else {
alert("Error")
}