This repository is for zephyr, which is implemented for a GUI of Eos.
Revision | b5f5176dc28c567112cc454e20feb6ad27c80f14 (tree) |
---|---|
Time | 2015-08-10 10:28:29 |
Author | himetani_cafe <fumifumi@yasu...> |
Commiter | himetani_cafe |
create directory
@@ -0,0 +1,27 @@ | ||
1 | +'use strict' | |
2 | + | |
3 | +angular.module('zephyrApp') | |
4 | +.controller('CreateDirModalController', function($scope, $modalInstance, Restangular, user, $timeout) { | |
5 | + // To send multipart request from angular, we should set below | |
6 | + var baseDirCreation = Restangular.all('/api/dirCreation') | |
7 | + $scope.create = function() { | |
8 | + var params = { | |
9 | + dir: $scope.path, | |
10 | + email: user.getEmail(), | |
11 | + createdDirName: $scope.createdDirName | |
12 | + } | |
13 | + baseDirCreation.post(params).then(function(status) { | |
14 | + console.log(status) | |
15 | + $modalInstance.close() | |
16 | + }) | |
17 | + } | |
18 | + | |
19 | + $scope.$on('conflict', function() { | |
20 | + $scope.alert = true | |
21 | + }) | |
22 | + | |
23 | + $scope.close = function() { | |
24 | + $modalInstance.close() | |
25 | + } | |
26 | + | |
27 | +}) |
@@ -0,0 +1,23 @@ | ||
1 | +<div class="modal-header"> | |
2 | +<h3>Save Notes</h3> | |
3 | +</div> | |
4 | + | |
5 | +<div class="modal-body"> | |
6 | + <div class="container"> | |
7 | + <input type="text" | |
8 | + ng-model="createdDirName" /> | |
9 | + </div> | |
10 | + <p class="text-danger" ng-show="alert">already exists</p> | |
11 | +</div> | |
12 | + | |
13 | +<div class="modal-footer"> | |
14 | + <ul class="list-inline"> | |
15 | + <li> | |
16 | + <button class="btn btn-default" ng-click="create()" type="button">create</button> | |
17 | + </li> | |
18 | + <li> | |
19 | + <button class="btn btn-default" ng-click="close()" type="button">cancel</button> | |
20 | + </li> | |
21 | + </ul> | |
22 | +</div> | |
23 | + |
@@ -1,9 +1,7 @@ | ||
1 | 1 | 'use strict' |
2 | 2 | |
3 | 3 | angular.module('zephyrApp') |
4 | -.controller('UploadFileModalController', function($scope, $modalInstance, Restangular, socket) { | |
5 | - // To send multipart request from angular, we should set below | |
6 | - var baseUpload = Restangular.all('/api/upload').withHttpConfig({transformRequest: angular.identity}) | |
4 | +.controller('UploadFileModalController', function($scope, $modalInstance, socket) { | |
7 | 5 | $scope.upload = function() { |
8 | 6 | var array = [] |
9 | 7 | angular.forEach($scope.uploadFiles, function(file) { |
@@ -48,6 +48,7 @@ | ||
48 | 48 | <script src="/client/app/components/board/board.controller.js"></script> |
49 | 49 | <script src="/client/app/components/board/board.js"></script> |
50 | 50 | <script src="/client/app/components/commandModal/commandModal.controller.js"></script> |
51 | + <script src="/client/app/components/createDirModal/createDirModal.controller.js"></script> | |
51 | 52 | <script src="/client/app/components/login/login.controller.js"></script> |
52 | 53 | <script src="/client/app/components/login/login.js"></script> |
53 | 54 | <script src="/client/app/components/notes/notes.controller.js"></script> |
@@ -1,9 +1,31 @@ | ||
1 | 1 | 'use strict'; |
2 | 2 | |
3 | -var express = require('express'); | |
4 | -var router = express.Router(); | |
3 | +var express = require('express'), | |
4 | + router = express.Router(), | |
5 | + path = require('path'), | |
6 | + fs = require('fs'), | |
7 | + jb = require('../../jb.js') | |
8 | + | |
9 | +router.post('/', function(req, res) { | |
10 | + var dir = req.body.dir, | |
11 | + email = req.body.email, | |
12 | + name = req.body.createdDirName, | |
13 | + createdDirPath = path.normalize(__dirname+'/../../../'+dir+'/'+name) | |
14 | + | |
15 | + try { | |
16 | + fs.mkdirSync(createdDirPath) | |
17 | + res.send('dirCreation success') | |
18 | + } catch(e) { | |
19 | + res.sendStatus(409) | |
20 | + } | |
21 | + | |
22 | + if(dir === 'workspace') { | |
23 | + jb.update('user', | |
24 | + { email: email , | |
25 | + $addToSet: { workspaces: name } | |
26 | + }) | |
27 | + } | |
5 | 28 | |
6 | -router.get('/', function() { | |
7 | 29 | |
8 | 30 | }); |
9 | 31 |
@@ -1,30 +0,0 @@ | ||
1 | -'use strict'; | |
2 | - | |
3 | -var express = require('express'), | |
4 | - router = express.Router(), | |
5 | - path = require('path'), | |
6 | - formidable = require('formidable') | |
7 | - | |
8 | - | |
9 | -router.post('/', function(req, res) { | |
10 | - var form = new formidable.IncomingForm() | |
11 | - form.maxFieldsSize = 10 * 1024 * 1024 | |
12 | - | |
13 | - form.on('field', function(name, value) { | |
14 | - if(name === 'dir') | |
15 | - form.uploadDir = path.normalize(__dirname+'/../../../'+value+'/') | |
16 | - console.log(form.uploadDir) | |
17 | - }) | |
18 | - | |
19 | - form.on('fileBegin', function(field, file) { | |
20 | - file.path = form.uploadDir + file.name | |
21 | - }) | |
22 | - | |
23 | - form.parse(req, function(err, fields, files) { | |
24 | - }) | |
25 | - | |
26 | - res.send('success') | |
27 | - | |
28 | -}); | |
29 | - | |
30 | -module.exports = router; |
@@ -15,8 +15,6 @@ var server = app.listen(config.port, config.ip, function () { | ||
15 | 15 | console.log(config.root); |
16 | 16 | console.log('iEos listening at http://%s:%s', config.ip, config.port); |
17 | 17 | console.log(app.get('env')) |
18 | - | |
19 | - | |
20 | 18 | }); |
21 | 19 | |
22 | 20 | var io = require('socket.io').listen(server) |
@@ -13,7 +13,7 @@ module.exports = function(app) { | ||
13 | 13 | app.use('/api/commandExecution', require('./api/commandExecution')) |
14 | 14 | app.use('/api/noteCreation', require('./api/noteCreation')) |
15 | 15 | app.use('/api/noteInfo', require('./api/noteInfo')) |
16 | - app.use('/api/upload', require('./api/upload')) | |
16 | + app.use('/api/dirCreation', require('./api/dirCreation')) | |
17 | 17 | app.use('/auth/login', require('./auth/login')) |
18 | 18 | app.use('/auth/signup', require('./auth/signup')) |
19 | 19 |