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

Commit

Permalink
Added updatedBy field, changed "Bundle ID" to "GUID"
Browse files Browse the repository at this point in the history
  • Loading branch information
bigtimebuddy committed Dec 14, 2015
1 parent 4b0745e commit c5be87f
Show file tree
Hide file tree
Showing 12 changed files with 71 additions and 16 deletions.
10 changes: 10 additions & 0 deletions app/models/release.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,16 @@ var ReleaseSchema = new Schema({
*/
updated: Date,

/**
* The user who updated the release
* @property {User} updatedBy
*/
updatedBy: {
type: Schema.Types.ObjectId,
ref: 'User',
required: false
},

/**
* Release notes for the game
* @property {String} notes
Expand Down
28 changes: 24 additions & 4 deletions app/routes/games/game.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ var router = require('express').Router(),
_ = require('lodash'),
privileges = require('../../helpers/access').privilege,
Game = require('../../models/game'),
User = require('../../models/user'),
Release = require('../../models/release');
log = require('../../helpers/logger');

Expand Down Expand Up @@ -37,8 +38,7 @@ function handleError(req, res, errors)
*/
function renderPage(req, res, template, populate, success)
{
populate = populate || 'groups.group';

populate = ['groups.group'].concat(populate || []);
async.waterfall(
[
function(done)
Expand All @@ -47,6 +47,25 @@ function renderPage(req, res, template, populate, success)
.populate(populate);
},
function(game, done)
{
if (populate.indexOf('releases'))
{
User.populate(game.releases, {
path: 'updatedBy',
select: 'name'
},
function(err, releases)
{
if (err) return done(err);
done(null, game);
});
}
else
{
done(null, game);
}
},
function(game, done)
{
if (!game) return res.status(404).render('404');

Expand Down Expand Up @@ -169,7 +188,8 @@ router.post('/:slug/releases', function(req, res)
req.body.release,
{
status: req.body.status,
updated: Date.now()
updated: Date.now(),
updatedBy: req.body.updatedBy
},
done
);
Expand Down Expand Up @@ -318,7 +338,7 @@ router.get('/:slug/release', function(req, res)
router.get('/:slug/releases', function(req, res)
{
renderPage(req, res, 'games/releases',
'releases groups.group',
['releases'],
function(game)
{
game.releases.reverse();
Expand Down
28 changes: 24 additions & 4 deletions app/views/docs.jade
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,31 @@ append content
h2 API Methods
.well
h4 GET
strong /api/releases/[slugOrBundleId]
strong /api/games
ul
li
strong status
em (dev|qa|stage|prod)
em (dev|qa|stage|prod, default:prod)
p Deployment environment
li
strong token
em (String)
p The access token required to view releases on Dev, QA or Stage
li
strong debug
em (Boolean, default: false)
p Select the debug URL for releases
li
strong archive
em (Boolean, default: false)
p Select the archive ZIP for releases
.well
h4 GET
strong /api/releases/[slugOrGuid]
ul
li
strong status
em (dev|qa|stage|prod, default:prod)
p Deployment environment
li
strong version
Expand All @@ -36,7 +56,7 @@ append content
p Select the archive ZIP for releases
.well
h4 GET
strong /api/release/[slugOrBundleId]
strong /api/release/[slugOrGuid]
ul
li
strong status
Expand Down Expand Up @@ -64,7 +84,7 @@ append content
p Select the archive ZIP for releases
.well
h4 POST
strong /api/release/[slugOrBundleId]
strong /api/release/[slugOrGuid]
ul
li
strong status
Expand Down
4 changes: 2 additions & 2 deletions app/views/games/add.jade
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ append content
.col-sm-9
input.form-control#title(type="text" name="title" data-uri="#slug" required)
.form-group(data-unique="/games/search")
label.col-sm-3.control-label(for="bundleId") Bundle ID
label.col-sm-3.control-label(for="bundleId") GUID
.col-sm-9
input.form-control#bundleId(type="text" placeholder="com.example.MyGame" name="bundleId" required)
input.form-control#bundleId(type="text" name="bundleId" required)
span.yes.glyphicon.glyphicon-ok.form-control-feedback
span.no.glyphicon.glyphicon-remove.form-control-feedback
.form-group(data-unique="/games/search")
Expand Down
2 changes: 1 addition & 1 deletion app/views/games/game.jade
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ append gameContent
h3.panel-title Properties
.panel-body
.row
.col-sm-2: strong Bundle ID
.col-sm-2: strong GUID
.col-sm-10: p
code=game.bundleId
.row
Expand Down
2 changes: 1 addition & 1 deletion app/views/games/modal-edit.jade
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
.col-sm-9
input.form-control#title(type="text" name="title" #{disabled} value=game.title required)
.form-group(data-unique="/games/search" data-ignore=game.bundleId)
label.col-sm-3.control-label(for="bundleId") Bundle
label.col-sm-3.control-label(for="bundleId") GUID
.col-sm-9
input.form-control#bundleId(type="text" name="bundleId" #{disabled} value=game.bundleId required)
span.yes.glyphicon.glyphicon-ok.form-control-feedback
Expand Down
1 change: 1 addition & 0 deletions app/views/games/modal-release.jade
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
input(type="hidden" name="warnUniqueCommit" value="true")
input(type="hidden" name="redirect" value=url)
input(type="hidden" name="token" value=token)
input(type="hidden" name="updatedBy" value=user._id)
button.btn.btn-primary(type="submit") Add Release
|
button.btn.btn-default(type="button" data-dismiss="modal") Cancel
1 change: 1 addition & 0 deletions app/views/games/release.jade
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ append gameContent
include capabilities
.form-group
.col-sm-9.col-sm-offset-3.text-center
input(type="hidden" name="updatedBy" value=user._id)
input(type="hidden" name="release" value=release._id)
button.btn.btn-lg.btn-primary(type="submit" name="action" value="updateRelease") Update
|
Expand Down
5 changes: 4 additions & 1 deletion app/views/games/releases.jade
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ append gameContent
.col-sm-3
if isEditor
form.release-title.text-center(action=url method="post")
input(type="hidden" name="updatedBy" value=user._id)
input(type="hidden" name="release" value=release._id)
input(type="hidden" name="action" value="statusChange")
.btn-group.btn-block
Expand Down Expand Up @@ -77,8 +78,10 @@ append gameContent
h4: strong Commit
a(href="#{game.repository}/commits/#{release.commitId}" data-toggle="tooltip" title="View Commit")=release.commitId.substr(0,7)

.help-block.updated.hidden-xs
.help-block.updated
span Updated
span=moment(release.updated).fromNow()
if release.updatedBy
| by #{release.updatedBy.name}
if release.notes
p!= marked(release.notes)
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "SpringRollConnect",
"version": "1.3.6",
"version": "1.3.7",
"dependencies": {
"jquery": "*",
"bootstrap": "*",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.3.6",
"version": "1.3.7",
"private": true,
"devDependencies": {
"grunt": "^0.4.5",
Expand Down
2 changes: 1 addition & 1 deletion project.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "SpringRollConnect",
"version": "1.3.6",
"version": "1.3.7",
"main": [
"src/plugins/jquery-search.js",
"src/widgets/*.js",
Expand Down

0 comments on commit c5be87f

Please sign in to comment.