mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-05-03 01:14:46 -04:00
Merge branch 'rmarren1-master'
This commit is contained in:
commit
dc7cbb9c35
4 changed files with 14 additions and 2 deletions
app
collections
templates/editor/achievement
views/editor/achievement
server/commons
|
@ -6,4 +6,5 @@ module.exports = class PatchesCollection extends CocoCollection
|
||||||
|
|
||||||
initialize: (models, options, forModel, @status='pending') ->
|
initialize: (models, options, forModel, @status='pending') ->
|
||||||
super(arguments...)
|
super(arguments...)
|
||||||
@url = "#{forModel.urlRoot}/#{forModel.get('original')}/patches?status=#{@status}"
|
identifier = if not forModel.get('original') then '_id' else 'original'
|
||||||
|
@url = "#{forModel.urlRoot}/#{forModel.get(identifier)}/patches?status=#{@status}"
|
||||||
|
|
|
@ -23,6 +23,9 @@ block content
|
||||||
|
|
||||||
#achievement-view.clearfix
|
#achievement-view.clearfix
|
||||||
|
|
||||||
|
h3(data-i18n="resources.patches") Patches
|
||||||
|
.patches-view
|
||||||
|
|
||||||
hr
|
hr
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
|
@ -3,6 +3,7 @@ template = require 'templates/editor/achievement/edit'
|
||||||
Achievement = require 'models/Achievement'
|
Achievement = require 'models/Achievement'
|
||||||
AchievementPopup = require 'views/core/AchievementPopup'
|
AchievementPopup = require 'views/core/AchievementPopup'
|
||||||
ConfirmModal = require 'views/editor/modal/ConfirmModal'
|
ConfirmModal = require 'views/editor/modal/ConfirmModal'
|
||||||
|
PatchesView = require 'views/editor/PatchesView'
|
||||||
errors = require 'core/errors'
|
errors = require 'core/errors'
|
||||||
app = require 'core/application'
|
app = require 'core/application'
|
||||||
nodes = require 'views/editor/level/treema_nodes'
|
nodes = require 'views/editor/level/treema_nodes'
|
||||||
|
@ -57,6 +58,8 @@ module.exports = class AchievementEditView extends RootView
|
||||||
super()
|
super()
|
||||||
return unless @supermodel.finished()
|
return unless @supermodel.finished()
|
||||||
@pushChangesToPreview()
|
@pushChangesToPreview()
|
||||||
|
@patchesView = @insertSubView(new PatchesView(@achievement), @$el.find('.patches-view'))
|
||||||
|
@patchesView.load()
|
||||||
|
|
||||||
pushChangesToPreview: =>
|
pushChangesToPreview: =>
|
||||||
return unless @treema
|
return unless @treema
|
||||||
|
|
|
@ -255,7 +255,12 @@ module.exports = class Handler
|
||||||
res.end()
|
res.end()
|
||||||
|
|
||||||
getPatchesFor: (req, res, id) ->
|
getPatchesFor: (req, res, id) ->
|
||||||
query = { 'target.original': mongoose.Types.ObjectId(id), status: req.query.status or 'pending' }
|
query =
|
||||||
|
$or: [
|
||||||
|
{'target.original': id+''}
|
||||||
|
{'target.original': mongoose.Types.ObjectId(id)}
|
||||||
|
]
|
||||||
|
status: req.query.status or 'pending'
|
||||||
Patch.find(query).sort('-created').exec (err, patches) =>
|
Patch.find(query).sort('-created').exec (err, patches) =>
|
||||||
return @sendDatabaseError(res, err) if err
|
return @sendDatabaseError(res, err) if err
|
||||||
patches = (patch.toObject() for patch in patches)
|
patches = (patch.toObject() for patch in patches)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue