mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-04-26 14:03:28 -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') ->
|
||||
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
|
||||
|
||||
h3(data-i18n="resources.patches") Patches
|
||||
.patches-view
|
||||
|
||||
hr
|
||||
|
||||
else
|
||||
|
|
|
@ -3,6 +3,7 @@ template = require 'templates/editor/achievement/edit'
|
|||
Achievement = require 'models/Achievement'
|
||||
AchievementPopup = require 'views/core/AchievementPopup'
|
||||
ConfirmModal = require 'views/editor/modal/ConfirmModal'
|
||||
PatchesView = require 'views/editor/PatchesView'
|
||||
errors = require 'core/errors'
|
||||
app = require 'core/application'
|
||||
nodes = require 'views/editor/level/treema_nodes'
|
||||
|
@ -57,6 +58,8 @@ module.exports = class AchievementEditView extends RootView
|
|||
super()
|
||||
return unless @supermodel.finished()
|
||||
@pushChangesToPreview()
|
||||
@patchesView = @insertSubView(new PatchesView(@achievement), @$el.find('.patches-view'))
|
||||
@patchesView.load()
|
||||
|
||||
pushChangesToPreview: =>
|
||||
return unless @treema
|
||||
|
|
|
@ -255,7 +255,12 @@ module.exports = class Handler
|
|||
res.end()
|
||||
|
||||
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) =>
|
||||
return @sendDatabaseError(res, err) if err
|
||||
patches = (patch.toObject() for patch in patches)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue