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?
linkObject = _.find schema.links, rel: "db"
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
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
# Ugh, we need to make sure we grab the IndieSprite ThangTypes
for indieSprite in data.indieSprites
link = "/db/thang_type/#{indieSprite.thangType}/version"
link = "/db/thang.type/#{indieSprite.thangType}/version"
model = CocoModel.getOrMakeModelFromLink link, shouldLoadProjection
models.push model if model
else if path is '/'

View file

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

View file

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

View file

@ -19,7 +19,7 @@ componentOriginals =
"physics.Physical" : "524b75ad7fc0f6d519000001"
class ThangTypeSearchCollection extends CocoCollection
url: '/db/thang_type/search?project=true'
url: '/db/thang.type/search?project=true'
model: ThangType
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
# 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
LevelSystemSchema = c.object {
@ -252,4 +252,3 @@ module.exports = LevelSchema
# 3. tv4.addSchema(metaschema.id, metaschema)
# 4. S = <paste big schema here>
# 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.SearchablePlugin, {searchable: ['name', 'description']})
module.exports = LevelThangType = mongoose.model('level.thang_type', LevelThangTypeSchema)
module.exports = LevelThangType = mongoose.model('level.thang.type', LevelThangTypeSchema)