Skip to content

Commit 7f2f89b

Browse files
committed
Merge pull request #41 from nus-mtp/develop
Merging develop to master for sprint 1 release
2 parents 273d0f0 + 6c9d62a commit 7f2f89b

904 files changed

Lines changed: 1746 additions & 120748 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.bowerrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"directory": "libs"
3+
}

.gitignore

Lines changed: 2 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -11,73 +11,19 @@ pids
1111
*.pid
1212
*.seed
1313

14-
# Directory for instrumented libs generated by jscoverage/JSCover
15-
lib-cov
16-
17-
# Coverage directory used by tools like istanbul
18-
coverage
19-
2014
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
2115
.grunt
2216

2317
# node-waf configuration
2418
.lock-wscript
2519

26-
# Compiled binary addons (http://nodejs.org/api/addons.html)
27-
build/Release
28-
2920
# Dependency directory
3021
# https://docs.npmjs.com/misc/faq#should-i-check-my-node-modules-folder-into-git
3122
node_modules
32-
33-
34-
### Intellij ###
35-
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio
36-
37-
*.iml
23+
libs/
3824

3925
## Directory-based project format:
4026
.idea/
41-
# if you remove the above rule, at least ignore the following:
42-
43-
# User-specific stuff:
44-
# .idea/workspace.xml
45-
# .idea/tasks.xml
46-
# .idea/dictionaries
47-
48-
# Sensitive or high-churn files:
49-
# .idea/dataSources.ids
50-
# .idea/dataSources.xml
51-
# .idea/sqlDataSources.xml
52-
# .idea/dynamic.xml
53-
# .idea/uiDesigner.xml
54-
55-
# Gradle:
56-
# .idea/gradle.xml
57-
# .idea/libraries
58-
59-
# Mongo Explorer plugin:
60-
# .idea/mongoSettings.xml
61-
62-
## File-based project format:
63-
*.ipr
64-
*.iws
65-
66-
## Plugin-specific files:
67-
68-
# IntelliJ
69-
/out/
70-
71-
# mpeltonen/sbt-idea plugin
72-
.idea_modules/
73-
74-
# JIRA plugin
75-
atlassian-ide-plugin.xml
76-
77-
# Crashlytics plugin (for Android Studio and IntelliJ)
78-
com_crashlytics_export_strings.xml
79-
crashlytics.properties
80-
crashlytics-build.properties
8127

8228
# User-defined
83-
.tmp
29+
.tmp

.travis.yml

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
11
language: node_js
2+
23
node_js:
3-
- "0.11"
4-
- "0.10"
5-
- "4.2"
6-
env:
7-
DASHBOARD_DIR=dashboard
8-
before_script:
9-
- npm install
10-
script: cd dashboard && grunt test
4+
- "0.10"
5+
116
branches:
12-
only:
13-
- development
7+
only:
8+
- develop
File renamed without changes.

README.md

Lines changed: 52 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,58 @@ An open source Javascript-based zoomable video player and server, which utilizes
33

44

55
## Installation
6-
`to be updated`
76

