[Groonga-commit] groonga/gcs-console [master] Introduce flash, feedback domain operations #8 #9

Back to archive index

Yoji SHIDARA null+****@clear*****
Thu Oct 18 15:55:24 JST 2012


Yoji SHIDARA	2012-10-18 15:55:24 +0900 (Thu, 18 Oct 2012)

  New Revision: 46052c5528fc7aeeb0563400e89a7a7fa1040924
  https://github.com/groonga/gcs-console/commit/46052c5528fc7aeeb0563400e89a7a7fa1040924

  Log:
    Introduce flash, feedback domain operations #8 #9

  Modified files:
    app.js
    package.json
    routes/index.js
    views/layout.jade

  Modified: app.js (+10 -0)
===================================================================
--- app.js    2012-10-18 15:13:29 +0900 (baa67aa)
+++ app.js    2012-10-18 15:55:24 +0900 (4bbb886)
@@ -7,6 +7,7 @@ var express = require('express')
   , routes = require('./routes')
   , http = require('http')
   , path = require('path');
+var flash = require('connect-flash');
 
 var app = express();
 
@@ -18,6 +19,15 @@ app.configure(function(){
   app.use(express.logger('dev'));
   app.use(express.bodyParser());
   app.use(express.methodOverride());
+  app.use(express.cookieParser('keyboard cat'));
+  app.use(express.session({ cookie: { maxAge: 60000 }}));
+  app.use(flash());
+  app.use((function() {
+    return function(req, res, next) {
+      res.locals.info = req.flash('info');
+      next();
+    }
+  })());
   app.use(express.static(path.join(__dirname, 'public')));
   app.use(require('./lib/cloudsearch').cloudsearch());
   app.use(app.router);

  Modified: package.json (+2 -1)
===================================================================
--- package.json    2012-10-18 15:13:29 +0900 (223d5aa)
+++ package.json    2012-10-18 15:55:24 +0900 (5c35293)
@@ -17,7 +17,8 @@
     "express": "",
     "jade": "",
     "awssum": "",
-    "underscore": ""
+    "underscore": "",
+    "connect-flash": ""
   },
   "scripts": {
     "start": "node app"

  Modified: routes/index.js (+2 -1)
===================================================================
--- routes/index.js    2012-10-18 15:13:29 +0900 (8ec56a3)
+++ routes/index.js    2012-10-18 15:55:24 +0900 (085733b)
@@ -168,6 +168,7 @@ exports.domainCreatePost = function(req, res) {
     }
 
     var domainCreated = data.Body.CreateDomainResponse.CreateDomainResult.DomainStatus;
+    req.flash('info', 'Domain successfully created');
     res.redirect('/domain/'+domainCreated.DomainName);
   });
 };
@@ -182,7 +183,7 @@ exports.domainDelete = function(req, res) {
       return;
     }
 
+    req.flash('info', 'Domain successfully deleted');
     res.redirect('/');
-    // TODO some feedback to user may be needed
   });
 };

  Modified: views/layout.jade (+2 -0)
===================================================================
--- views/layout.jade    2012-10-18 15:13:29 +0900 (22f2583)
+++ views/layout.jade    2012-10-18 15:55:24 +0900 (85b447b)
@@ -17,4 +17,6 @@ html
         .alert.alert-error
           strong Error. 
           span= error.message
+      for message in info
+        .alert.alert-info= message
       block application
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index