Skip to content

Commit

Permalink
Merge pull request #1529 from noirbizarre/topic-fixes
Browse files Browse the repository at this point in the history
Small Topic fixes
  • Loading branch information
noirbizarre committed Mar 26, 2018
2 parents 3a38c94 + da02520 commit d9ca5a8
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 39 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -4,6 +4,7 @@

- Remove territory claim banner [#1521](https://github.com/opendatateam/udata/pull/1521)
- Expose an [OEmbed](https://oembed.com/) API endpoint using the new cards [#1525](https://github.com/opendatateam/udata/pull/1525)
- Small topic fixes [#1529](https://github.com/opendatateam/udata/pull/1529)

## 1.3.3 (2018-03-20)

Expand Down
45 changes: 45 additions & 0 deletions js/front/mixins/facets.js
@@ -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');
});
}
}
};
39 changes: 2 additions & 37 deletions js/front/search.js
Expand Up @@ -2,17 +2,14 @@
* Search display page JS module
*/
import FrontMixin from 'front/mixin';
import FacetsMixin from 'front/mixins/facets';

import log from 'logger';
import Vue from 'vue';
import velocity from 'velocity-animate';

import TemporalCoverageFacet from 'components/facets/temporal-coverage.vue';


new Vue({
mixins: [FrontMixin],
components: {TemporalCoverageFacet},
mixins: [FrontMixin, FacetsMixin],
ready() {
log.debug('Search page');
},
Expand Down Expand Up @@ -47,37 +44,5 @@ new Vue({
}
});
},
/**
* 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');
});
}
}
});
3 changes: 2 additions & 1 deletion js/front/topic.js
Expand Up @@ -2,12 +2,13 @@
* Topic display page JS module
*/
import FrontMixin from 'front/mixin';
import FacetsMixin from 'front/mixins/facets';

import log from 'logger';
import Vue from 'vue';

new Vue({
mixins: [FrontMixin],
mixins: [FrontMixin, FacetsMixin],
ready() {
log.debug('Topic display page');
}
Expand Down
2 changes: 1 addition & 1 deletion udata/templates/carousel.html
Expand Up @@ -7,7 +7,7 @@ <h3>{{ _('Best reuse cases') }}</h3>

<div class="row">
{# Carousel #}
<div class="col-md-8">
<div class="col-xs-12">
<div id="home-carousel" class="carousel slide" data-ride="carousel" data-interval="6000">
<!-- Wrapper for slides -->
<div class="carousel-inner">
Expand Down

0 comments on commit d9ca5a8

Please sign in to comment.