Show official URL on item detail page
This commit is contained in:
@@ -39,6 +39,13 @@ module.exports = class ItemPageController extends PageController
|
|||||||
|
|
||||||
@modPack.on Event.change, => @tryRefresh()
|
@modPack.on Event.change, => @tryRefresh()
|
||||||
|
|
||||||
|
# Event Methods ################################################################################
|
||||||
|
|
||||||
|
craftingPlanButtonClicked: ->
|
||||||
|
display = @modPack.findItemDisplay @model.item.slug
|
||||||
|
router.navigate display.craftingUrl, trigger:true
|
||||||
|
return false
|
||||||
|
|
||||||
# PageController Overrides #####################################################################
|
# PageController Overrides #####################################################################
|
||||||
|
|
||||||
getTitle: ->
|
getTitle: ->
|
||||||
@@ -63,10 +70,11 @@ module.exports = class ItemPageController extends PageController
|
|||||||
|
|
||||||
@$byline = @$('.byline')
|
@$byline = @$('.byline')
|
||||||
@$bylineLink = @$('.byline a')
|
@$bylineLink = @$('.byline a')
|
||||||
@$craftingPlanLink = @$('a.craftingPlan')
|
@$craftingPlanButton = @$('button.craftingPlan')
|
||||||
@$descriptionPanel = @$('.description .panel')
|
@$descriptionPanel = @$('.description .panel')
|
||||||
@$descriptionSection = @$('.description')
|
@$descriptionSection = @$('.description')
|
||||||
@$name = @$('h1.name')
|
@$name = @$('h1.name')
|
||||||
|
@$officialPageLink = @$('a.officialPage')
|
||||||
@$recipeContainer = @$('.recipes .panel')
|
@$recipeContainer = @$('.recipes .panel')
|
||||||
@$recipesSection = @$('.recipes')
|
@$recipesSection = @$('.recipes')
|
||||||
@$recipesSectionTitle = @$('.recipes h2')
|
@$recipesSectionTitle = @$('.recipes h2')
|
||||||
@@ -84,13 +92,19 @@ module.exports = class ItemPageController extends PageController
|
|||||||
|
|
||||||
if @model.item?
|
if @model.item?
|
||||||
display = @modPack.findItemDisplay @model.item.slug
|
display = @modPack.findItemDisplay @model.item.slug
|
||||||
@$craftingPlanLink.attr href:display.craftingUrl
|
@$craftingPlanButton.fadeIn duration:Duration.fast
|
||||||
@$craftingPlanLink.fadeIn duration:Duration.fast
|
|
||||||
@imageLoader.load display.iconUrl, @$titleImage
|
@imageLoader.load display.iconUrl, @$titleImage
|
||||||
@$name.html display.itemName
|
@$name.html display.itemName
|
||||||
|
|
||||||
|
if @model.item.officialUrl?
|
||||||
|
@$officialPageLink.attr 'href', @model.item.officialUrl
|
||||||
|
@$officialPageLink.fadeIn duration:Duration.normal
|
||||||
|
else
|
||||||
|
@$officialPageLink.fadeOut duration:Duration.normal
|
||||||
|
|
||||||
@$el.slideDown duration:Duration.normal
|
@$el.slideDown duration:Duration.normal
|
||||||
else
|
else
|
||||||
|
@$craftingPlanButton.fadeOut duration:Duration.fast
|
||||||
@$el.slideUp duration:Duration.normal
|
@$el.slideUp duration:Duration.normal
|
||||||
|
|
||||||
@_refreshByline()
|
@_refreshByline()
|
||||||
@@ -107,8 +121,9 @@ module.exports = class ItemPageController extends PageController
|
|||||||
|
|
||||||
events: ->
|
events: ->
|
||||||
return _.extend super,
|
return _.extend super,
|
||||||
'click a.craftingPlan': 'routeLinkClick'
|
'click a.craftingPlan': 'routeLinkClick'
|
||||||
'click .byline a': 'routeLinkClick'
|
'click .byline a': 'routeLinkClick'
|
||||||
|
'click button.craftingPlan': 'craftingPlanButtonClicked'
|
||||||
|
|
||||||
# Private Methods ##############################################################################
|
# Private Methods ##############################################################################
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,9 @@
|
|||||||
.view__item_page
|
.view__item_page
|
||||||
.sidebar
|
.sidebar
|
||||||
.titleImage: a: img
|
.titleImage: a: img
|
||||||
a.craftingPlan.externalLink: p See Crafting Plan
|
a.officialPage.externalLink(target="new"): p Offical Documentation
|
||||||
|
|
||||||
|
button.large.craftingPlan See Crafting Plan
|
||||||
|
|
||||||
.view__adsense
|
.view__adsense
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,11 @@ button {
|
|||||||
background: white;
|
background: white;
|
||||||
color: $color-active-hover;
|
color: $color-active-hover;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.large {
|
||||||
|
margin: 2em 0;
|
||||||
|
padding: 0.5em 0.5em;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
h1 {
|
h1 {
|
||||||
|
|||||||
@@ -13,6 +13,16 @@ All rights reserved.
|
|||||||
display: inline-block;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.sidebar {
|
||||||
|
.externalLink {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
button.large {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.mainBody {
|
.mainBody {
|
||||||
h1.name {
|
h1.name {
|
||||||
font-family: $font-family-header;
|
font-family: $font-family-header;
|
||||||
|
|||||||
Reference in New Issue
Block a user