Skip to content

Commit

Permalink
MOVE: public to assest
Browse files Browse the repository at this point in the history
  • Loading branch information
Olvap committed Feb 28, 2012
1 parent 6f197e1 commit 15e1cba
Show file tree
Hide file tree
Showing 181 changed files with 35,277 additions and 0 deletions.
Binary file added app/assets/images/DSC07867.JPG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/images/DSC07868.JPG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/images/DSC07869.JPG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/images/DSC07870.JPG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/images/Sol_Lineas_Aereas.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/images/blue-lemons.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/images/dropdown.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/images/dropdown3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/images/drophighlight.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/images/drophighlight3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/images/feed-icon-14x14.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/images/fondo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/images/logo_SOL.JPG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/images/logo_SOL.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/images/logo_sol.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/images/menuarrow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/images/menuarrow2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/images/rails.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/images/topbg.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/images/topbg3.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/images/topselectionleft.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/images/topselectionright.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/images/topselectionright3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
228 changes: 228 additions & 0 deletions app/assets/javascripts/all.js

Large diffs are not rendered by default.

167 changes: 167 additions & 0 deletions app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
//= require jquery
//= require jquery_ujs
//= require jquery-ui
//= require 'jquery.jqGrid.min'
//= require 'menu'

//request = $.ajax();
//agrega un tab con
//model es el nombre del modelos, entidad, reserva, etc. en singular y minuscula
//id es el id del registro en paticular, el que tiene en la base de datos.
//name es el nombre del registro en particular como està en la base de datos.


//TODO: agregar funcion para deshabilitar el boton de submit del formulario al primer click.
function addTab(model,id,name) {

if($("#tabs-"+id).length == 0){
var $tabs = $( "#tabs-"+model+"s").tabs({
tabTemplate: "<li><a href='#{href}'>#{label}</a> <span class='ui-icon ui-icon-close'>Remove Tab</span></li>",
add: function( event, ui ) {
var tab_content = "<div id='" + model + "_form"+ id +"'></div>";
$( ui.panel ).append( tab_content );
}
});

$tabs.tabs( "add", "#tabs-"+id, id +" "+ name);

$( "span.ui-icon-close" ).click(function() {
var index = $( "li", $tabs ).index( $( this ).parent() );
if(index>=0){
$tabs.tabs( "remove", index );
}
});
}

var index = $("#tabs-"+id).index();
$('#tabs-'+model+"s").tabs('select', index-1);

}

function togrid(){
$(".togrid").each(function(index) {

var i = $(this).attr("id");
i=i.substring(0,i.search(/_grid/i));//le saco el _grid al nombre de la

tableToGrid($(this),{
datatype: "local",
autowidth:true,
//onSelectRow: function(id){$('#togrid').getCell(id, 'ID');},
//onSelectRow: function(id){$.getScript('reservas/' + $('#togrid').getCell(id, 'ID') + '.js');},
//onSelectRow: getSelectedRow(),
onSelectRow: function(id){

var idx =$(this).getCell(id, 'ID');
var moneda =$(this).getCell(id, 'Mon');
$("input[id$=_"+i+"_id]").val(idx).change();
$("input[id$=final_currency]").val(moneda).change();
}
});
// var top_rowid = $('#'+i+'_grid tbody:first-child tr:nth-child(2)').attr('id');
// $("input[id$=_"+i+"_id]").val(top_rowid);


//var top_rowid = $('#'+i+'_grid').getDataIds()[0];


//});
// function busca_reserva(idx){
// $.getJSON("/reservas/"+idx+".json",function(data){
// //alert(data.reserva["id"]);
// });
});
}
function skin(){

$(".notice").each(function() {
if($(this).html().length != 0){
var text =$(this).html();

$(this).empty();
$("#freeow").freeow(text,"", {
classes: ["gray", "error"],
autoHideDelay:5000
});
}

});

$('.action_bar *').button({icons: {primary: "ui-icon-pencil"},text: true});
/* $('.new_button').button({icons: {primary: "ui-icon-plus"},text: false});
$('.show_button').button({icons: {primary: "ui-icon-search"},text: false});
$('.change_button').button({icons: {primary: "ui-icon-transferthick-e-w"},text: false});
$('.edit_button').button({icons: {primary: "ui-icon-pencil"},text: false});
$('.tohide').live('dblclick',function(){
$(this).hide();
});*/

// pone calendario en .datepicker
$( ".datepicker" ).datepicker({ dateFormat: 'dd-mm-yy' });
//$( "#tabs" ).tabs();

//convierte los divisores con .mytabs en tab, sortable permite al usuario ordenarlos.
$( ".mytabs" ).tabs().find( ".ui-tabs-nav" ).sortable({ axis: "x" });;






togrid();
}

