Show all recipes for an item on its detail page
This commit is contained in:
@@ -6,6 +6,8 @@ All rights reserved.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
.view__full_recipe {
|
.view__full_recipe {
|
||||||
|
display: block;
|
||||||
|
|
||||||
& > div {
|
& > div {
|
||||||
position: relative; width: 33%;
|
position: relative; width: 33%;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
|||||||
@@ -57,11 +57,16 @@ All rights reserved.
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.recipe {
|
.recipes {
|
||||||
display: none;
|
display: none;
|
||||||
|
|
||||||
.view__full_recipe {
|
.view__full_recipe {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
margin-top: 3em;
|
||||||
|
|
||||||
|
&:first-child {
|
||||||
|
margin-top: 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -47,3 +47,20 @@ I just pushed up a big new feature! Now, each Mod has a dedicated page of its o
|
|||||||
in that mod. Clicking on an item will take you to the crafting guide for that item. It's super fast to switch back and
|
in that mod. Clicking on an item will take you to the crafting guide for that item. It's super fast to switch back and
|
||||||
forth to explore the items in any given mod. This is the first of many steps for the new mod pages, so keep an eye out
|
forth to explore the items in any given mod. This is the first of many steps for the new mod pages, so keep an eye out
|
||||||
for more to come!
|
for more to come!
|
||||||
|
|
||||||
|
########################################################################################################################
|
||||||
|
|
||||||
|
|
||||||
|
I've been working on a project to make it easier to deal with complex recipes, and I recently finished adding all the
|
||||||
|
core Minecraft recipes. The gist of the site is that you tell it what item(s) you want to make, and it will figure out
|
||||||
|
all the raw ingredients you need along with step-by-step instructions for any number of whatever items you like. For
|
||||||
|
example, [http://crafting-guide.com/crafting/16.potion_of_fire_resistance_8_00:16.potion_of_healing_ii here's how you
|
||||||
|
make] 16 potions of healing II and fire resistance (with extended duration).
|
||||||
|
|
||||||
|
The maintainers of many of the mods I've added (e.g., BuildCraft / Applied Energistics) have found it useful to include
|
||||||
|
links to Crafting Guide in their official documentation, and I was hoping you would think it a good idea to add links
|
||||||
|
from this wiki to CraftingGuide as well. I'd be happy to do the work of adding the links myself, but I'd like to make
|
||||||
|
sure there are no objections first!
|
||||||
|
|
||||||
|
Thanks!
|
||||||
|
~~~~
|
||||||
@@ -38,17 +38,17 @@ module.exports = class ItemPageController extends BaseController
|
|||||||
# BaseController Overrides #####################################################################
|
# BaseController Overrides #####################################################################
|
||||||
|
|
||||||
onDidRender: ->
|
onDidRender: ->
|
||||||
@_recipeController = @addChild FullRecipeController, '.view__full_recipe', modPack:@_modPack
|
|
||||||
@_similarItemsController = @addChild ItemGroupController, '.similar .view__item_group', modPack:@_modPack
|
@_similarItemsController = @addChild ItemGroupController, '.similar .view__item_group', modPack:@_modPack
|
||||||
@_usedInMakingController = @addChild ItemGroupController, '.usedInMaking .view__item_group', modPack:@_modPack
|
@_usedInMakingController = @addChild ItemGroupController, '.usedInMaking .view__item_group', modPack:@_modPack
|
||||||
|
|
||||||
@$byline = @$('.byline')
|
@$byline = @$('.byline')
|
||||||
@$bylineLink = @$('.byline a')
|
@$bylineLink = @$('.byline a')
|
||||||
@$usedInMakingContainer = @$('.usedInMaking')
|
|
||||||
@$name = @$('h1.name')
|
@$name = @$('h1.name')
|
||||||
@$recipeContainer = @$('.recipe')
|
@$recipeContainer = @$('.recipes .panel')
|
||||||
|
@$recipesSection = @$('.recipes')
|
||||||
@$similarContainer = @$('.similar')
|
@$similarContainer = @$('.similar')
|
||||||
@$titleImage = @$('.titleImage img')
|
@$titleImage = @$('.titleImage img')
|
||||||
|
@$usedInMakingContainer = @$('.usedInMaking')
|
||||||
super
|
super
|
||||||
|
|
||||||
refresh: ->
|
refresh: ->
|
||||||
@@ -63,7 +63,7 @@ module.exports = class ItemPageController extends BaseController
|
|||||||
@$name.html ''
|
@$name.html ''
|
||||||
|
|
||||||
@_refreshByline()
|
@_refreshByline()
|
||||||
@_refreshRecipe()
|
@_refreshRecipes()
|
||||||
@_refreshSimilarItems()
|
@_refreshSimilarItems()
|
||||||
@_refreshComponentIn()
|
@_refreshComponentIn()
|
||||||
|
|
||||||
@@ -89,12 +89,32 @@ module.exports = class ItemPageController extends BaseController
|
|||||||
else
|
else
|
||||||
@$usedInMakingContainer.fadeOut duration:Duration.fast
|
@$usedInMakingContainer.fadeOut duration:Duration.fast
|
||||||
|
|
||||||
_refreshRecipe: ->
|
_refreshRecipes: ->
|
||||||
@_recipeController.model = @model.primaryRecipe
|
@_recipeControllers ?= []
|
||||||
if @_recipeController.model?
|
index = 0
|
||||||
@$recipeContainer.fadeIn duration:Duration.fast
|
|
||||||
|
recipes = @model.findRecipes()
|
||||||
|
if recipes?
|
||||||
|
@$recipesSection.fadeIn duration:Duration.normal
|
||||||
|
|
||||||
|
for recipe in @model.findRecipes()
|
||||||
|
controller = @_recipeControllers[index]
|
||||||
|
if not controller?
|
||||||
|
controller = new FullRecipeController modPack:@_modPack, model:recipe
|
||||||
|
@_recipeControllers.push controller
|
||||||
|
controller.render()
|
||||||
|
controller.$el.hide()
|
||||||
|
@$recipeContainer.append controller.$el
|
||||||
|
controller.$el.fadeIn duration:Duration.normal
|
||||||
else
|
else
|
||||||
@$recipeContainer.fadeOut duration:Duration.fast
|
controller.model = recipe
|
||||||
|
index++
|
||||||
|
else
|
||||||
|
@$recipesSection.fadeOut duration:Duration.fast
|
||||||
|
|
||||||
|
while @_recipeControllers.length > index
|
||||||
|
controller = @_recipeControllers.pop()
|
||||||
|
controller.fadeOut duration:Duration.fast, complete:-> controller.$el.remove()
|
||||||
|
|
||||||
_refreshSimilarItems: ->
|
_refreshSimilarItems: ->
|
||||||
group = @model.item?.group
|
group = @model.item?.group
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ module.exports = class ItemPage extends BaseModel
|
|||||||
Object.defineProperties this,
|
Object.defineProperties this,
|
||||||
craftingRawMaterials: {get:-> @_plan.need}
|
craftingRawMaterials: {get:-> @_plan.need}
|
||||||
craftingSteps: {get:-> @_plan.steps}
|
craftingSteps: {get:-> @_plan.steps}
|
||||||
primaryRecipe: {get:-> @_primaryRecipe}
|
|
||||||
|
|
||||||
# Property Methods #############################################################################
|
# Property Methods #############################################################################
|
||||||
|
|
||||||
@@ -56,6 +55,11 @@ module.exports = class ItemPage extends BaseModel
|
|||||||
return null unless result.length > 0
|
return null unless result.length > 0
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
findRecipes: ->
|
||||||
|
result = @modPack.findRecipes @item?.slug
|
||||||
|
return null unless result.length > 0
|
||||||
|
return result
|
||||||
|
|
||||||
# Private Methods ##############################################################################
|
# Private Methods ##############################################################################
|
||||||
|
|
||||||
_updateCraftingPlan: ->
|
_updateCraftingPlan: ->
|
||||||
|
|||||||
@@ -14,10 +14,9 @@
|
|||||||
.byline: p from <a></a>
|
.byline: p from <a></a>
|
||||||
.description: p
|
.description: p
|
||||||
|
|
||||||
.recipe.section
|
.recipes.section
|
||||||
h2 Recipe
|
h2 Recipes
|
||||||
.panel
|
.panel
|
||||||
.view__full_recipe
|
|
||||||
|
|
||||||
.usedInMaking: .view__item_group
|
.usedInMaking: .view__item_group
|
||||||
.similar: .view__item_group
|
.similar: .view__item_group
|
||||||
|
|||||||
Reference in New Issue
Block a user