Fix technical data sheet not showing if there is no support_configs

This commit is contained in:
Jaime van Kessel 2018-11-08 16:38:38 +01:00
parent 69c9ffaf61
commit d3302938b2

View file

@ -15,14 +15,29 @@ Item
var link = undefined var link = undefined
if ("Technical Data Sheet" in packageData.links) if ("Technical Data Sheet" in packageData.links)
{ {
// HACK: This is the way the old API (used in 3.6-beta) used to do it. For safety it's still here,
// but it can be removed over time.
link = packageData.links["Technical Data Sheet"] link = packageData.links["Technical Data Sheet"]
} }
else if ("technicalDataSheet" in packageData.links)
{
link = packageData.links["technicalDataSheet"]
}
return link return link
} }
anchors.topMargin: UM.Theme.getSize("default_margin").height anchors.topMargin: UM.Theme.getSize("default_margin").height
height: visible ? childrenRect.height : 0 height: visible ? childrenRect.height : 0
visible: packageData.type == "material" && packageData.has_configs
visible: packageData.type == "material" && (packageData.has_configs || technicalDataSheetUrl != undefined)
Item
{
id: combatibilityItem
visible: packageData.has_configs
width: parent.width
// This is a bit of a hack, but the whole QML is pretty messy right now. This needs a big overhaul.
height: visible ? heading.height + table.height: 0
Label Label
{ {
id: heading id: heading
@ -33,6 +48,7 @@ Item
color: UM.Theme.getColor("text_medium") color: UM.Theme.getColor("text_medium")
font: UM.Theme.getFont("medium") font: UM.Theme.getFont("medium")
} }
TableView TableView
{ {
id: table id: table
@ -143,13 +159,15 @@ Item
width: Math.floor(table.width * 0.1) width: Math.floor(table.width * 0.1)
} }
} }
}
Label Label
{ {
id: technical_data_sheet id: technical_data_sheet
anchors.top: table.bottom anchors.top: combatibilityItem.bottom
anchors.topMargin: UM.Theme.getSize("default_margin").height / 2 anchors.topMargin: UM.Theme.getSize("default_margin").height / 2
visible: base.technicalDataSheetUrl !== undefined visible: base.technicalDataSheetUrl !== undefined
height: visible ? contentHeight : 0
text: text:
{ {
if (base.technicalDataSheetUrl !== undefined) if (base.technicalDataSheetUrl !== undefined)