$(function() {


//$("body").ajaxStart(function() {
// //request.abort();
//});

$('#operadora_new').click(function() {
$.getScript("/operadoras/new.js", togrid );
});
$('#agencia_new').click(function() {
$.getScript("/agencies/new.js", togrid );
});

$('#programa_new').click(function() {
$.getScript("/programas/new.js", togrid );
});
$('#thabitacion_new').click(function() {
$.getScript("/thabitacions/new.js", togrid );
});
$('#pasajero_new').click(function() {
$.getScript("/pasajeros/new.js", togrid );
});
$('#reserva_new').click(function() {
$.getScript("/reservas/new.js", togrid );
});

$('#deposito_new').click(function() {
$.getScript("/depositos/new.js", togrid );
});

$('#cotizacion_new').click(function() {
$.getScript("/cotizacions/new.js", togrid );
});


$('.pagination a').live('click', function () {
$.getScript(this.href, togrid );
return false;
});

$('.search input').keyup(function () {
$(this).parent().submit();
});

$('.search').submit(function () {
$.get(this.action, $(this).serialize(), togrid, 'script');
return false;
});

skin();
});
58 changes: 58 additions & 0 deletions app/assets/javascripts/autocomplete.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
$(function() {
$(".autocomplete").each(function(){

var table = $(this).attr("table");
var input_id = "input[id$=" + table + "_id]";
var input_name = "input[id$=" + table + "_name]";

$(input_id).keyup(function() {

$.ajax({
url: get_url_id(table),
error: function() {
$(input_name).val("S/V");
},
success: function(data) {
$(input_name).val( $(data).find("name").text() );
}
});
});

$("#" + table + "_name").keyup(function(event) {
if (event.keyCode != '40' && event.keyCode != '38' ) {
$.ajax({
url: get_url(table),
dataType: "xml",
//mientras async este en true las busquedas son mas rapidas, pero cada tanto usa los datos que ya bajo
//hay que ver si no se puede usar asi
//async: false,
//cache:false,
success: function( xmlResponse ) {
var data = $( table, xmlResponse ).map(function() {
return {
value : $( "name", this ).text(),
id: $( "id", this ).text()
};
}).get();

$(input_name).autocomplete({
source: data,
minLength: 0,
select: function( event, ui ) {
$(input_id).val(ui.item.id);
}
});
}
});
}
});
});
});

function get_url(table){
return ("/" + table + "s.xml?search[name_sw]="+ ($("#" + table + "_name").val()));
}
function get_url_id(table) {
return "/" + table + "s/" + $("input[id$=" + table + "_id]").val() + ".xml";
}

71 changes: 71 additions & 0 deletions app/assets/javascripts/autocompletePersona.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
function autocomplete(){
$('.autocomplete_persona').each(function(){
//por cada field con la clase autocomplete_persona hace una busqueda. el campo con esta clase es el campo
//en el que se pone el id, en este caso en campo con el que se carga el dni
var id = $(this).attr("i");
//busca el valor del atributi i. i, es un incremental que se le otorga a cada field y se lo almacena
//en la variable id. entonces puedo difenciar uno de los campos de los otros
$("input[class$=_"+id+"_doc]").keyup(function() {//cuando se escriba cualquier cosa en el campo
$.ajax({
//hace una busqueda por dni a la direccion /pasajeros_dni/:dni.xml . :dni es un dni cualquiera
url: ("/pasajeros_dni/" + $("input[class$=_"+id+"_doc]").val() + ".xml"),
error: function() {//si falla
$("input[class$=_"+id+"_name]").val("");
$("input[class$=_"+id+"_ids_]").val("");
},
success: function(data) {
// si tiene exito completa los campo de name y nacimiento
$("input[class$=_"+id+"_ids_]").val( $(data).find("id").text() );
$("input[class$=_"+id+"_name]").val( $(data).find("name").text() );
$("input[class$=_"+id+"_nacimiento]").val( $(data).find("nacimiento").text() );
}
});
});
});
$(".autocomplete").each(function(){
//por cada campo con la clase autocomplete
var table = $(this).attr("table");
var id = $(this).attr("i");
//almacena el atributo table e id en variables. table es el nombre del modelo, id, es un incremental
//para diferenciar los que se llamen igual.
$("input[class$=_"+id+"_name]").keyup(function(event) {//cuando una tecla se oprime
if (event.keyCode != '40' && event.keyCode != '38' ) {// que no sean 2 que ahora no recuerdo cuales son
$.ajax({
//busca por nombre
url: ("/" + table + "s.xml?search[name_sw]="+ ($("input[class$=_"+id+"_name]").val())),
dataType: "xml",
//mientras async este en true las busquedas son mas rapidas, pero cada tanto usa los datos que ya bajo
//hay que ver si no se puede usar asi
//async: false,
//cache:false,
success: function( xmlResponse ) {
//si tiene exito, almacena en data el xml que optubo en la busquedas
var data = $( table, xmlResponse ).map(function() {
return {
value : $( "name", this ).text(),//es el campo name
id : $( "id", this ).text(),// es el campo id
doc : $( "doc", this ).text(),// es el campo doc
nacimiento : $( "nacimiento", this ).text(),//es el campo nacimiento
//POR ALGUN MOTIVO EL CAMPO NACIMIENTO NO SE MUESTRA CUANDO BUSCAS POR NOMBRE
id: $( "id", this ).text()// es el campo id
};
}).get();

$( "input[class$=_"+id+"_name]" ).autocomplete({
//en data esta el resultado de la busqueda. la funcion autocomplete genera el dropdown
//con los datos en data.
source: data,
minLength: 3,//es el minimo de caracteres con el que empieza a buscar
select: function( event, ui ) {
// $("input[id$=" + table + "_id]").val(ui.item.id);
$("input[class$=_"+id+"_ids_]").val(ui.item.id);//es el valor de documento
$("input[class$=_"+id+"_doc]").val(ui.item.doc);//es el valor de documento
$("input[class$=_"+id+"_nacimiento]").val(ui.item.nacimiento);//es el valo de nacimiento
}
});
}
});
}
});
});
};
Loading

3 comments on commit 15e1cba

@eloyesp
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

En este commit estaría bueno, mover algunas cosas a vendor/assets (que deberían funcionar exáctamente igual), pero ayudaría a distingir entre el código nuestro y el de otros.

En una segunda instancia nos permitiría cambiar más facil el código externo (vendor) o sacarlo de la aplicación como una gema.

@eloyesp
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

En este commit estaría bueno, mover algunas cosas a vendor/assets (que deberían funcionar exáctamente igual), pero ayudaría a distingir entre el código nuestro y el de otros.

En una segunda instancia nos permitiría cambiar más facil el código externo (vendor) o sacarlo de la aplicación como una gema.

@olvap
Copy link
Member

@olvap olvap commented on 15e1cba Feb 29, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

movi algunos en el ultimo commit, podria hacerlo con los css de estilo.

Please sign in to comment.