Add link to crafting plan from item detail #83
This commit is contained in:
@@ -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 ?= []
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user