Skip to content
This repository has been archived by the owner on Jul 5, 2022. It is now read-only.

Commit

Permalink
Merge pull request #17 from konecta/develop
Browse files Browse the repository at this point in the history
Develop v0.2.4
  • Loading branch information
sirnapa committed Aug 5, 2015
2 parents ae25ed2 + caf68cb commit a520d9e
Show file tree
Hide file tree
Showing 16 changed files with 479 additions and 337 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "kui",
"version": "0.2.3",
"version": "0.2.4",
"dependencies": {
"jquery": "~2.1.4",
"bootstrap": "~3.3.2",
Expand Down
85 changes: 73 additions & 12 deletions dist/jquery.kui.core.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! kui - v0.2.3 - 2015-06-29
/*! kui - v0.2.4 - 2015-07-23
* https://github.com/konecta/kui
* Copyright (c) 2015 Nelson Paez; Licensed MIT */
(function ($) {
Expand Down Expand Up @@ -186,7 +186,7 @@

$opcion.appendTo(select);

if( inputVal && inputVal.toString() === id){
if( inputVal && inputVal.toString() == id){
$opcion.attr('selected',true);
seleccionado = true;
}
Expand Down Expand Up @@ -961,28 +961,47 @@
// Data & Format
$.kui.data = {

source : function(source,sourceAjax,sourceData){
/*
* @param o = {
* {Object} source
* {String} sourceAjax
* {Object} sourceData
* {Function} sourceParse
* {String} key,
* {Object} message,
* {Object} targetS,
* }
*/

source : function(o){

var data = {};

if(source===undefined){
if(o.source===undefined){
data = {};
}else if(typeof source === 'string'){
}else if(typeof o.source === 'string'){

$.ajax({
type: sourceAjax,
url: source,
data: sourceData,
$.kui.ajax({
target: o.target,
type: o.sourceAjax,
url: o.source,
data: o.sourceData,
success: function(remoteData){
if (!remoteData.error) {
data = remoteData;
if(typeof o.sourceParse === 'function'){
data = o.sourceParse.call(this,remoteData);
}else if(remoteData.error && remoteData.mensaje){
$.kui.messages(o.message,o.target,remoteData.tipoMensaje,remoteData.mensaje);
}else{
data = remoteData[o.key];
}
},
async: false
}).error(function(o){
window.console.log('error....',o);
});

}else{
data = source;
data = o.source;
}

return data;
Expand Down Expand Up @@ -1036,4 +1055,46 @@

};

// Ajax
$.kui.ajax = function(o) {
$.kui.loading.show(o);
var ajaxRequest = $.ajax(o);
$.kui.loading.hide(o);
return ajaxRequest;
};

// Loading
$.kui.loading = {
init: function(o) {
var target = $(o.target);
var id = $.kui.randomId();
var div = $('<div>').attr('id',id)
.addClass('text-center text-muted')
.css('margin-botton',10)
.hide();
$('<i>').addClass('fa fa-5x fa-circle-o-notch fa-spin')
.appendTo(div);
target.before(div);
target.attr('data-loading',id);
},
show: function(o) {
var target = o.target? $(o.target) : $('body');
if(!target.data('loading')){
o.target = target;
$.kui.loading.init(o);
}

target.hide();
$('#'+target.data('loading')).fadeIn('slow');
},
hide: function(o){
var target = $(o.target);
var loading = $('#'+target.data('loading'));
loading.fadeOut('slow',function(){
target.fadeIn('fast');
});
}
};


}(jQuery));
4 changes: 2 additions & 2 deletions dist/jquery.kui.core.min.js

Large diffs are not rendered by default.

Loading

0 comments on commit a520d9e

Please sign in to comment.