diff --git a/src/editable-form/editable-form-bootstrap.js b/src/editable-form/editable-form-bootstrap.js index 350a0ac..f6a5273 100644 --- a/src/editable-form/editable-form-bootstrap.js +++ b/src/editable-form/editable-form-bootstrap.js @@ -3,14 +3,19 @@ Editableform based on Twitter Bootstrap */ (function ($) { - //form template - $.fn.editableform.template = '<form class="form-inline editableform"><div class="control-group">' + - '<div class="editable-input"></div><div class="editable-buttons"></div>' + - '<div class="help-block editable-error-block"></div>' + - '</div></form>'; + $.extend($.fn.editableform.Constructor.prototype, { + initTemplate: function() { + this.$form = $($.fn.editableform.template); + this.$form.find('.editable-error-block').addClass('help-block'); + + //buttons + this.$form.find('div.editable-buttons').append($.fn.editableform.buttons); + } + }); //buttons - $.fn.editableform.buttons = '<button type="submit" class="btn btn-primary"><i class="icon-ok icon-white"></i></button><button type="button" class="btn clearfix"><i class="icon-ban-circle"></i></button>'; + $.fn.editableform.buttons = '<button type="submit" class="btn btn-primary"><i class="icon-ok icon-white"></i></button>'+ + '<button type="button" class="btn clearfix"><i class="icon-ban-circle"></i></button>'; //error classes $.fn.editableform.errorGroupClass = 'error'; diff --git a/src/editable-form/editable-form-jqueryui.js b/src/editable-form/editable-form-jqueryui.js index 7ae3670..c0b6683 100644 --- a/src/editable-form/editable-form-jqueryui.js +++ b/src/editable-form/editable-form-jqueryui.js @@ -4,26 +4,23 @@ Editableform based on jQuery UI (function ($) { $.extend($.fn.editableform.Constructor.prototype, { - initTemplate: function() { - this.$form = $($.fn.editableform.template); - - //buttons - this.$form.find('div.editable-buttons').append($.fn.editableform.buttons); - this.$form.find('button[type=submit]').button({ - icons: { primary: "ui-icon-check" }, - text: false - }); - this.$form.find('button[type=button]').button({ - icons: { primary: "ui-icon-cancel" }, - text: false - }); - - } + initTemplate: function() { + this.$form = $($.fn.editableform.template); + + //buttons + this.$form.find('div.editable-buttons').append($.fn.editableform.buttons); + this.$form.find('button[type=submit]').button({ + icons: { primary: "ui-icon-check" }, + text: false + }).removeAttr('title'); + this.$form.find('button[type=button]').button({ + icons: { primary: "ui-icon-cancel" }, + text: false + }).removeAttr('title'); + + } }); - //buttons - $.fn.editableform.buttons = '<button type="submit" style="height: 24px">submit</button><button type="button" style="height: 24px">cancel</button>'; - //error classes $.fn.editableform.errorGroupClass = null; $.fn.editableform.errorBlockClass = 'ui-state-error'; diff --git a/src/editable-form/editable-form.css b/src/editable-form/editable-form.css index 008cf05..35f0eb0 100644 --- a/src/editable-form/editable-form.css +++ b/src/editable-form/editable-form.css @@ -12,6 +12,11 @@ margin-left: 7px; } +/*for jquery-ui buttons need set height to look more pretty*/ +.editable-buttons button.ui-button { + height: 24px; +} + .editableform-loading { background: url('img/loading.gif') center center no-repeat; height: 25px; diff --git a/src/editable-form/editable-form.js b/src/editable-form/editable-form.js index 738d995..4dd82f2 100644 --- a/src/editable-form/editable-form.js +++ b/src/editable-form/editable-form.js @@ -410,15 +410,16 @@ Editableform is linked with one of input types, e.g. 'text' or 'select'. $.fn.editableform.template = '<form class="form-inline editableform">'+ '<div class="control-group">' + '<div class="editable-input"></div><div class="editable-buttons"></div>'+ + '<div class="editable-error-block"></div>' + '</div>' + - '<div class="editable-error-block"></div>' + '</form>'; //loading div $.fn.editableform.loading = '<div class="editableform-loading"></div>'; //buttons - $.fn.editableform.buttons = '<button type="submit">Ok</button><button type="button">Cancel</button>'; + $.fn.editableform.buttons = '<button type="submit">Ok</button>'+ + '<button type="button">Cancel</button>'; //error class attahced to control-group $.fn.editableform.errorGroupClass = null;