Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bootstrap-editable.css
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@
top: 50%;
right: 6px;
margin-top: -6px;

cursor: pointer;
}

.editable-clear-x:hover {
Expand Down
11 changes: 6 additions & 5 deletions editable.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,16 +91,16 @@ m_editable.events({

var val = mEditable.getVal(this.type)(tmpl.$('.editable-input'));

if (typeof self.onsubmit === 'function') {
if (typeof self.onSubmit === 'function') {
if (self.async) {
tmpl.Session.set('loading', true);
this.onsubmit.call(this, val, function () {
this.onSubmit.call(this, val, function () {
tmpl.$('.m_editable-popup').trigger('hide');
doSavedTransition(tmpl);
});
return;
}
this.onsubmit.call(this, val);
this.onSubmit.call(this, val);
} else {
tmpl.$('.editable-click').text(val);
}
Expand Down Expand Up @@ -197,6 +197,7 @@ function resizePopover ($popover, placement) {

$.fn.tooltip.Constructor.prototype.applyPlacement.call({
tip: function () { return $popover; },
getViewportAdjustedDelta: function () { return { top: 0, left: 0 }; },
replaceArrow: function (delta, dimension, position) { $popover.find('.arrow').css(position, delta ? (50 * (1 - delta / dimension) + '%') : ''); }
}, calculatedOffset, placement);
}
Expand Down Expand Up @@ -258,7 +259,7 @@ function generateSettings (settings) {
select2: {},
combodate: {},
showbuttons: true,
onsubmit: null,
onSubmit: null,
value: null,
position: 'left',
title: null,
Expand All @@ -275,8 +276,8 @@ function doSavedTransition (tmpl) {
if(bgColor === 'transparent') {
bgColor = '';
}
$e.css('background-color', bgColor);
$e.addClass('editable-bg-transition');
$e.css('background-color', bgColor);
setTimeout(function(){
$e.removeClass('editable-bg-transition');
}, 1700);
Expand Down
12 changes: 12 additions & 0 deletions inputs/text/text.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,21 @@ _.each(types, function (t) {
});
});

Template.m_editable_form_text.rendered = function() {
this.$('.editable-clear-x').toggle(!!this.data.value);
};

Template.m_editable_form_text.events({
'input input[type="range"]': function (e, tmpl) {
tmpl.$('.output').text(tmpl.$(e.target).val());
},
'click .editable-clear-x': function (e, tmpl) {
tmpl.$('input').val('');
tmpl.$('.editable-clear-x').hide();
},
'keyup input, change input': function (e, tmpl) {
var value = tmpl.$('input').val();
tmpl.$('.editable-clear-x').toggle(!!value);
}
});
Template.m_editable_form_text.helpers({
Expand Down
3 changes: 3 additions & 0 deletions package.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ Package.on_use(function (api) {

// main files
api.add_files([
'img/loading.gif',
'img/clear.png',

'bootstrap-editable.css',
'editable.html',
'editable.js'
Expand Down