Add link to crafting plan from item detail #83

This commit is contained in:
Andrew Miner
2015-02-09 20:25:54 -08:00
parent e4369ba944
commit 3790c26c5c
4 changed files with 31 additions and 13 deletions
+13 -1
View File
@@ -24,6 +24,18 @@ All rights reserved.
@include pixel-image;
}
}
a {
position: relative; width: 80%;
margin: 0 10%;
display: none;
p {
font-family: $font-family-normal;
font-size: $font-size-normal;
text-align: center;
}
}
}
.mainBody {
@@ -74,7 +86,7 @@ All rights reserved.
display: none;
}
.usedInMaking {
.usedToMake {
display: none;
}
}
@@ -40,16 +40,17 @@ module.exports = class ItemPageController extends BaseController
onDidRender: ->
@_similarItemsController = @addChild ItemGroupController, '.similar .view__item_group', modPack:@_modPack
@_usedInMakingController = @addChild ItemGroupController, '.usedInMaking .view__item_group', modPack:@_modPack
@_usedToMakeController = @addChild ItemGroupController, '.usedToMake .view__item_group', modPack:@_modPack
@$byline = @$('.byline')
@$bylineLink = @$('.byline a')
@$craftingPlanLink = @$('a.craftingPlan')
@$name = @$('h1.name')
@$recipeContainer = @$('.recipes .panel')
@$recipesSection = @$('.recipes')
@$similarContainer = @$('.similar')
@$titleImage = @$('.titleImage img')
@$usedInMakingContainer = @$('.usedInMaking')
@$usedToMakeContainer = @$('.usedToMake')
super
refresh: ->
@@ -58,16 +59,19 @@ module.exports = class ItemPageController extends BaseController
display = @_modPack.findItemDisplay @model.item?.slug
if display?
@$craftingPlanLink.attr href:display.craftingUrl
@$craftingPlanLink.fadeIn duration:Duration.fast
@_imageLoader.load display.iconUrl, @$titleImage
@$name.html display.itemName
else
@$craftingPlanLink.fadeOut duration:Duration.fast
@$titleImage.removeAttr 'src'
@$name.html ''
@_refreshByline()
@_refreshRecipes()
@_refreshSimilarItems()
@_refreshComponentIn()
@_refreshUsedToMake()
super
@@ -82,14 +86,14 @@ module.exports = class ItemPageController extends BaseController
else
@$byline.fadeOut duration:Duration.fast
_refreshComponentIn: ->
@_usedInMakingController.title = 'Used to Make'
_refreshUsedToMake: ->
@_usedToMakeController.title = 'Used to Make'
@_usedInMakingController.model = @model.findComponentInItems()
if @_usedInMakingController.model?
@$usedInMakingContainer.fadeIn duration:Duration.fast
@_usedToMakeController.model = @model.findComponentInItems()
if @_usedToMakeController.model?
@$usedToMakeContainer.fadeIn duration:Duration.fast
else
@$usedInMakingContainer.fadeOut duration:Duration.fast
@$usedToMakeContainer.fadeOut duration:Duration.fast
_refreshRecipes: ->
@_recipeControllers ?= []
+1
View File
@@ -60,6 +60,7 @@ module.exports = class ModPack extends BaseModel
result.slug = slug
result.itemName = @findName slug, includeDisabled:true
result.craftingUrl = Url.crafting inventoryText:slug
result.iconUrl = Url.itemIcon result
result.itemUrl = Url.item result
return result
+2 -1
View File
@@ -8,6 +8,7 @@
.view__item_page
.sidebar
.titleImage: img
a.craftingPlan: p Full Crafting Plan
.mainBody
h1.name
@@ -18,6 +19,6 @@
h2 Recipes
.panel
.usedInMaking: .view__item_group
.usedToMake: .view__item_group
.similar: .view__item_group
.plan