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

Validate callback send options. #1099

Open
wants to merge 23 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
# X-editable

In-place editing with Twitter Bootstrap, jQuery UI or pure jQuery.

PLEASE SUBMIT ALL PULL REQUESTS TO THE 'dev' BRANCH!
## Live Demo
**http://vitalets.github.io/x-editable/demo.html**

## Project status
Unfortunately, **project is currently frozen**, as I don't have enough time for it.
You could try use it as is, but there may be some bugs with newer versions of dependend libraries (e.g. bootstrap).
I would really appreciate if someone take care of it.. See [#610](https://github.com/vitalets/x-editable/issues/610).
Vitalets.
## Pull Requests
Please submit all Pull Requests to the `develop` branch: https://github.com/vitalets/x-editable/tree/develop

## Live demo
**http://vitalets.github.io/x-editable/demo.html**
## Issue Tracker
Please report all issues here: https://github.com/vitalets/x-editable/issues

## Documentation
**http://vitalets.github.io/x-editable**

## Project Status
Actively maintained

## How to get it

### Manual download
Expand Down
6 changes: 3 additions & 3 deletions dist/bootstrap3-editable/js/bootstrap-editable.js
Original file line number Diff line number Diff line change
Expand Up @@ -1897,7 +1897,7 @@ Makes editable any HTML element on the page. Applied as jQuery method.

validate: function () {
if (typeof this.options.validate === 'function') {
return this.options.validate.call(this, this.value);
return this.options.validate.call(this, this.value, this.options);
}
},

Expand Down Expand Up @@ -4445,7 +4445,7 @@ $(function(){
//initial value, can be `new Date()`
value: null,
minYear: 1970,
maxYear: 2015,
maxYear: new Date().getFullYear(),
yearDescending: true,
minuteStep: 5,
secondStep: 1,
Expand Down Expand Up @@ -6831,4 +6831,4 @@ Automatically shown in inline mode.

$.fn.editabletypes.datetimefield = DateTimeField;

}(window.jQuery));
}(window.jQuery));
68 changes: 68 additions & 0 deletions src/inputs-ext/slider/slider.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/**
Slider, based on the Slider plugin by Stefan Petre (http://www.eyecon.ro/bootstrap-slider).

Make sure to include the plugin's code before using this editor.

@class slider
@extends text
@since 1.5.0
@final
**/
(function ($) {
"use strict";

var Constructor = function (options) {
this.init('slider', options, Constructor.defaults);
};

$.fn.editableutils.inherit(Constructor, $.fn.editabletypes.text);

$.extend(Constructor.prototype, {
render: function() {
// need to set kewdown handler before apply slider
// for correct autosubmit
this.isAutosubmit = false;
var that = this;
this.$input.on('keydown', function (e) {
if (!that.isAutosubmit) {
return;
}
if (e.which === 13) {
that.$input.closest('form').submit();
}
});

// apply slider
this.$input.slider(this.options.slider);
},

value2input: function(value) {
// make sure it's a number
if(typeof value!='number')
value=Number(value);
if(isNaN(value))
value=0;

this.$input.val(value);
this.$input.slider('setValue', value);
},

autosubmit: function() {
this.isAutosubmit = true;
}
});

Constructor.defaults = $.extend({}, $.fn.editabletypes.list.defaults, {
/**
@property tpl
@default <input type="text">
**/
tpl:'<input type="text">',
/**
**/
slider: null,
});

$.fn.editabletypes.slider = Constructor;

}(window.jQuery));
4 changes: 2 additions & 2 deletions src/inputs/combodate/lib/combodate.js
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@
//initial value, can be `new Date()`
value: null,
minYear: 1970,
maxYear: 2015,
maxYear: (new Date().getFullYear()),
yearDescending: true,
minuteStep: 5,
secondStep: 1,
Expand All @@ -521,4 +521,4 @@
smartDays: false // whether days in combo depend on selected month: 31, 30, 28
};

}(window.jQuery));
}(window.jQuery));