Several large refactorings
* Refactor location of all data files to include a subdirectory for the mod version * Update the BaseModel class to allow models to load themselves from any text file (whether JSON or CG) * Refactor ModPack & ModVersion to move the laoding functionality in one into the other (and use the new stuff in BaseModel) * Move the parser versions into a new subdirectory which allows for future additional parsers
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
###
|
||||
Crafting Guide - mod.coffee
|
||||
|
||||
Copyright (c) 2015 by Redwood Labs
|
||||
All rights reserved.
|
||||
###
|
||||
|
||||
BaseModel = require './base_model'
|
||||
|
||||
########################################################################################################################
|
||||
|
||||
module.exports = class Mod extends BaseModel
|
||||
|
||||
constructor: (attributes={}, options={})->
|
||||
if not attributes.name? then throw new Error 'attributes.name is required'
|
||||
attributes.id = attributes.slug = _.slugify attributes.name
|
||||
super attributes, options
|
||||
|
||||
# Backbone.View Overrides ######################################################################
|
||||
|
||||
parse: (response)->
|
||||
|
||||
sync: (method, model, options={})->
|
||||
if method isnt 'read' then throw new Error "Mod data can only be read, not #{method}d"
|
||||
super method, model, options
|
||||
|
||||
url: ->
|
||||
return "/data/#{@slug}/mod.cg"
|
||||
Reference in New Issue
Block a user