Add link to crafting plan from item detail #83

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