lib/assets/javascripts/bindings.js.coffee in kolo-0.7.4 vs lib/assets/javascripts/bindings.js.coffee in kolo-0.7.5
- old
+ new
@@ -219,9 +219,43 @@
value = ko.utils.unwrapObservable valueAccessor()
CKEDITOR.instances[id].setData value
ko.bindingHandlers.value.update element, valueAccessor
$(element).attr('data-edit-in-progress', 'false')
+ko.bindingHandlers.date =
+ init: (element, valueAccessor, allBindingsAccessor)->
+ options = allBindingsAccessor().datepickerOptions || {}
+ options.dateFormat ||= 'yy-mm-dd'
+
+ $(element).datepicker(options)
+ $(element).on 'change', (evt)->
+ observable = valueAccessor()
+ observable $(element).datepicker('getDate')
+
+ ko.utils.domNodeDisposal.addDisposeCallback element, ->
+ $(element).datepicker('destroy')
+
+ update: (element, valueAccessor)->
+ value = ko.utils.unwrapObservable(valueAccessor())
+ parsed = $.datepicker.parseDate 'yy-mm-dd', value
+ $(element).datepicker('setDate', parsed)
+
+ko.bindingHandlers.slider =
+ init: (element, valueAccessor, allBindingsAccessor)->
+ options = allBindingsAccessor().sliderOptions || {}
+
+ $(element).slider(options)
+ $(element).on 'change', (evt)->
+ observable = valueAccessor()
+ observable $(element).slider('value')
+
+ ko.utils.domNodeDisposal.addDisposeCallback element, ->
+ $(element).slider('destroy')
+
+ update: (element, valueAccessor)->
+ value = ko.utils.unwrapObservable(valueAccessor())
+ $(element).slider('value', value)
+
ko.bindingHandlers.richtext =
init: (element, valueAccessor, allBindingsAccessor)->
value = ko.utils.unwrapObservable valueAccessor()
$(element).wysihtml5
'events':