mirror of
https://github.com/Dahlgren/arma-server-web-admin.git
synced 2024-08-30 17:22:10 +00:00
Merge pull request #166 from Dahlgren/bugfix/mission-rotation-difficulty
Set default mission rotation difficulty as server difficulty
This commit is contained in:
commit
f5eb892291
@ -62,5 +62,14 @@ module.exports = Backbone.Model.extend({
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
missionDifficulty: function () {
|
||||
var serverDifficulty = this.get('forcedDifficulty')
|
||||
if (serverDifficulty) {
|
||||
return serverDifficulty.toLowerCase()
|
||||
}
|
||||
|
||||
return undefined
|
||||
}
|
||||
})
|
||||
|
@ -35,13 +35,21 @@ module.exports = Marionette.LayoutView.extend({
|
||||
|
||||
var self = this
|
||||
|
||||
this.availableListView = new AvailableListView({ collection: this.missions, filterValue: this.filterValue })
|
||||
this.availableListView = new AvailableListView({
|
||||
collection: this.missions,
|
||||
filterValue: this.filterValue
|
||||
})
|
||||
this.availableListView.on('add', function (model) {
|
||||
self.rotationCollection.add([{
|
||||
difficulty: self.model.missionDifficulty(),
|
||||
name: model.get('name').replace('.pbo', '')
|
||||
}])
|
||||
})
|
||||
this.rotationListView = new RotationListView({ collection: this.rotationCollection })
|
||||
|
||||
this.rotationListView = new RotationListView({
|
||||
collection: this.rotationCollection,
|
||||
server: this.model
|
||||
})
|
||||
},
|
||||
|
||||
onRender: function () {
|
||||
|
@ -14,8 +14,14 @@ module.exports = Marionette.CompositeView.extend({
|
||||
'click .add-mission': 'addMission'
|
||||
},
|
||||
|
||||
initialize: function (options) {
|
||||
this.server = options.server
|
||||
},
|
||||
|
||||
addMission: function (e) {
|
||||
e.preventDefault()
|
||||
this.collection.add(new MissionRotation())
|
||||
this.collection.add(new MissionRotation({
|
||||
difficulty: this.server.missionDifficulty()
|
||||
}))
|
||||
}
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user