-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1529 from noirbizarre/topic-fixes
Small Topic fixes
- Loading branch information
Showing
5 changed files
with
51 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/** | ||
* Facets handling mixin | ||
*/ | ||
import velocity from 'velocity-animate'; | ||
|
||
import TemporalCoverageFacet from 'components/facets/temporal-coverage.vue'; | ||
|
||
|
||
export default { | ||
components: {TemporalCoverageFacet}, | ||
methods: { | ||
/** | ||
* Collapse or open a facet panel | ||
* @param {String} id The panel identifier to toggle | ||
*/ | ||
togglePanel(id, evt) { | ||
const panel = document.getElementById(`facet-${id}`); | ||
const removeBtn = document.getElementById(`facet-${id}-remove`); | ||
if (removeBtn && removeBtn.contains(evt.target)) return; // Do not react on remove button click | ||
const chevrons = document.getElementById(`chevrons-${id}`); | ||
if (panel.classList.contains('in')) { | ||
velocity(panel, 'slideUp', {duration: 500}).then(() => { | ||
panel.classList.remove('in'); | ||
}); | ||
} else { | ||
velocity(panel, 'slideDown', {duration: 500}).then(() => { | ||
panel.classList.add('in'); | ||
}); | ||
} | ||
chevrons.classList.toggle('fa-chevron-up'); | ||
chevrons.classList.toggle('fa-chevron-down'); | ||
}, | ||
/** | ||
* Expand a panel (diplay more details) | ||
* @param {String} id The panel identifier to expand | ||
*/ | ||
expandPanel(id, evt) { | ||
evt.target.remove(); | ||
const panel = document.getElementById(`facet-${id}-more`); | ||
velocity(panel, 'slideDown', {duration: 500}).then(() => { | ||
panel.classList.add('in'); | ||
}); | ||
} | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters