Skip to content
This repository was archived by the owner on Apr 13, 2023. It is now read-only.

Commit c5be87f

Browse files
committed
Added updatedBy field, changed "Bundle ID" to "GUID"
1 parent 4b0745e commit c5be87f

File tree

12 files changed

+71
-16
lines changed

12 files changed

+71
-16
lines changed

app/models/release.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,16 @@ var ReleaseSchema = new Schema({
6464
*/
6565
updated: Date,
6666

67+
/**
68+
* The user who updated the release
69+
* @property {User} updatedBy
70+
*/
71+
updatedBy: {
72+
type: Schema.Types.ObjectId,
73+
ref: 'User',
74+
required: false
75+
},
76+
6777
/**
6878
* Release notes for the game
6979
* @property {String} notes

app/routes/games/game.js

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ var router = require('express').Router(),
33
_ = require('lodash'),
44
privileges = require('../../helpers/access').privilege,
55
Game = require('../../models/game'),
6+
User = require('../../models/user'),
67
Release = require('../../models/release');
78
log = require('../../helpers/logger');
89

@@ -37,8 +38,7 @@ function handleError(req, res, errors)
3738
*/
3839
function renderPage(req, res, template, populate, success)
3940
{
40-
populate = populate || 'groups.group';
41-
41+
populate = ['groups.group'].concat(populate || []);
4242
async.waterfall(
4343
[
4444
function(done)
@@ -47,6 +47,25 @@ function renderPage(req, res, template, populate, success)
4747
.populate(populate);
4848
},
4949
function(game, done)
50+
{
51+
if (populate.indexOf('releases'))
52+
{
53+
User.populate(game.releases, {
54+
path: 'updatedBy',
55+
select: 'name'
56+
},
57+
function(err, releases)
58+
{
59+
if (err) return done(err);
60+
done(null, game);
61+
});
62+
}
63+
else
64+
{
65+
done(null, game);
66+
}
67+
},
68+
function(game, done)
5069
{
5170
if (!game) return res.status(404).render('404');
5271

@@ -169,7 +188,8 @@ router.post('/:slug/releases', function(req, res)
169188
req.body.release,
170189
{
171190
status: req.body.status,
172-
updated: Date.now()
191+
updated: Date.now(),
192+
updatedBy: req.body.updatedBy
173193
},
174194
done
175195
);
@@ -318,7 +338,7 @@ router.get('/:slug/release', function(req, res)
318338
router.get('/:slug/releases', function(req, res)
319339
{
320340
renderPage(req, res, 'games/releases',
321-
'releases groups.group',
341+
['releases'],
322342
function(game)
323343
{
324344
game.releases.reverse();

app/views/docs.jade

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,31 @@ append content
88
h2 API Methods
99
.well
1010
h4 GET
11-
strong /api/releases/[slugOrBundleId]
11+
strong /api/games
1212
ul
1313
li
1414
strong status
15-
em (dev|qa|stage|prod)
15+
em (dev|qa|stage|prod, default:prod)
16+
p Deployment environment
17+
li
18+
strong token
19+
em (String)
20+
p The access token required to view releases on Dev, QA or Stage
21+
li
22+
strong debug
23+
em (Boolean, default: false)
24+
p Select the debug URL for releases
25+
li
26+
strong archive
27+
em (Boolean, default: false)
28+
p Select the archive ZIP for releases
29+
.well
30+
h4 GET
31+
strong /api/releases/[slugOrGuid]
32+
ul
33+
li
34+
strong status
35+
em (dev|qa|stage|prod, default:prod)
1636
p Deployment environment
1737
li
1838
strong version
@@ -36,7 +56,7 @@ append content
3656
p Select the archive ZIP for releases
3757
.well
3858
h4 GET
39-
strong /api/release/[slugOrBundleId]
59+
strong /api/release/[slugOrGuid]
4060
ul
4161
li
4262
strong status
@@ -64,7 +84,7 @@ append content
6484
p Select the archive ZIP for releases
6585
.well
6686
h4 POST
67-
strong /api/release/[slugOrBundleId]
87+
strong /api/release/[slugOrGuid]
6888
ul
6989
li
7090
strong status

app/views/games/add.jade

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ append content
1515
.col-sm-9
1616
input.form-control#title(type="text" name="title" data-uri="#slug" required)
1717
.form-group(data-unique="/games/search")
18-
label.col-sm-3.control-label(for="bundleId") Bundle ID
18+
label.col-sm-3.control-label(for="bundleId") GUID
1919
.col-sm-9
20-
input.form-control#bundleId(type="text" placeholder="com.example.MyGame" name="bundleId" required)
20+
input.form-control#bundleId(type="text" name="bundleId" required)
2121
span.yes.glyphicon.glyphicon-ok.form-control-feedback
2222
span.no.glyphicon.glyphicon-remove.form-control-feedback
2323
.form-group(data-unique="/games/search")

app/views/games/game.jade

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ append gameContent
1111
h3.panel-title Properties
1212
.panel-body
1313
.row
14-
.col-sm-2: strong Bundle ID
14+
.col-sm-2: strong GUID
1515
.col-sm-10: p
1616
code=game.bundleId
1717
.row

app/views/games/modal-edit.jade

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
.col-sm-9
1111
input.form-control#title(type="text" name="title" #{disabled} value=game.title required)
1212
.form-group(data-unique="/games/search" data-ignore=game.bundleId)
13-
label.col-sm-3.control-label(for="bundleId") Bundle
13+
label.col-sm-3.control-label(for="bundleId") GUID
1414
.col-sm-9
1515
input.form-control#bundleId(type="text" name="bundleId" #{disabled} value=game.bundleId required)
1616
span.yes.glyphicon.glyphicon-ok.form-control-feedback

app/views/games/modal-release.jade

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
input(type="hidden" name="warnUniqueCommit" value="true")
4242
input(type="hidden" name="redirect" value=url)
4343
input(type="hidden" name="token" value=token)
44+
input(type="hidden" name="updatedBy" value=user._id)
4445
button.btn.btn-primary(type="submit") Add Release
4546
|
4647
button.btn.btn-default(type="button" data-dismiss="modal") Cancel

app/views/games/release.jade

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ append gameContent
4040
include capabilities
4141
.form-group
4242
.col-sm-9.col-sm-offset-3.text-center
43+
input(type="hidden" name="updatedBy" value=user._id)
4344
input(type="hidden" name="release" value=release._id)
4445
button.btn.btn-lg.btn-primary(type="submit" name="action" value="updateRelease") Update
4546
|

app/views/games/releases.jade

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ append gameContent
2020
.col-sm-3
2121
if isEditor
2222
form.release-title.text-center(action=url method="post")
23+
input(type="hidden" name="updatedBy" value=user._id)
2324
input(type="hidden" name="release" value=release._id)
2425
input(type="hidden" name="action" value="statusChange")
2526
.btn-group.btn-block
@@ -77,8 +78,10 @@ append gameContent
7778
h4: strong Commit
7879
a(href="#{game.repository}/commits/#{release.commitId}" data-toggle="tooltip" title="View Commit")=release.commitId.substr(0,7)
7980

80-
.help-block.updated.hidden-xs
81+
.help-block.updated
8182
span Updated
8283
span=moment(release.updated).fromNow()
84+
if release.updatedBy
85+
| by #{release.updatedBy.name}
8386
if release.notes
8487
p!= marked(release.notes)

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "SpringRollConnect",
3-
"version": "1.3.6",
3+
"version": "1.3.7",
44
"dependencies": {
55
"jquery": "*",
66
"bootstrap": "*",

0 commit comments

Comments
 (0)