Allow items to be grouped on mod detail pages

This commit is contained in:
Andrew Miner
2015-01-30 13:03:10 -08:00
parent a365217890
commit 6e3843731b
11 changed files with 763 additions and 589 deletions
+21
View File
@@ -21,3 +21,24 @@ All rights reserved.
.error { background: $color-error; }
.error-new { background: $color-error-new; }
.section {
margin-top: 3em;
h2 {
font-family: $font-family-header;
font-size: $font-size-large;
margin-bottom: 0.5em;
}
.panel {
background: white;
padding: 1em;
& > div {
position: relative; width: 33%;
display: inline-block;
padding: 0.5em;
}
}
}
+418 -398
View File
@@ -1,537 +1,557 @@
schema: 1
item: Advanced Crafting Table
recipe:
input: Chest, Crafting Table, Obsidian, Redstone Chipset
pattern: 212 202 232
tools: Crafting Table
group: Builders
item: Architect Table
item: Architect Table
recipe:
input: Blueprint, Crafting Table, Dandelion Yellow, Diamond Gear, Ink Sac, Land Mark
pattern: 454 212 303
tools: Crafting Table
item: Assembly Table
recipe:
input: Diamond, Diamond Gear, Obsidian, Redstone
pattern: 232 202 212
tools: Crafting Table
item: Auto Workbench
recipe:
input: Crafting Table, Wood Gear
pattern: .1. 101 .1.
tools: Crafting Table
item: Basic Gate
recipe:
input: Red Pipe Wire, Redstone Chipset
pattern: ... .1. .0.
tools: Assembly Table, Laser
item: Blue Pipe Wire
recipe:
input: Iron Ingot, Lapis Lazuli, Redstone
pattern: .2. .1. .0.
quantity: 8
tools: Assembly Table, Laser
item: Blueprint
item: Blueprint
recipe:
input: Lapis Lazuli, Paper
pattern: 111 101 111
tools: Crafting Table
item: Blueprint Library
item: Blueprint Library
recipe:
input: Blueprint, Bookshelf
pattern: 000 010 000
tools: Crafting Table
item: Builder
item: Builder
recipe:
input: Chest, Crafting Table, Dandelion Yellow, Diamond Gear, Ink Sac, Land Mark
pattern: 454 212 303
tools: Crafting Table
item: Charging Table
item: Filler
recipe:
input: Gold Gear, Obsidian, Redstone, Redstone Chipset
pattern: 121 131 101
input: Chest, Crafting Table, Dandelion Yellow, Gold Gear, Ink Sac, Land Mark
pattern: 454 212 303
tools: Crafting Table
item: Chute
item: Land Mark
recipe:
input: Chest, Stone Gear, Iron Ingot
pattern: 202 212 .2.
input: Lapis Lazuli, Redstone Torch
pattern: ... .0. .1.
tools: Crafting Table
item: Cobblestone Fluid Pipe
item: Path Mark
recipe:
input: Cactus Green, Redstone Torch
pattern: ... .0. .1.
item: Template
recipe:
input: Ink Sac, Paper
pattern: 111 101 111
tools: Crafting Table
item: Zone Planner
recipe:
input: Diamond Gear, Empty Map, Gold Gear, Iron Ingot, Redstone
pattern: 343 212 303
tools: Crafting Table
group: Energy
item: Combustion Engine
recipe:
input: Glass, Iron Gear, Iron Ingot, Piston
pattern: 222 .0. 131
tools: Crafting Table
item: Redstone Engine
recipe:
input: Glass, Oak Wood Planks, Piston, Wood Gear
pattern: 111 .0. 323
tools: Crafting Table
item: Stirling Engine
recipe:
input: Cobblestone, Glass, Piston, Stone Gear
pattern: 000 .1. 323
tools: Crafting Table
group: Machines
item: Auto Workbench
recipe:
input: Crafting Table, Wood Gear
pattern: .1. 101 .1.
tools: Crafting Table
item: Chute
recipe:
input: Chest, Iron Ingot, Stone Gear
pattern: 101 121 .1.
tools: Crafting Table
item: Filtered Buffer
recipe:
input: Chest, Diamond Transport Pipe, Oak Wood Planks, Piston
pattern: 212 202 232
tools: Crafting Table
item: Flood Gate
recipe:
input: Iron Bars, Iron Gear, Iron Ingot, Tank
pattern: 212 030 202
tools: Crafting Table
item: Mining Well
recipe:
input: Iron Gear, Iron Ingot, Iron Pickaxe, Redstone
pattern: 131 101 121
tools: Crafting Table
item: Pump
recipe:
input: Mining Well, Tank
pattern: ... .1. .0.
item: Quarry
recipe:
input: Diamond Gear, Diamond Pickaxe, Gold Gear, Iron Gear, Redstone
pattern: 343 232 010
tools: Crafting Table
item: Refinery
recipe:
input: Diamond Gear, Redstone Torch, Tank
pattern: ... 121 202
tools: Crafting Table
item: Requester
recipe:
input: Chest, Iron Gear, Iron Ingot, Piston, Redstone
pattern: 232 101 242
tools: Crafting Table
item: Tank
recipe:
input: Glass
pattern: 000 0.0 000
tools: Crafting Table
group: Pipes
item: Cobblestone Structure Pipe
recipe:
input: Cobblestone Transport Pipe, Gravel
pattern: ... .1. .0.
item: Pipe Plug
recipe:
input: Cobblestone Structure Pipe
pattern: ... .0. ...
tools: Assembly Table, Laser
item: Pipe Sealant
recipe:
input: Cactus Green
pattern: ... .0. ...
group: Pipes - Fluid
item: Cobblestone Fluid Pipe
recipe:
input: Cobblestone Transport Pipe, Pipe Sealant
pattern: ... .0. .1.
item: Stone Gear
item: Diamond Fluid Pipe
recipe:
input: Cobblestone, Wood Gear
pattern: .0. 010 .0.
tools: Crafting Table
input: Diamond Transport Pipe, Pipe Sealant
pattern: ... .0. .1.
item: Cobblestone Kinesis Pipe
item: Emerald Fluid Pipe
recipe:
input: Emerald Transport Pipe, Pipe Sealant
pattern: ... .0. .1.
item: Golden Fluid Pipe
recipe:
input: Golden Transport Pipe, Pipe Sealant
pattern: ... .0. .1.
item: Iron Fluid Pipe
recipe:
input: Iron Transport Pipe, Pipe Sealant
pattern: ... .0. .1.
item: Sandstone Fluid Pipe
recipe:
input: Pipe Sealant, Sandstone Transport Pipe
pattern: ... .1. .0.
item: Stone Fluid Pipe
recipe:
input: Pipe Sealant, Stone Transport Pipe
pattern: ... .1. .0.
item: Void Fluid Pipe
recipe:
input: Pipe Sealant, Void Transport Pipe
pattern: ... .1. .0.
item: Wooden Fluid Pipe
recipe:
input: Pipe Sealant, Wooden Transport Pipe
pattern: ... .1. .0.
group: Pipes - Kinesis
item: Cobblestone Kinesis Pipe
recipe:
input: Cobblestone Transport Pipe, Redstone
pattern: ... .0. .1.
item: Cobblestone Transport Pipe
item: Diamond Kinesis Pipe
recipe:
input: Diamond Transport Pipe, Redstone
pattern: ... .0. .1.
item: Emerald Kinesis Pipe
recipe:
input: Emerald Transport Pipe, Redstone
pattern: ... .1. .0.
item: Golden Kinesis Pipe
recipe:
input: Golden Transport Pipe, Redstone
pattern: ... .0. .1.
item: Iron Kinesis Pipe
recipe:
input: Iron Transport Pipe, Redstone
pattern: ... .0. .1.
item: Quartz Kinesis Pipe
recipe:
input: Quartz Transport Pipe, Redstone
pattern: ... .0. .1.
item: Stone Kinesis Pipe
recipe:
input: Redstone, Stone Transport Pipe
pattern: ... .1. .0.
item: Wooden Kinesis Pipe
recipe:
input: Redstone, Wooden Transport Pipe
pattern: ... .1. .0.
group: Pipes - Transport
item: Cobblestone Transport Pipe
recipe:
input: Cobblestone, Glass
pattern: ... 010 ...
quantity: 8
tools: Crafting Table
item: Combustion Engine
recipe:
input: Glass, Iron Gear, Iron Ingot, Piston
pattern: 222 .0. 131
tools: Crafting Table
item: Daizuli Transport Pipe
item: Daizuli Transport Pipe
recipe:
input: Diamond, Glass, Lapis Lazuli Block
pattern: ... 021 ...
quantity: 8
tools: Crafting Table
item: Diamond AND Gate
recipe:
input: Blue Pipe Wire, Diamond Chipset, Green Pipe Wire, Red Pipe Wire, Yellow Pipe Wire
pattern: 1.. 34. 02.
tools: Assembly Table, Laser
item: Diamond Chipset
recipe:
input: Diamond, Redstone
pattern: ... .0. .1.
tools: Assembly Table, Laser
item: Diamond Fluid Pipe
recipe:
input: Diamond Transport Pipe, Pipe Sealant
pattern: ... .0. .1.
item: Diamond Gear
recipe:
input: Diamond, Gold Gear
pattern: .0. 010 .0.
tools: Crafting Table
item: Diamond Kinesis Pipe
recipe:
input: Diamond Transport Pipe, Redstone
pattern: ... .0. .1.
item: Diamond OR Gate
recipe:
input: Blue Pipe Wire, Diamond Chipset, Green Pipe Wire, Red Pipe Wire, Yellow Pipe Wire
pattern: 1.. 34. 02.
tools: Assembly Table, Laser
item: Diamond Transport Pipe
item: Diamond Transport Pipe
recipe:
input: Diamond, Glass
pattern: ... 010 ...
tools: Crafting Table
item: Docking Station
recipe:
input: Golden Chipset, Iron Ingot
pattern: ... .1. 101
tools: Crafting Table
item: Emerald Chipset
recipe:
input: Emerald, Redstone
pattern: ... .0. .1.
tools: Assembly Table, Laser
item: Emerald Fluid Pipe
recipe:
input: Emerald Transport Pipe, Pipe Sealant
pattern: ... .0. .1.
item: Emerald Kinesis Pipe
recipe:
input: Emerald Transport Pipe, Redstone
pattern: ... .1. .0.
item: Emerald Transport Pipe
item: Emerald Transport Pipe
recipe:
input: Emerald, Glass
pattern: ... 010 ...
quantity: 8
tools: Crafting Table
item: Emzuli Transport Pipe
item: Emzuli Transport Pipe
recipe:
input: Emerald, Glass, Lapis Lazuli Block
pattern: ... 021 ...
quantity: 8
tools: Crafting Table
item: Facade (stone)
recipe:
input: Cobblestone Structure Pipe, Stone
pattern: ... .1. 000
tools: Assembly Table, Laser
item: Filler
recipe:
input: Chest, Crafting Table, Dandelion Yellow, Gold Gear, Ink Sac, Land Mark
pattern: 454 212 303
tools: Crafting Table
item: Filtered Buffer
recipe:
input: Chest, Diamond Transport Pipe, Oak Wood Planks, Piston
pattern: 212 202 232
tools: Crafting Table
item: Flood Gate
recipe:
input: Iron Bars, Iron Gear, Iron Ingot, Tank
pattern: 212 030 202
tools: Crafting Table
item: Gate Copier
recipe:
input: Redstone Chipset, Wrench
pattern: ... .0. .1.
item: Gold AND Gate
recipe:
input: Blue Pipe Wire, Golden Chipset, Red Pipe Wire
pattern: 1.. 20. ...
tools: Assembly Table, Laser
item: Golden Chipset
recipe:
input: Gold Ingot, Redstone
pattern: ... .0. .1.
tools: Assembly Table, Laser
item: Gold Gear
recipe:
input: Gold Ingot, Iron Gear
pattern: .0. 010 .0.
tools: Crafting Table
item: Gold OR Gate
recipe:
input: Blue Pipe Wire, Golden Chipset, Red Pipe Wire
pattern: 1.. 20. ...
tools: Assembly Table, Laser
item: Golden Fluid Pipe
recipe:
input: Golden Transport Pipe, Pipe Sealant
pattern: ... .0. .1.
item: Golden Kinesis Pipe
recipe:
input: Golden Transport Pipe, Redstone
pattern: ... .0. .1.
item: Golden Transport Pipe
item: Golden Transport Pipe
recipe:
input: Glass, Gold Ingot
pattern: ... 101 ...
quantity: 8
tools: Crafting Table
item: Green Pipe Wire
recipe:
input: Cactus Green, Iron Ingot, Redstone
pattern: .0. .2. .1.
quantity: 8
tools: Assembly Table, Laser
item: Integration Table
recipe:
input: Diamond Gear, Obsidian, Redstone, Redstone Chipset
pattern: 121 131 101
tools: Crafting Table
item: Iron AND Gate
recipe:
input: Iron Chipset, Red Pipe Wire
pattern: 0.. 1.. ...
tools: Assembly Table, Laser
item: Iron Chipset
recipe:
input: Iron Ingot, Redstone
pattern: ... .0. .1.
tools: Assembly Table, Laser
item: Iron Fluid Pipe
recipe:
input: Iron Transport Pipe, Pipe Sealant
pattern: ... .0. .1.
item: Iron Gear
recipe:
input: Stone Gear, Iron Ingot
pattern: .1. 101 .1.
tools: Crafting Table
item: Iron Kinesis Pipe
recipe:
input: Iron Transport Pipe, Redstone
pattern: ... .0. .1.
item: Iron OR Gate
recipe:
input: Iron Chipset, Red Pipe Wire
pattern: 0.. 1.. ...
tools: Assembly Table, Laser
item: Iron Transport Pipe
item: Iron Transport Pipe
recipe:
input: Glass, Iron Ingot
pattern: ... 101 ...
quantity: 8
tools: Crafting Table
item: Land Mark
recipe:
input: Lapis Lazuli, Redstone Torch
pattern: ... .0. .1.
tools: Crafting Table
item: Laser
recipe:
input: Diamond, Obsidian, Redstone
pattern: 122 002 122
tools: Crafting Table
item: Lazuli Transport Pipe
item: Lazuli Transport Pipe
recipe:
input: Glass, Lapis Lazuli Block
pattern: ... 101 ...
quantity: 8
tools: Crafting Table
item: Mining Well
recipe:
input: Iron Gear, Iron Ingot, Iron Pickaxe, Redstone
pattern: 131 101 121
tools: Crafting Table
item: Obsidian Transport Pipe
item: Obsidian Transport Pipe
recipe:
input: Glass, Obsidian
pattern: ... 101 ...
quantity: 8
tools: Crafting Table
item: Path Mark
recipe:
input: Cactus Green, Redstone Torch
pattern: ... .0. .1.
item: Pipe Plug
recipe:
input: Cobblestone Structure Pipe
pattern: ... .0. ...
tools: Assembly Table, Laser
item: Pipe Sealant
recipe:
input: Cactus Green
pattern: ... .0. ...
item: Pulsating Chipset
recipe:
input: Ender Pearl, Redstone
pattern: ... .0. .1.
tools: Assembly Table, Laser
item: Pump
recipe:
input: Mining Well, Tank
pattern: ... .1. .0.
item: Quarry
recipe:
input: Diamond Gear, Diamond Pickaxe, Gold Gear, Iron Gear, Redstone
pattern: 343 232 010
tools: Crafting Table
item: Quartz Chipset
recipe:
input: Nether Quartz, Redstone
pattern: ... .0. .1.
tools: Assembly Table, Laser
item: Quartz Kinesis Pipe
recipe:
input: Quartz Transport Pipe, Redstone
pattern: ... .0. .1.
item: Quartz Transport Pipe
item: Quartz Transport Pipe
recipe:
input: Block of Quartz, Glass
pattern: ... 010 ...
quantity: 8
tools: Crafting Table
item: Red Pipe Wire
recipe:
input: Iron Ingot, Redstone, Rose Red
pattern: .2. .1. .0.
quantity: 8
tools: Assembly Table, Laser
item: Redstone Chipset
recipe:
input: Redstone
pattern: ... .0. ...
tools: Assembly Table, Laser
item: Redstone Comp Chipset
recipe:
input: Redstone, Redstone Comparator
pattern: ... .1. .0.
tools: Assembly Table, Laser
item: Redstone Engine
recipe:
input: Glass, Oak Wood Planks, Piston, Wood Gear
pattern: 111 .0. 323
tools: Crafting Table
item: Refinery
recipe:
input: Diamond Gear, Redstone Torch, Tank
pattern: ... 121 202
tools: Crafting Table
item: Requester
recipe:
input: Chest, Iron Gear, Iron Ingot, Piston, Redstone
pattern: 232 101 242
tools: Crafting Table
item: Sandstone Fluid Pipe
recipe:
input: Pipe Sealant, Sandstone Transport Pipe
pattern: ... .1. .0.
item: Sandstone Transport Pipe
item: Sandstone Transport Pipe
recipe:
input: Glass, Sandstone
pattern: ... 101 ...
quantity: 8
tools: Crafting Table
item: Stirling Engine
recipe:
input: Cobblestone, Stone Gear, Glass, Piston
pattern: 000 .2. 131
tools: Crafting Table
item: Stone Fluid Pipe
recipe:
input: Pipe Sealant, Stone Transport Pipe
pattern: ... .1. .0.
item: Stone Kinesis Pipe
recipe:
input: Redstone, Stone Transport Pipe
pattern: ... .1. .0.
item: Stone Transport Pipe
item: Stone Transport Pipe
recipe:
input: Glass, Stone
pattern: ... 101 ...
quantity: 8
tools: Crafting Table
item: Stripes Transport Pipe
item: Stripes Transport Pipe
recipe:
input: Glass, Gold Gear
pattern: ... 101 ...
quantity: 8
tools: Crafting Table
item: Cobblestone Structure Pipe
recipe:
input: Cobblestone Transport Pipe, Gravel
pattern: ... .1. .0.
item: Tank
recipe:
input: Glass
pattern: 000 0.0 000
tools: Crafting Table
item: Template
recipe:
input: Ink Sac, Paper
pattern: 111 101 111
tools: Crafting Table
item: Void Fluid Pipe
recipe:
input: Pipe Sealant, Void Transport Pipe
pattern: ... .1. .0.
item: Void Transport Pipe
item: Void Transport Pipe
recipe:
input: Glass, Ink Sac, Redstone
pattern: ... 102 ...
quantity: 8
tools: Crafting Table
item: Wooden Fluid Pipe
recipe:
input: Pipe Sealant, Wooden Transport Pipe
pattern: ... .1. .0.
item: Wood Gear
recipe:
input: Stick
pattern: .0. 0.0 .0.
tools: Crafting Table
item: Wooden Kinesis Pipe
recipe:
input: Redstone, Wooden Transport Pipe
pattern: ... .1. .0.
item: Wooden Transport Pipe
item: Wooden Transport Pipe
recipe:
input: Glass, Oak Wood Planks
pattern: ... 101 ...
quantity: 8
tools: Crafting Table
item: Wrench
group: Robots
item: Charging Table
recipe:
input: Stone Gear, Iron Ingot
pattern: 1.1 .0. .1.
input: Gold Gear, Obsidian, Redstone, Redstone Chipset
pattern: 121 131 101
tools: Crafting Table
item: Yellow Pipe Wire
item: Docking Station
recipe:
input: Golden Chipset, Iron Ingot
pattern: ... .1. 101
tools: Crafting Table
group: Silicon
item: Advanced Crafting Table
recipe:
input: Chest, Crafting Table, Obsidian, Redstone Chipset
pattern: 212 202 232
tools: Crafting Table
item: Assembly Table
recipe:
input: Diamond, Diamond Gear, Obsidian, Redstone
pattern: 232 202 212
tools: Crafting Table
item: Basic Gate
recipe:
input: Red Pipe Wire, Redstone Chipset
pattern: ... .1. .0.
tools: Assembly Table, Laser
item: Blue Pipe Wire
recipe:
input: Iron Ingot, Lapis Lazuli, Redstone
pattern: .2. .1. .0.
quantity: 8
tools: Assembly Table, Laser
item: Diamond AND Gate
recipe:
input: Blue Pipe Wire, Diamond Chipset, Green Pipe Wire, Red Pipe Wire, Yellow Pipe Wire
pattern: 1.. 34. 02.
tools: Assembly Table, Laser
item: Diamond Chipset
recipe:
input: Diamond, Redstone
pattern: ... .0. .1.
tools: Assembly Table, Laser
item: Diamond OR Gate
recipe:
input: Blue Pipe Wire, Diamond Chipset, Green Pipe Wire, Red Pipe Wire, Yellow Pipe Wire
pattern: 1.. 34. 02.
tools: Assembly Table, Laser
item: Emerald Chipset
recipe:
input: Emerald, Redstone
pattern: ... .0. .1.
tools: Assembly Table, Laser
item: Facade (stone)
recipe:
input: Cobblestone Structure Pipe, Stone
pattern: ... .1. 000
tools: Assembly Table, Laser
item: Gate Copier
recipe:
input: Redstone Chipset, Wrench
pattern: ... .0. .1.
item: Gold AND Gate
recipe:
input: Blue Pipe Wire, Golden Chipset, Red Pipe Wire
pattern: 1.. 20. ...
tools: Assembly Table, Laser
item: Gold OR Gate
recipe:
input: Blue Pipe Wire, Golden Chipset, Red Pipe Wire
pattern: 1.. 20. ...
tools: Assembly Table, Laser
item: Golden Chipset
recipe:
input: Gold Ingot, Redstone
pattern: ... .0. .1.
tools: Assembly Table, Laser
item: Green Pipe Wire
recipe:
input: Cactus Green, Iron Ingot, Redstone
pattern: .0. .2. .1.
quantity: 8
tools: Assembly Table, Laser
item: Integration Table
recipe:
input: Diamond Gear, Obsidian, Redstone, Redstone Chipset
pattern: 121 131 101
tools: Crafting Table
item: Iron AND Gate
recipe:
input: Iron Chipset, Red Pipe Wire
pattern: 0.. 1.. ...
tools: Assembly Table, Laser
item: Iron Chipset
recipe:
input: Iron Ingot, Redstone
pattern: ... .0. .1.
tools: Assembly Table, Laser
item: Iron OR Gate
recipe:
input: Iron Chipset, Red Pipe Wire
pattern: 0.. 1.. ...
tools: Assembly Table, Laser
item: Laser
recipe:
input: Diamond, Obsidian, Redstone
pattern: 122 002 122
tools: Crafting Table
item: Pulsating Chipset
recipe:
input: Ender Pearl, Redstone
pattern: ... .0. .1.
tools: Assembly Table, Laser
item: Quartz Chipset
recipe:
input: Nether Quartz, Redstone
pattern: ... .0. .1.
tools: Assembly Table, Laser
item: Red Pipe Wire
recipe:
input: Iron Ingot, Redstone, Rose Red
pattern: .2. .1. .0.
quantity: 8
tools: Assembly Table, Laser
item: Redstone Chipset
recipe:
input: Redstone
pattern: ... .0. ...
tools: Assembly Table, Laser
item: Redstone Comp Chipset
recipe:
input: Redstone, Redstone Comparator
pattern: ... .1. .0.
tools: Assembly Table, Laser
item: Yellow Pipe Wire
recipe:
input: Dandelion Yellow, Iron Ingot, Redstone
pattern: .0. .2. .1.
quantity: 8
tools: Assembly Table, Laser
item: Zone Planner
group: Tools and Materials
item: Diamond Gear
recipe:
input: Diamond Gear, Empty Map, Gold Gear, Iron Ingot, Redstone
pattern: 343 212 303
input: Diamond, Gold Gear
pattern: .0. 010 .0.
tools: Crafting Table
item: Gold Gear
recipe:
input: Gold Ingot, Iron Gear
pattern: .0. 010 .0.
tools: Crafting Table
item: Iron Gear
recipe:
input: Iron Ingot, Stone Gear
pattern: .0. 010 .0.
tools: Crafting Table
item: Stone Gear
recipe:
input: Cobblestone, Wood Gear
pattern: .0. 010 .0.
tools: Crafting Table
item: Wood Gear
recipe:
input: Stick
pattern: .0. 0.0 .0.
tools: Crafting Table
item: Wrench
recipe:
input: Iron Ingot, Stone Gear
pattern: 0.0 .1. .0.
tools: Crafting Table
@@ -0,0 +1,70 @@
###
Crafting Guide - item_group_controller.coffee
Copyright (c) 2015 by Redwood Labs
All rights reserved.
###
BaseController = require './base_controller'
{Duration} = require '../constants'
{Event} = require '../constants'
Item = require '../models/item'
ItemController = require './item_controller'
########################################################################################################################
module.exports = class ItemGroupController extends BaseController
constructor: (options={})->
if not options.model? then throw new Error 'options.model is required'
if not options.modPack? then throw new Error 'options.modPack is required'
if not options.modVersion? then throw new Error 'options.modVersion is required'
options.templateName = 'item_group'
super options
@modVersion = options.modVersion
@_modPack = options.modPack
@_itemControllers = []
@modVersion.on Event.change, => @refresh()
# BaseController Overrides #####################################################################
onDidRender: ->
@$title = @$('h2')
@$items = @$('.panel')
super
refresh: ->
@$title.html if @model is Item.Group.Other then 'Items' else @model
@_refreshItems()
super
# Private Methods ##############################################################################
_createItemController: (item)->
controller = new ItemController model:item, modPack:@_modPack
controller.$el.hide()
controller.render()
@_itemControllers.push controller
@$items.append controller.$el
controller.$el.slideDown duration:Duration.fast
_refreshItems: ->
controllerIndex = 0
delay = 0
@modVersion.eachItemInGroup @model, (item)=>
controller = @_itemControllers[controllerIndex]
if not controller?
_.delay (=> @_createItemController item), delay
delay += @_delayStep
else
controller.model = item
controller.refresh()
controllerIndex += 1
while @_itemControllers.length > controllerIndex
controller = @_itemControllers.pop()
controller.$el.slideUp duration:Duration.fast, complete:-> @remove()
@@ -9,7 +9,7 @@ BaseController = require './base_controller'
{Duration} = require '../constants'
Mod = require '../models/mod'
ModPack = require '../models/mod_pack'
ItemController = require './item_controller'
ItemGroupController = require './item_group_controller'
{Url} = require '../constants'
########################################################################################################################
@@ -24,7 +24,7 @@ module.exports = class ModPageController extends BaseController
@_delayStep = options.delayStep
@_effectiveModVersion = null
@_itemControllers = []
@_groupControllers = []
@_modPack = options.modPack
Object.defineProperties this,
@@ -48,7 +48,7 @@ module.exports = class ModPageController extends BaseController
@$documentationLink = @$('.documentation')
@$downloadLink = @$('.download')
@$homePageLink = @$('.homePage')
@$items = @$('.items .panel')
@$groupContainer = @$('.itemGroups')
@$titleImage = @$('.titleImage img')
@$versionSelector = @$('select.version')
@@ -64,7 +64,7 @@ module.exports = class ModPageController extends BaseController
@_refreshLink @$documentationLink, @model.documentationUrl
@_refreshLink @$downloadLink, @model.downloadUrl
@_refreshItems()
@_refreshItemGroups()
@_refreshVersions()
super
@@ -75,15 +75,6 @@ module.exports = class ModPageController extends BaseController
# Private Methods ##############################################################################
_createItemController: (item)->
controller = new ItemController model:item, modPack:@_modPack
controller.$el.hide()
controller.render()
@_itemControllers.push controller
@$items.append controller.$el
controller.$el.fadeIn duration:Duration.fast
_getEffectiveModVersion: ->
return @_effectiveModVersion if @_effectiveModVersion?
return null unless @model?
@@ -94,6 +85,26 @@ module.exports = class ModPageController extends BaseController
return modVersion
_refreshItemGroups: ->
groupIndex = 0
modVersion = @effectiveModVersion
modVersion.eachGroup (group)=>
controller = @_groupControllers[groupIndex]
if not controller?
controller = new ItemGroupController model:group, modVersion:modVersion, modPack:@_modPack
controller.render()
@$groupContainer.append controller.$el
@_groupControllers[groupIndex] = controller
else
controller.modVersion = modVersion
controller.model = group
controller.refresh()
groupIndex++
while @_groupControllers.length > groupIndex + 1
controller = @_groupControllers.pop()
controller.$el.slideUp duration:Duration.fast, -> @remove()
_refreshLink: ($link, url)->
if url?
$link.fadeIn duration:Duration.fast
@@ -101,28 +112,6 @@ module.exports = class ModPageController extends BaseController
else
$link.fadeOut duration:Duration.fast
_refreshItems: ->
controllerIndex = 0
delay = 0
effectiveModVersion = @effectiveModVersion
if effectiveModVersion?
@$items.show duration:Duration.fast
effectiveModVersion.eachItem (item)=>
controller = @_itemControllers[controllerIndex]
if not controller?
_.delay (=> @_createItemController item), delay
delay += @_delayStep
else
controller.model = item
controllerIndex += 1
else
@$items.hide duration:Duration.fast
while @_itemControllers.length > controllerIndex
controller = @_itemControllers.pop()
controller.$el.slideUp duration:Duration.fast, complete:-> @remove()
_refreshVersions: ->
@$versionSelector.empty()
return unless @model?
+1 -1
View File
@@ -24,7 +24,7 @@ global.logger = new Logger
switch window.location.hostname
when 'localhost'
global.env = 'development'
logger.level = Logger.INFO
logger.level = Logger.DEBUG
when 'new.crafting-guide.com'
global.env = 'staging'
logger.level = Logger.VERBOSE
+3
View File
@@ -14,9 +14,12 @@ Recipe = require './recipe'
module.exports = class Item extends BaseModel
@Group = Other:'Other'
constructor: (attributes={}, options={})->
if not attributes.name? then throw new Error 'attributes.name is required'
attributes.group ?= Item.Group.Other
attributes.isGatherable ?= false
attributes.slug ?= _.slugify attributes.name
options.logEvents ?= false
+15
View File
@@ -21,6 +21,7 @@ module.exports = class ModVersion extends BaseModel
if not attributes.version? then throw new Error 'attributes.version is required'
super attributes, options
@_groups = {}
@_items = {}
@_names = {}
@_slugs = []
@@ -31,6 +32,9 @@ module.exports = class ModVersion extends BaseModel
if @_items[item.slug]? then throw new Error "duplicate item for #{item.name}"
@_items[item.slug] = item
@_groups[item.group] ?= {}
@_groups[item.group][item.slug] = item
item.modVersion = this
@registerSlug item.slug, item.name
return this
@@ -44,6 +48,10 @@ module.exports = class ModVersion extends BaseModel
return 0
eachGroup: (callback)->
for groupName in _.keys(@_groups).sort()
callback groupName
eachItem: (callback)->
for slug in @_slugs
item = @_items[slug]
@@ -51,6 +59,13 @@ module.exports = class ModVersion extends BaseModel
callback @_items[slug], slug
return this
eachItemInGroup: (group, callback)->
group = @_groups[group]
return unless group?
for slug in _.keys(group).sort()
callback group[slug]
eachName: (callback)->
for slug in @_slugs
callback @_names[slug], slug
@@ -53,10 +53,14 @@ module.exports = class ModVersionParserV1 extends CommandParserVersionBase
@_itemData.gatherable = (gatherable is 'yes')
_command_group: (group)->
if group.length is 0 then throw new Error 'a group name cannot be empty'
@_rawData.group = group
_command_item: (name='')->
if not name.length > 0 then throw new Error 'the item name cannot be empty'
@_itemData = name:name, line:@_lineNumber
@_itemData = name:name, line:@_lineNumber, group:@_rawData.group
@_rawData.items ?= []
@_rawData.items.push @_itemData
@@ -118,7 +122,7 @@ module.exports = class ModVersionParserV1 extends CommandParserVersionBase
itemData.gatherable ?= false
itemData.recipes ?= []
item = new Item name:itemData.name, isGatherable:itemData.gatherable
item = new Item name:itemData.name, isGatherable:itemData.gatherable, group:itemData.group
modVersion.addItem item
for recipeData in itemData.recipes
@@ -186,9 +190,23 @@ module.exports = class ModVersionParserV1 extends CommandParserVersionBase
builder
.line 'schema: ', 1
.line()
.onlyIf itemList.length > 0, =>
builder.loop itemList, delimiter:'\n', onEach:(b, i)=> @_unparseItem(b, i)
.outdent()
modVersion.eachGroup (group)=>
@_unparseGroup builder, modVersion, group
_unparseGroup: (builder, modVersion, group)->
if group isnt Item.Group.Other
builder
.line 'group: ', group
.line()
.indent()
modVersion.eachItemInGroup group, (item)=>
@_unparseItem builder, item
builder.line()
if group isnt Item.Group.Other
builder.outdent()
_unparseItem: (builder, item)->
recipes = []
+10
View File
@@ -0,0 +1,10 @@
//-
//- Crafting Guide - item_group.jade
//-
//- Copyright (c) 2015 by Redwood Labs
//- All rights reserved.
//-
.view__item_group.section
h2
.panel
+1 -3
View File
@@ -18,6 +18,4 @@
.byline: p
.description: p
.section.items
h2 Items
.panel
.itemGroups
+31 -1
View File
@@ -16,7 +16,13 @@ modVersion = null
describe 'mod_version.coffee', ->
beforeEach -> modVersion = new ModVersion modSlug:'test', version:'0.0'
beforeEach ->
modVersion = new ModVersion modSlug:'test', version:'0.0'
modVersion.addItem new Item name:'underscore', group:'punctuation'
modVersion.addItem new Item name:'bravo', group:'letter'
modVersion.addItem new Item name:'alpha', group:'letter'
modVersion.addItem new Item name:'one', group:'number'
modVersion.addItem new Item name:'two', group:'number'
describe 'constructor', ->
@@ -40,6 +46,30 @@ describe 'mod_version.coffee', ->
modVersion.addItem new Item name:'Wool'
modVersion._items.wool.modVersion.should.equal modVersion
describe 'eachGroup', ->
it 'returns all the groups in order', ->
groupNames = []
modVersion.eachGroup (groupName)-> groupNames.push groupName
groupNames.should.eql ['letter', 'number', 'punctuation']
describe 'eachItemInGroup', ->
it 'returns immediately for unknown group', ->
slugs = []
modVersion.eachItemInGroup 'foobar', (item)-> slugs.push item.slug
slugs.should.eql []
it 'calls callback for exactly the items in a group in order', ->
slugs = []
modVersion.eachItemInGroup 'letter', (item)-> slugs.push item.slug
slugs.should.eql ['alpha', 'bravo']
slugs = []
modVersion.eachItemInGroup 'number', (item)-> slugs.push item.slug
slugs.should.eql ['one', 'two']
describe 'findItemByName', ->
it 'locates items by slugified name', ->