_getRecipe()
.then(function (recipes) {
- resolve(recipes);
$('#tic-import-dialog').modal('hide');
+ resolve(recipes);
})
.catch(function (err) {
_.remove(recipeStore, function (item) {
return item === recipeItem;
});
- $('#tic-import-recipe-confirm-ok').prop('disabled', false);
+ $('#tic-import-recipe-confirm-ok').prop('disabled', true);
$inputDom.parent().removeClass('has-success').addClass('has-error');
var helpDomContent = '<ul class="list-unstyled"><li>' + err + '</li></ul>';
var helpDomId = '#'+ radioId + '-help';
$(helpDomId).append(helpDomContent);
-
- resolve();
})
});
});
if (value.checked === false ) {
if (dom.type === 'url' || dom.type === 'text') {
$(dom).val('').change();
+ var idDomQuery = '#' + value.id + '-help';
+ $(idDomQuery).empty();
}
}
});
unique: function($el) {
var input = $el.val().trim();
if (_.isEmpty(input)) {
+ $('#tic-import-recipe-confirm-ok').prop('disabled', true);
+ return;
+ }
+ if (!Util.validateURL(input)) {
+ $('#tic-import-recipe-confirm-ok').prop('disabled', true);
return;
}
var duplicatedUrl = _.filter(recipeStore, ['url', input]);
- if (Util.validateURL(input) && !_.isEmpty(duplicatedUrl)) {
+ if ( !_.isEmpty(duplicatedUrl)) {
$('#tic-import-recipe-confirm-ok').prop('disabled', true);
return 'URL is already in use.';
- } else {
- $('#tic-import-recipe-confirm-ok').prop('disabled', false);
}
+ $('#tic-import-recipe-confirm-ok').prop('disabled', false);
+ return;
}
}
});