text x-clear button and new $tpl property in inputs, need tests

This commit is contained in:
vitalets
2013-01-05 16:23:58 +04:00
parent f6a7b26e1f
commit 5edc4bbfcb
15 changed files with 173 additions and 84 deletions

@ -52,15 +52,20 @@ $(function(){
render: function () {
DateUI.superclass.render.call(this);
this.$input.datepicker(this.options.datepicker);
},
postrender: function() {
//"clear" link
if(this.options.clear) {
this.$clear = $('<a href="#"></a>').html(this.options.clear).click($.proxy(function(e){
e.preventDefault();
e.stopPropagation();
this.clear();
}, this));
this.$tpl.parent().append($('<div class="editable-clear">').append(this.$clear));
}
},
},
value2html: function(value, element) {
var text = $.datepicker.formatDate(this.options.viewformat, value);
@ -134,12 +139,12 @@ $(function(){
@property tpl
@default <div></div>
**/
tpl:'<div></div>',
tpl:'<div class="editable-date"></div>',
/**
@property inputclass
@default 'editable-date'
@default ''
**/
inputclass: 'editable-date',
inputclass: '',
/**
Format used for sending value to server. Also applied when converting date from <code>data-value</code> attribute.<br>
Full list of tokens: http://docs.jquery.com/UI/Datepicker/formatDate

@ -14,9 +14,9 @@ Automatically shown in inline mode.
$.extend(DateUIField.prototype, {
render: function () {
$.fn.editabletypes.dateui.superclass.render.call(this);
this.$field = this.$input.find('input');
this.$field.datepicker(this.options.datepicker);
this.$tpl = $(this.options.tpl);
this.$input = this.$tpl.find('input');
this.$input.datepicker(this.options.datepicker);
/*
if(this.options.clear) {
@ -30,18 +30,15 @@ Automatically shown in inline mode.
},
value2input: function(value) {
this.$field.val($.datepicker.formatDate(this.options.viewformat, value));
this.$input.val($.datepicker.formatDate(this.options.viewformat, value));
},
input2value: function() {
return this.html2value(this.$field.val());
return this.html2value(this.$input.val());
},
activate: function() {
if(this.$field.is(':visible')) {
this.$field.focus();
$.fn.editableutils.setCursorPosition(this.$field.get(0), this.$field.val().length);
}
$.fn.editabletypes.text.prototype.activate.call(this);
},
autosubmit: function() {