Skip to content

Commit

Permalink
Merge pull request #1832 from noirbizarre/dgfr#79-clear-temporal-cove…
Browse files Browse the repository at this point in the history
…rage

Allows to clear dataset form temporal coverage
  • Loading branch information
noirbizarre committed Aug 17, 2018
2 parents 7e50c34 + 186ed1b commit 562bf95
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -18,6 +18,7 @@
### Bugfixes

- Ensure that admin notifications are displayed once and with a constant width. [#1831](https://github.com/opendatateam/udata/pull/1831)
- Allows to clear the dataset form temporal coverage. [#1832](https://github.com/opendatateam/udata/pull/1832)

### Internal

Expand Down
21 changes: 19 additions & 2 deletions js/components/form/daterange-picker.vue
Expand Up @@ -3,26 +3,39 @@
.dropdown-menu {
min-width: auto;
}
input.form-control {
border-right: none;
&:nth-of-type(2) { // End date
border-left: none;
}
}
}
</style>

<template>
<div class="input-group dropdown daterange-picker" :class="{ 'open': picking }"
v-outside="onOutside">
<span class="input-group-addon"><span class="fa fa-calendar"></span></span>
<input type="text" class="input-sm form-control"
<input type="text" class="form-control"
v-el:start-input :placeholder="_('Start')"
@focus="onFocus" @input="onChange | debounce 500"
:required="required"
:value="startValue|dt dateFormat ''"
:readonly="readonly">
<span class="input-group-addon">{{ _('to') }}</span>
<input type="text" class="input-sm form-control"
<input type="text" class="form-control daterange-picker-end"
v-el:end-input :placeholder="_('End')"
@focus="onFocus" @input="onChange | debounce 500"
:required="required"
:value="endValue|dt dateFormat ''"
:readonly="readonly">
<span class="input-group-btn">
<button class="btn btn-danger" type="button" @click.prevent="clear">
<span class="fa fa-remove">
</button>
</span>
<div class="dropdown-menu" :style="dropdownStyle">
<calendar v-ref:calendar :selected="currentValue" :min="dateMin" :max="dateMax"></calendar>
</div>
Expand Down Expand Up @@ -126,6 +139,10 @@ export default {
});
},
methods: {
clear() {
this.startValue = '';
this.endValue = '';
},
onFocus(e) {
if (!this.picking || e.target !== this.pickedField) {
this.$nextTick(this.$refs.calendar.focus);
Expand Down

0 comments on commit 562bf95

Please sign in to comment.