Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Single Handle timeline widget addition #632

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions nunaliit2-js/src/main/js/nunaliit2/css/basic/n2.widget.css
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,10 @@ Timeline widget
background-color: #ffffff;
}

.n2timeline .n2timeline_slider .n2timeline_slider_left_slider_hidden {
display: none;
}

.n2timeline_range {
width: 100%;
font-size: 12px;
Expand Down
34 changes: 32 additions & 2 deletions nunaliit2-js/src/main/js/nunaliit2/n2.widgetTime.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ var TimelineWidget = $n2.Class({

intervalSetEventName: null,

showSingleHandle: null,

rangeMin: null,

rangeMax: null,
Expand All @@ -118,12 +120,19 @@ var TimelineWidget = $n2.Class({
containerId: null
,dispatchService: null
,sourceModelId: null
,showSingleHandle: null
},opts_);

var _this = this;

this.dispatchService = opts.dispatchService;
this.sourceModelId = opts.sourceModelId;

if( typeof opts.showSingleHandle === 'boolean' ){
this.showSingleHandle = opts.showSingleHandle;
} else {
this.showSingleHandle = false;
};

this.rangeMin = null;
this.rangeMax = null;
Expand Down Expand Up @@ -230,6 +239,27 @@ var TimelineWidget = $n2.Class({
_this._barUpdated(ui);
}
});

if (this.showSingleHandle) {

// Update the date interval
var value = new $n2.date.DateInterval({
min: this.rangeMin
,max: this.rangeMin
,ongoing: false
});

this.dispatchService.send(DH,{
type: this.intervalSetEventName
,value: value
});

// Hide first slider handle
var $sliderHandle = $('.n2timeline_slider .ui-slider-handle');
if ($sliderHandle.length > 1) {
$sliderHandle.first().addClass('n2timeline_slider_left_slider_hidden');
};
};
};
};
return $slider;
Expand All @@ -238,7 +268,7 @@ var TimelineWidget = $n2.Class({
_removeSlider: function(){
$('#'+this.elemId).find('.n2timeline_slider_wrapper').empty();
},

_display: function(){
var $elem = this._getElem()
.empty();
Expand All @@ -262,7 +292,7 @@ var TimelineWidget = $n2.Class({
// Create slider
this._getSlider();

this._displayRange();
this._displayRange();
this._displayInterval();
},

Expand Down