Skip to content

Instantly share code, notes, and snippets.

@gyulalaszlo
Created September 10, 2012 16:06
Show Gist options
  • Save gyulalaszlo/3691773 to your computer and use it in GitHub Desktop.
Save gyulalaszlo/3691773 to your computer and use it in GitHub Desktop.
STA szallasfoglalo transcode
from_date_strings = (s1, s2)->
s2 = "0#{s2}" if s2 < 10
"#{s2}.#{s1[4..5]}.#{s1[0..3]}"
$(->
$('#repcsi_es_szallas form').submit ->
self = this
t = (sc)-> $(sc, self)
t('#StartDate').val from_date_strings( t('#_sDate1').val(), t('#_sDate2').val())
t('#ReturnDate').val from_date_strings( t('#_rDate1').val(), t('#_rDate2').val())
t('#Room1Adults').val switch $('#Room1').val()
when '@SB' then 1
when '@DB' then 2
when '@TB' then 2
when '@TR' then 3
when '@QR' then 4
# folytassa, mylord
true
)
// Generated by CoffeeScript 1.3.1
(function() {
var from_date_strings;
from_date_strings = function(s1, s2) {
if (s2 < 10) {
s2 = "0" + s2;
}
return "" + s2 + "." + s1.slice(4, 6) + "." + s1.slice(0, 4);
};
$(function() {
return $('form.szallas').submit(function() {
var self, t;
self = this;
t = function(sc) {
return $(sc, self);
};
t('#StartDate').val(from_date_strings(t('#_sDate1').val(), t('#_sDate2').val()));
t('#ReturnDate').val(from_date_strings(t('#_rDate1').val(), t('#_rDate2').val()));
t('#Room1Adults').val((function() {
switch ($('#Room1').val()) {
case '@SB':
return 1;
case '@DB':
return 2;
case '@TB':
return 2;
case '@TR':
return 3;
case '@QR':
return 4;
}
})());
return true;
});
});
}).call(this);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment