Merge branch 'dev/Warn_when_a_depended-on_System_is_missing' of git://github.com/gintau/codecombat into gintau-dev/Warn_when_a_depended-on_System_is_missing

This commit is contained in:
Nick Winter 2014-04-01 09:44:06 -07:00
commit b316a3e078
3 changed files with 15 additions and 1 deletions

View file

@ -3,6 +3,7 @@ template = require 'templates/editor/components/main'
Level = require 'models/Level' Level = require 'models/Level'
LevelComponent = require 'models/LevelComponent' LevelComponent = require 'models/LevelComponent'
LevelSystem = require 'models/LevelSystem'
ComponentsCollection = require 'collections/ComponentsCollection' ComponentsCollection = require 'collections/ComponentsCollection'
ComponentConfigView = require './config' ComponentConfigView = require './config'
@ -157,6 +158,18 @@ module.exports = class ThangComponentEditView extends CocoView
@reportChanges() @reportChanges()
onAddComponentEnterPressed: (node) => onAddComponentEnterPressed: (node) =>
extantSystems =
(@supermodel.getModelByOriginalAndMajorVersion LevelSystem, sn.original, sn.majorVersion).attributes.name.toLowerCase() for idx, sn of @level.get('systems')
requireSystem = node.data.system.toLowerCase()
if requireSystem not in extantSystems
warn_element = 'Component <b>' + node.data.name + '</b> requires system <b>' + requireSystem + '</b> which is currently not specified in this level.'
noty({
text: warn_element,
layout: 'bottomLeft',
type: 'warning'
})
currentSelection = @addComponentsTreema?.getLastSelectedTreema()?.data._id currentSelection = @addComponentsTreema?.getLastSelectedTreema()?.data._id
id = node.data._id id = node.data._id

View file

@ -34,7 +34,7 @@ module.exports = class LevelComponentEditView extends View
schema = _.cloneDeep LevelComponent.schema.attributes schema = _.cloneDeep LevelComponent.schema.attributes
schema.properties = _.pick schema.properties, (value, key) => key in @editableSettings schema.properties = _.pick schema.properties, (value, key) => key in @editableSettings
schema.required = _.intersection schema.required, @editableSettings schema.required = _.intersection schema.required, @editableSettings
treemaOptions = treemaOptions =
supermodel: @supermodel supermodel: @supermodel
schema: schema schema: schema

File diff suppressed because one or more lines are too long