7+
### Prerequisites
8+
9+
[Node.js](http://nodejs.org)
10+
11+
Install Node.js from https://nodejs.org/en/download/
12+
13+
If you have Homebrew installed:
14+
```bash
15+
$ brew install node
16+
```
17+
18+
[Grunt](http://gruntjs.com/)
19+
```bash
20+
$ npm install -g grunt-cli
21+
```
22+
23+
[Bower](http://www.npmjs.com/package/bower)
24+
```bash
25+
$ npm install -g bower
26+
```
27+
28+
[Sails.js](http://sailsjs.org/get-started)
29+
```bash
30+
$ npm install -g sails
31+
```
32+
33+
34+
### Setup
35+
36+
Install the necessary packages.
37+
38+
```bash
39+
$ npm install
40+
$ bower install
41+
```
42+
43+
### Task Automation
44+
45+
Generate frontend assets using Grunt.
46+
47+
```bash
48+
$ grunt
49+
```
50+
51+
### Start server
52+
53+
Run on http://localhost:1337 .
54+
55+
```bash
56+
$ sails lift
57+
```
858

959
## Usage
1060
`to be updated`
@@ -21,5 +71,5 @@ An open source Javascript-based zoomable video player and server, which utilizes
2171
## License
2272
`to be updated`
2373

24-
[travis-image]: https://travis-ci.org/nus-mtp/zoomable.js.svg?branch=master
74+
[travis-image]: https://travis-ci.org/nus-mtp/zoomable.js.svg?branch=develop
2575
[travis-url]: https://travis-ci.org/nus-mtp/zoomable.js

api/controllers/UserController.js

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
/**
2+
* UserController
3+
*
4+
* @description :: Server-side logic for managing users
5+
* @help :: See http://links.sailsjs.org/docs/controllers
6+
* :: https://github.com/irlnathan/activityoverlord20/blob/master/api/controllers/UserController.js
7+
*/
8+
9+
var Passwords = require('machinepack-passwords');
10+
11+
module.exports = {
12+
13+
/**
14+
* `UserController.login()`
15+
*/
16+
login: function (req, res) {
17+
// Look for user using given username
18+
User.findOne({
19+
username: req.param('username')
20+
}, function foundUser(err, user) {
21+
if (err) return res.negotiate(err);
22+
if (!user) return res.notFound();
23+
24+
Passwords.checkPassword({
25+
passwordAttempt: req.param('password'),
26+
encryptedPassword: user.encryptedPassword
27+
}).exec({
28+
// An unexpected error occurred.
29+
error: function (err) {
30+
return res.negotiate(err);
31+
},
32+
33+
// If the password attempted is different from stored encrypted password
34+
incorrect: function () {
35+
return res.notFound();
36+
},
37+
38+
success: function () {
39+
// Store user id in the user session
40+
req.session.me = user.id;
41+
42+
// All working, let the client know everything worked
43+
return res.ok();
44+
}
45+
});
46+
});
47+
},
48+
49+
50+
/**
51+
* `UserController.signup()`
52+
*/
53+
signup: function (req, res) {
54+
return res.json({
55+
todo: 'signup() is not implemented yet!'
56+
});
57+
},
58+
59+
/**
60+
* `UserController.logout()`
61+
*/
62+
logout: function (req, res) {
63+
return res.json({
64+
todo: 'logout() is not implemented yet!'
65+
});
66+
},
67+
68+
/**
69+
* `UserController.updatePassword()`
70+
*/
71+
updatePassword: function (req, res) {
72+
return res.json({
73+
todo: 'updatePassword() is not implemented yet!'
74+
});
75+
}
76+
};
77+

api/controllers/VideoController.js

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
/**
2+
* VideoController
3+
*
4+
* @description :: Server-side logic for managing videos
5+
* @help :: See http://links.sailsjs.org/docs/controllers
6+
*/
7+
8+
module.exports = {
9+
10+
/**
11+
* `VideoController.create()`
12+
* Usage: POST /api/video
13+
*/
14+
create: function (req, res) {
15+
Video.create(req.body).exec(function (err, video) {
16+
if (err) throw err;
17+
res.json(video);
18+
});
19+
},
20+
21+
/**
22+
* `VideoController.read()`
23+
* Usage: GET /api/video/:id
24+
*/
25+
read: function (req, res) {
26+
Video.findOne({
27+
id: req.param('id')
28+
}).exec(function (err, video) {
29+
if (err) throw err;
30+
res.json(video);
31+
});
32+
},
33+
34+
/**
35+
* `VideoController.readAll()`
36+
* Usage: GET /api/video
37+
*/
38+
readAll: function (req, res) {
39+
Video.find().exec(function (err, videos) {
40+
if (err) throw err;
41+
res.json(videos);
42+
});
43+
},
44+
45+
/**
46+
* `VideoController.destroy()`
47+
* Usage: DELETE /api/video/:id
48+
*/
49+
destroy: function (req, res) {
50+
Video.destroy({
51+
id: req.param('id')
52+
}).exec(function (err, video) {
53+
console.log(req.body.videoId);
54+
if (err) throw err;
55+
res.json(video);
56+
});
57+
},
58+
59+
60+
/**
61+
* `VideoController.update()`
62+
* Usage: PUT /api/video/:id
63+
*/
64+
update: function (req, res) {
65+
Video.update({
66+
id: req.param('id')
67+
}, req.body).exec(function (err, updated) {
68+
if (err) throw err;
69+
res.json(updated);
70+
});
71+
},
72+
73+
74+
/**
75+
* `VideoController.tags()`
76+
* Usage:
77+
*/
78+
tags: function (req, res) {
79+
return res.json({
80+
todo: 'tags() is not implemented yet!'
81+
});
82+
},
83+
84+
/**
85+
* `VideoController.getVideo()`
86+
* Usage: POST /api/video/getVideo
87+
* Content: {id: ':id'}
88+
*/
89+
getVideo: function (req, res) {
90+
Video.findOne({
91+
id: req.param('id')
92+
}).exec(function (err, video) {
93+
if (err) throw err;
94+
res.json(video.videoDir);
95+
});
96+
}
97+
};
98+

api/models/Tag.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Tag.js
2+
// The set of tags registered in our app.
3+
4+
module.exports = {
5+
attributes: {
6+
name: {
7+
type: 'string',
8+
required: true,
9+
unique: true
10+
},
11+
12+
videoWithTags: {
13+
collection:'video',
14+
via: 'tags'
15+
}
16+
}
17+
}

0 commit comments

Comments
 (0)