Permalink
Browse files

Fix node instead of hardcoded path

  • Loading branch information...
1 parent 82790e4 commit 0115f75c074789d772cff49d7c29290b4d9ae2a0 @biggora committed Dec 24, 2012
Showing with 36 additions and 25 deletions.
  1. +1 −0 .gitignore
  2. +2 −1 app.js
  3. +1 −1 bin/trinte
  4. +6 −0 utils/forms.js
  5. +26 −23 utils/helper.js
View
@@ -1,2 +1,3 @@
/bin/xxx.js
.idea
+/cinfig.json
View
@@ -44,12 +44,13 @@ exports.boot = function (params) {
function bootApplication(app) {
app.configure(function () {
+ app.use(express.compress());
+ app.use(express.methodOverride());
app.use(express.bodyParser({
uploadDir: curpath + '/uploads',
keepExtensions: true,
encoding: 'utf-8'
}));
- app.use(express.methodOverride());
app.use(express.cookieParser('secret'));
app.use(express.session({
cookie: {
View
@@ -1,4 +1,4 @@
-#!/usr/bin/env node
+#!/usr/bin/node
/**
* TrinteJS MVC Bootstrap
View
@@ -0,0 +1,6 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+
View
@@ -5,33 +5,36 @@
exports.init = function () {
return function (req, res, next) {
var session = req.session;
- res.locals.session = session;
- res.locals.request = req;
- res.locals.formVal = function (val) {
- return typeof val == 'undefined' ? "" : val;
- };
- res.locals.sortFor = function (field, title, tooltip) {
- var direction = '-', query = req.query,
+ res.locals = {
+ session : session,
+ request : req,
+ formVal : function (val) {
+ return typeof val == 'undefined' ? "" : val;
+ },
+ sortFor : function (field, title, tooltip) {
+ var direction = '-', query = req.query,
sort = false, uri = [], icon = "", dd, dt = "";
- for (var q in query) {
- if (q == 'sort') {
- sort = true;
- direction = /^-/.test(query.sort) ? "" : "-";
- uri.push(q + '=' + direction + field);
- if(eval('/' + field + '/gi').test(query.sort)) {
- icon = direction == '-' ? "headerSortDown" : "headerSortUp";
+ for (var q in query) {
+ if (q == 'sort') {
+ sort = true;
+ direction = /^-/.test(query.sort) ? "" : "-";
+ uri.push(q + '=' + direction + field);
+ if(eval('/' + field + '/gi').test(query.sort)) {
+ icon = direction == '-' ? "headerSortDown" : "headerSortUp";
+ }
+ } else {
+ uri.push(q + '=' + query[q]);
}
- } else {
- uri.push(q + '=' + query[q]);
}
+ if(!sort) {
+ uri.push('sort=' + direction + field);
+ }
+ dd = direction == '-' ? "DESC" : "ASC";
+ dt = tooltip ? 'rel="tooltip" data-title="' + tooltip + '"' : "";
+ return '<a ' + dt + ' class="sorter ' + icon + '" data-field="' + field + '" data-direction="' + dd + '" href="?' + uri.join('&') + '">' + title + '</a>';
}
- if(!sort) {
- uri.push('sort=' + direction + field);
- }
- dd = direction == '-' ? "DESC" : "ASC";
- dt = tooltip ? 'rel="tooltip" data-title="' + tooltip + '"' : "";
- return '<a ' + dt + ' class="sorter ' + icon + '" data-field="' + field + '" data-direction="' + dd + '" href="?' + uri.join('&') + '">' + title + '</a>';
- }
+ };
+
next();
}
}

0 comments on commit 0115f75

Please sign in to comment.