Add better support for turning mods on/off

* Make the Minecraft "mod" enabled at all times
* Sort the list of mods to move required mods to the top
* Automatically enable a mod which has a recipe selected (e.g., from
  a query param)
This commit is contained in:
Andrew Miner
2014-12-29 14:07:57 -08:00
parent 2dd4b7014f
commit c46bb8860c
7 changed files with 45 additions and 8 deletions
@@ -110,10 +110,12 @@ module.exports = class CraftingTableController extends BaseController
_craft: ->
if @model.catalog.hasRecipe @model.name
router.navigate "/item/#{encodeURIComponent(@model.name)}"
@model.craft()
else
router.navigate "/item"
@model.craft()
@refresh()
_updateNameAutocomplete: ->
onChanged = => @onNameFieldChanged()
@@ -6,6 +6,7 @@
###
BaseController = require './base_controller'
{RequiredMods} = require '../constants'
########################################################################################################################
@@ -32,7 +33,13 @@ module.exports = class RecipeBookController extends BaseController
super
refresh: ->
if @model.enabled then @$enabled.attr('checked', 'checked') else @$enabled.removeAttr('checked')
if @model.modName in RequiredMods
@$enabled.attr 'checked', 'checked'
@$enabled.attr 'disabled', 'disabled'
else
@$enabled.removeAttr 'disabled'
if @model.enabled then @$enabled.attr('checked', 'checked') else @$enabled.removeAttr('checked')
@$name.html "#{@model.modName} (#{@model.modVersion})"
@$description.html "#{@model.description}"