showbuttons option ready
This commit is contained in:
parent
3dc331cf5b
commit
de7907575a
@ -4,7 +4,8 @@ X-editable changelog
|
|||||||
|
|
||||||
Version 1.1.1 wip
|
Version 1.1.1 wip
|
||||||
----------------------------
|
----------------------------
|
||||||
[enh] object can be passed in 'option' method to set several options simultaneously (vitalets)
|
[enh] 'showbuttons' option to hide buttons in form (vitalets)
|
||||||
|
[enh] object can be passed in 'option' method to set several options at once (vitalets)
|
||||||
[enh #20] toggle editable by 'dblclick' and 'mouseenter' (vitalets)
|
[enh #20] toggle editable by 'dblclick' and 'mouseenter' (vitalets)
|
||||||
[enh] added 'inputs-ext' directory with sample input 'address'. They will not be concatenated to main files (vitalets)
|
[enh] added 'inputs-ext' directory with sample input 'address'. They will not be concatenated to main files (vitalets)
|
||||||
[enh #13] 'onblur' option: to cancel, submit or ignore when user clicks outside the form (vitalets)
|
[enh #13] 'onblur' option: to cancel, submit or ignore when user clicks outside the form (vitalets)
|
||||||
|
@ -56,11 +56,11 @@ Or use grunt's _qunit_ task <code>grunt test</code>. For that you also need to [
|
|||||||
|
|
||||||
5.To build lib + docs:
|
5.To build lib + docs:
|
||||||
* run <code>grunt build</code> in **lib** directory
|
* run <code>grunt build</code> in **lib** directory
|
||||||
* run <code>build data-docs-dist-zip</code> in **gh-pages** directory
|
* run <code>build data-docs-dist</code> in **gh-pages** directory
|
||||||
You will get distributive in **lib/dist** and updated docs in **gh-pages/*.html**.
|
You will get distributive in **lib/dist** and updated docs in **gh-pages/*.html**.
|
||||||
Do not edit **index.html** and **docs.html** directly! Instead look at [Handlebars](https://github.com/wycats/handlebars.js) templates in **generator/templates**.
|
Do not edit **index.html** and **docs.html** directly! Instead look at [Handlebars](https://github.com/wycats/handlebars.js) templates in **generator/templates**.
|
||||||
|
|
||||||
6.Commit changes on <code>dev</code> branch and make pull request as usual.
|
6.Commit changes on <code>dev</code> / <code>gh-pages-dev</code> branch and make pull request as usual.
|
||||||
|
|
||||||
Thanks for your support!
|
Thanks for your support!
|
||||||
|
|
||||||
|
@ -5,11 +5,8 @@ Editableform based on Twitter Bootstrap
|
|||||||
|
|
||||||
$.extend($.fn.editableform.Constructor.prototype, {
|
$.extend($.fn.editableform.Constructor.prototype, {
|
||||||
initTemplate: function() {
|
initTemplate: function() {
|
||||||
this.$form = $($.fn.editableform.template);
|
this.$form = $($.fn.editableform.template);
|
||||||
this.$form.find('.editable-error-block').addClass('help-block');
|
this.$form.find('.editable-error-block').addClass('help-block');
|
||||||
|
|
||||||
//buttons
|
|
||||||
this.$form.find('div.editable-buttons').append($.fn.editableform.buttons);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -4,10 +4,7 @@ Editableform based on jQuery UI
|
|||||||
(function ($) {
|
(function ($) {
|
||||||
|
|
||||||
$.extend($.fn.editableform.Constructor.prototype, {
|
$.extend($.fn.editableform.Constructor.prototype, {
|
||||||
initTemplate: function() {
|
initButtons: function() {
|
||||||
this.$form = $($.fn.editableform.template);
|
|
||||||
|
|
||||||
//buttons
|
|
||||||
this.$form.find('.editable-buttons').append($.fn.editableform.buttons);
|
this.$form.find('.editable-buttons').append($.fn.editableform.buttons);
|
||||||
this.$form.find('.editable-submit').button({
|
this.$form.find('.editable-submit').button({
|
||||||
icons: { primary: "ui-icon-check" },
|
icons: { primary: "ui-icon-check" },
|
||||||
@ -17,7 +14,6 @@ Editableform based on jQuery UI
|
|||||||
icons: { primary: "ui-icon-closethick" },
|
icons: { primary: "ui-icon-closethick" },
|
||||||
text: false
|
text: false
|
||||||
}).removeAttr('title');
|
}).removeAttr('title');
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -34,9 +34,9 @@ Editableform is linked with one of input types, e.g. 'text' or 'select'.
|
|||||||
},
|
},
|
||||||
initTemplate: function() {
|
initTemplate: function() {
|
||||||
this.$form = $($.fn.editableform.template);
|
this.$form = $($.fn.editableform.template);
|
||||||
|
},
|
||||||
//buttons
|
initButtons: function() {
|
||||||
this.$form.find('div.editable-buttons').append($.fn.editableform.buttons);
|
this.$form.find('.editable-buttons').append($.fn.editableform.buttons);
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
Renders editableform
|
Renders editableform
|
||||||
@ -47,8 +47,14 @@ Editableform is linked with one of input types, e.g. 'text' or 'select'.
|
|||||||
this.$loading = $($.fn.editableform.loading);
|
this.$loading = $($.fn.editableform.loading);
|
||||||
this.$element.empty().append(this.$loading);
|
this.$element.empty().append(this.$loading);
|
||||||
this.showLoading();
|
this.showLoading();
|
||||||
|
|
||||||
|
//init form template and buttons
|
||||||
this.initTemplate();
|
this.initTemplate();
|
||||||
|
if(this.options.showbuttons) {
|
||||||
|
this.initButtons();
|
||||||
|
} else {
|
||||||
|
this.$form.find('.editable-buttons').remove();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Fired when rendering starts
|
Fired when rendering starts
|
||||||
@ -431,7 +437,26 @@ Editableform is linked with one of input types, e.g. 'text' or 'select'.
|
|||||||
@type object
|
@type object
|
||||||
@default null
|
@default null
|
||||||
**/
|
**/
|
||||||
ajaxOptions: null
|
ajaxOptions: null,
|
||||||
|
/**
|
||||||
|
Wether to show buttons or not.
|
||||||
|
Form without buttons can be submitted by Enter (depends on input), by onblur = 'submit' or manually (via submit api method)
|
||||||
|
|
||||||
|
@property showbuttons
|
||||||
|
@type boolean
|
||||||
|
@default true
|
||||||
|
**/
|
||||||
|
showbuttons: true,
|
||||||
|
/**
|
||||||
|
Submit strategy. Can be <code>normal|never</code>
|
||||||
|
<code>submit='never'</code> usefull for turning into classic form several inputs and submitting them together manually.
|
||||||
|
Works pretty with <code>showbuttons=false</code>
|
||||||
|
|
||||||
|
@property submit
|
||||||
|
@type string
|
||||||
|
@default normal
|
||||||
|
**/
|
||||||
|
submit: 'normal'
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -345,7 +345,20 @@
|
|||||||
e.hover();
|
e.hover();
|
||||||
p = tip(e);
|
p = tip(e);
|
||||||
ok(p.is(':visible'), 'popover1 visible after second hover');
|
ok(p.is(':visible'), 'popover1 visible after second hover');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("showbuttons: false", function () {
|
||||||
|
var e = $('<a href="#" id="a"></a>').appendTo('#qunit-fixture').editable({
|
||||||
|
showbuttons: false
|
||||||
|
});
|
||||||
|
|
||||||
|
e.click();
|
||||||
|
var p = tip(e);
|
||||||
|
ok(p.is(':visible'), 'popover visible');
|
||||||
|
ok(!p.find('.editable-submit').length, 'submit not rendered');
|
||||||
|
ok(!p.find('.editable-cancel').length, 'cancel not rendered');
|
||||||
|
ok(!p.find('.editable-buttons').length, '.editable-buttons block not rendered');
|
||||||
|
});
|
||||||
|
|
||||||
//unfortunatly, testing this feature does not always work in browsers. Tested manually.
|
//unfortunatly, testing this feature does not always work in browsers. Tested manually.
|
||||||
/*
|
/*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user