Using /db/thang.type instead of /db/thang_type in URLs, for consistency.

This commit is contained in:
Nick Winter 2014-03-11 18:30:25 -07:00
parent 4f9db0a7f7
commit 2b487eeed8
7 changed files with 10 additions and 11 deletions

View file

@ -151,7 +151,7 @@ class CocoModel extends Backbone.Model
return null unless schema.links? return null unless schema.links?
linkObject = _.find schema.links, rel: "db" linkObject = _.find schema.links, rel: "db"
return null unless linkObject return null unless linkObject
return null if linkObject.href.match("thang_type") and not @isObjectID(data) # Skip loading hardcoded Thang Types for now (TODO) return null if linkObject.href.match("thang.type") and not @isObjectID(data) # Skip loading hardcoded Thang Types for now (TODO)
# not fully extensible, but we can worry about that later # not fully extensible, but we can worry about that later
link = linkObject.href link = linkObject.href

View file

@ -112,7 +112,7 @@ module.exports = class Level extends CocoModel
if path.match(/\/systems\/\d+\/config\//) and data?.indieSprites?.length if path.match(/\/systems\/\d+\/config\//) and data?.indieSprites?.length
# Ugh, we need to make sure we grab the IndieSprite ThangTypes # Ugh, we need to make sure we grab the IndieSprite ThangTypes
for indieSprite in data.indieSprites for indieSprite in data.indieSprites
link = "/db/thang_type/#{indieSprite.thangType}/version" link = "/db/thang.type/#{indieSprite.thangType}/version"
model = CocoModel.getOrMakeModelFromLink link, shouldLoadProjection model = CocoModel.getOrMakeModelFromLink link, shouldLoadProjection
models.push model if model models.push model if model
else if path is '/' else if path is '/'

View file

@ -218,8 +218,8 @@ module.exports = class ThangType extends CocoModel
@loadUniversalWizard: -> @loadUniversalWizard: ->
return @wizardType if @wizardType return @wizardType if @wizardType
wizOriginal = "52a00d55cf1818f2be00000b" wizOriginal = "52a00d55cf1818f2be00000b"
url = "/db/thang_type/#{wizOriginal}/version" url = "/db/thang.type/#{wizOriginal}/version"
@wizardType = new module.exports() @wizardType = new module.exports()
@wizardType.url = -> url @wizardType.url = -> url
@wizardType.fetch() @wizardType.fetch()
@wizardType @wizardType

View file

@ -22,7 +22,7 @@ module.exports = class WizardSettingsView extends CocoView
loadWizard: -> loadWizard: ->
@wizardThangType = new ThangType() @wizardThangType = new ThangType()
@wizardThangType.url = -> '/db/thang_type/wizard' @wizardThangType.url = -> '/db/thang.type/wizard'
@wizardThangType.fetch() @wizardThangType.fetch()
@wizardThangType.once 'sync', @initCanvas, @ @wizardThangType.once 'sync', @initCanvas, @
@ -67,7 +67,7 @@ module.exports = class WizardSettingsView extends CocoView
updateSwatchVisibility: (colorGroup) -> updateSwatchVisibility: (colorGroup) ->
enabled = colorGroup.find('.color-group-checkbox').prop('checked') enabled = colorGroup.find('.color-group-checkbox').prop('checked')
colorGroup.find('.minicolors-swatch').toggle Boolean(enabled) colorGroup.find('.minicolors-swatch').toggle Boolean(enabled)
updateColorSettings: (colorGroup) => updateColorSettings: (colorGroup) =>
wizardSettings = _.cloneDeep(me.get('wizard')) or {} wizardSettings = _.cloneDeep(me.get('wizard')) or {}
wizardSettings.colorConfig ?= {} wizardSettings.colorConfig ?= {}
@ -108,4 +108,4 @@ module.exports = class WizardSettingsView extends CocoView
@movieClip.regX = reg.x @movieClip.regX = reg.x
@movieClip.regY = reg.y @movieClip.regY = reg.y
@stage.addChild @movieClip @stage.addChild @movieClip
@stage.update() @stage.update()

View file

@ -19,7 +19,7 @@ componentOriginals =
"physics.Physical" : "524b75ad7fc0f6d519000001" "physics.Physical" : "524b75ad7fc0f6d519000001"
class ThangTypeSearchCollection extends CocoCollection class ThangTypeSearchCollection extends CocoCollection
url: '/db/thang_type/search?project=true' url: '/db/thang.type/search?project=true'
model: ThangType model: ThangType
module.exports = class ThangsTabView extends View module.exports = class ThangsTabView extends View

View file

@ -174,7 +174,7 @@ LevelThangSchema = c.object {
}, },
id: thang # TODO: figure out if we can make this unique and how to set dynamic defaults id: thang # TODO: figure out if we can make this unique and how to set dynamic defaults
# TODO: split thangType into "original" and "majorVersion" like the rest for consistency # TODO: split thangType into "original" and "majorVersion" like the rest for consistency
thangType: c.objectId(links: [{rel: "db", href: "/db/thang_type/{($)}/version"}], title: "Thang Type", description: "A reference to the original Thang template being configured.", format: 'thang-type') thangType: c.objectId(links: [{rel: "db", href: "/db/thang.type/{($)}/version"}], title: "Thang Type", description: "A reference to the original Thang template being configured.", format: 'thang-type')
components: c.array {title: "Components", description: "Thangs are configured by changing the Components attached to them.", uniqueItems: true, format: 'thang-components-array'}, ThangComponentSchema # TODO: uniqueness should be based on "original", not whole thing components: c.array {title: "Components", description: "Thangs are configured by changing the Components attached to them.", uniqueItems: true, format: 'thang-components-array'}, ThangComponentSchema # TODO: uniqueness should be based on "original", not whole thing
LevelSystemSchema = c.object { LevelSystemSchema = c.object {
@ -252,4 +252,3 @@ module.exports = LevelSchema
# 3. tv4.addSchema(metaschema.id, metaschema) # 3. tv4.addSchema(metaschema.id, metaschema)
# 4. S = <paste big schema here> # 4. S = <paste big schema here>
# 5. tv4.validateMultiple(S, metaschema) and look for errors # 5. tv4.validateMultiple(S, metaschema) and look for errors

View file

@ -61,4 +61,4 @@ LevelThangTypeSchema.plugin(plugins.PermissionsPlugin)
LevelThangTypeSchema.plugin(plugins.NamedPlugin) LevelThangTypeSchema.plugin(plugins.NamedPlugin)
LevelThangTypeSchema.plugin(plugins.SearchablePlugin, {searchable: ['name', 'description']}) LevelThangTypeSchema.plugin(plugins.SearchablePlugin, {searchable: ['name', 'description']})
module.exports = LevelThangType = mongoose.model('level.thang_type', LevelThangTypeSchema) module.exports = LevelThangType = mongoose.model('level.thang.type', LevelThangTypeSchema)