Commit 2256361b authored by David Trattnig's avatar David Trattnig
Browse files

Add ability of disabled chips

parent c656913a
......@@ -11,23 +11,39 @@
/* Builds an array of chips based on an show-object */
function buildChips(category, languages) {
let chips = []
let catChip = []
catChip.id = category.id
catChip.name = category.name.trim()
if (category.subtitle && category.subtitle.trim())
catChip.name += " | " + category.subtitle
catChip.type = 'category'
chips.push(catChip)
for (let lang of languages) {
let langChip = []
langChip.id = lang.trim()
langChip.name = lang.trim()
langChip.type = 'language'
chips.push(langChip)
if (category) {
let catChip = []
catChip.id = category.id
catChip.name = category.name.trim()
if (category.end)
catChip.active = new Date(category.end) > new Date()
else
catChip.active = true
if (category.subtitle && category.subtitle.trim())
catChip.name += " | " + category.subtitle
catChip.type = 'category'
chips.push(catChip)
}
if (languages) {
for (let lang of languages) {
let langChip = []
langChip.id = lang.trim()
langChip.name = lang.trim()
langChip.type = 'language'
langChip.active = true
chips.push(langChip)
}
}
return chips
}
/* Only open link if chip is activated */
function evalLink(chip) {
if (chip.active)
openLink(`${urlShowList}?${chip.type}=${chip.id}`)
}
</script>
<style lang="scss">
......@@ -38,7 +54,7 @@
<template>
<Set chips={buildChips(category, languages)} let:chip class="show-chips">
<Chip {chip} on:click={openLink(`${urlShowList}?${chip.type}=${chip.id}`)}>
<Chip {chip} on:click={evalLink(chip)} class="{chip.active ? '' : 'disabled'}" ripple={chip.active}>
{#if (chip.type == 'category' && displayCatIcons) || (chip.type == 'language' && displayLangIcons)}
<LeadingIcon class="aura-icons">
<div class="icon-{chip.type}-{chip.id}" />
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment