-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
campos de dinheiro, mini lib pra autocomplete
- Loading branch information
Showing
11 changed files
with
358 additions
and
195 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
module Autocomplete | ||
|
||
def self.included(base) | ||
base.extend ClassMethods | ||
end | ||
|
||
module ClassMethods | ||
|
||
def autocomplete(*fields) | ||
for field in fields | ||
self.class_eval <<-CLASS_METHODS | ||
def #{field}_text | ||
#{field}.try(:name) | ||
end | ||
def #{field}_text=(value) | ||
@#{field}_text = value | ||
end | ||
CLASS_METHODS | ||
end | ||
|
||
end | ||
|
||
end | ||
|
||
end |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,141 +1,26 @@ | ||
|
||
function Telefone(campo) | ||
{ | ||
qtdcaracteres = (campo.value).length; | ||
|
||
if(qtdcaracteres == 0) | ||
campo.value = "("; | ||
|
||
if(qtdcaracteres == 3) | ||
campo.value = campo.value + ")"; | ||
|
||
if(qtdcaracteres == 8) | ||
campo.value = campo.value + "-"; | ||
|
||
} | ||
// Fim da fun��o telefone | ||
|
||
// Formatar o cep | ||
function Cep(campo) | ||
{ | ||
qtdcaracteres = (campo.value).length; | ||
|
||
if(qtdcaracteres == 2) | ||
campo.value = campo.value + "."; | ||
|
||
if(qtdcaracteres ==6) | ||
campo.value = campo.value + "-"; | ||
} | ||
// Fim da fun��o cep | ||
|
||
// Formatar cgc | ||
function Cgc(campo) | ||
{ | ||
qtdcaracteres = (campo.value).length; | ||
|
||
if(qtdcaracteres == 2) | ||
campo.value = campo.value + "."; | ||
|
||
if(qtdcaracteres == 6) | ||
campo.value = campo.value + "."; | ||
|
||
if(qtdcaracteres == 10) | ||
campo.value = campo.value + "/"; | ||
|
||
if(qtdcaracteres == 15) | ||
campo.value = campo.value + "-"; | ||
|
||
} | ||
// Fim da fun��o cgc | ||
|
||
// Fun��o caixa alta | ||
function upper(campo) | ||
{ | ||
campo.value = campo.value.toUpperCase(); | ||
} | ||
|
||
// Formatar data | ||
function Data(campo) | ||
{ | ||
qtdcaracteres = (campo.value).length; | ||
|
||
if(qtdcaracteres == 2) | ||
campo.value = campo.value + "/"; | ||
|
||
if(qtdcaracteres ==5) | ||
campo.value = campo.value + "/"; | ||
} | ||
// Fim da fun��o cep | ||
|
||
// Fun��o placa | ||
function Placa(campo) | ||
{ | ||
qtdcaracteres = (campo.value).length; | ||
|
||
if(qtdcaracteres == 3) | ||
campo.value = campo.value + "-"; | ||
} | ||
// Fim da fun��o placa | ||
// Função sip | ||
function Sip(campo) | ||
{ | ||
qtdcaracteres = (campo.value).length; | ||
|
||
if(qtdcaracteres == 1) | ||
campo.value = campo.value + "."; | ||
|
||
if(qtdcaracteres == 5) | ||
campo.value = campo.value + "."; | ||
|
||
if(qtdcaracteres == 9) | ||
campo.value = campo.value + "-"; | ||
|
||
|
||
} | ||
// Fim da fun��o placa | ||
|
||
// Fim da fun��o placa | ||
// Função sip | ||
function Cpf(campo) | ||
{ | ||
qtdcaracteres = (campo.value).length; | ||
|
||
if(qtdcaracteres == 3) | ||
campo.value = campo.value + "."; | ||
|
||
if(qtdcaracteres == 7) | ||
campo.value = campo.value + "."; | ||
|
||
if(qtdcaracteres == 11) | ||
campo.value = campo.value + "-"; | ||
|
||
} | ||
// Fim da função cpf | ||
$(document).ready(function () { | ||
|
||
// abas | ||
// Ocultando as abas | ||
$$('.contaba').invoke ('hide'); | ||
// Mostra somente a primeira aba | ||
$$('.contaba').first ().show (); | ||
// seta a primeira aba como selecionada (na lista de abas) | ||
$$('#abas a').first ().addClassName ('active'); | ||
// Quando clicar no link de uma aba | ||
$$('#abas a').each (function (e){ | ||
Event.observe (e, 'click', function (e){ | ||
// Oculta todas as abas | ||
$$('div.contaba').invoke ('hide'); | ||
// tira a seleção da aba atual | ||
$$('#abas a').invoke ('removeClassName', 'active'); | ||
// adiciona a classe selected na selecionada atualmente | ||
Event.element (e).addClassName ('active'); | ||
// Mostra a aba clicada | ||
var tab = $$(Event.element (e).getAttribute ('href')); | ||
|
||
(tab[0]).show (); | ||
// pra nao ir para o link | ||
Event.stop (e); | ||
|
||
}); // Fim do Event.observe | ||
}); // Fim do each | ||
}); | ||
// Limpa os campos de busca | ||
$.fn.clearClick = function() { | ||
return this.focus(function() { | ||
if( this.value == this.defaultValue ) { | ||
this.value = ""; | ||
} | ||
}).blur(function() { | ||
if( !this.value.length ) { | ||
this.value = this.defaultValue; | ||
} | ||
}); | ||
}; | ||
|
||
/** | ||
* Set grid table in list | ||
*/ | ||
$(document).ready(function () { | ||
|
||
$("#search").clearClick(); | ||
$(".calendar").datepicker(); | ||
$(".money").priceFormat({ | ||
prefix: '', | ||
centsSeparator: ',', | ||
thousandsSeparator: '.' | ||
}); | ||
}); |
Oops, something went wrong.