Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Generated by CoffeeScript 1.4.0
- (function() {
- $(document).ready(function() {
- var options;
- options = {
- additionalFilterTriggers: [$('#q')]
- };
- $('#tablagehitu').tableFilter(options);
- return $(function() {
- return $("#datepicker-noiztik").datepicker($.datepicker.regional["es"]);
- });
- });
- $(function() {
- var endDate, selectCurrentWeek, startDate;
- startDate = void 0;
- endDate = void 0;
- selectCurrentWeek = function() {
- return window.setTimeout((function() {
- return $("#datepicker-noiztik").find(".ui-datepicker-current-day a").addClass("ui-state-active");
- }), 1);
- };
- $("#datepicker-noiztik").datepicker({
- showOtherMonths: true,
- selectOtherMonths: true,
- firstDay: 1,
- defaultDate: $.datepicker.parseDate('yy-mm-dd', $('#txtnoiztik').val()),
- onSelect: function(dateText, inst) {
- var date, dateFormat, fetxa, url;
- date = $(this).datepicker("getDate");
- startDate = new Date(date.getFullYear(), date.getMonth(), date.getDate() - date.getDay() + 1);
- endDate = new Date(date.getFullYear(), date.getMonth(), date.getDate() - date.getDay() + 7);
- dateFormat = inst.settings.dateFormat || $.datepicker._defaults.dateFormat;
- $("#txtnoiztik").val($.datepicker.formatDate(dateFormat, startDate, inst.settings));
- fetxa = moment(startDate).format('YYYY-MM-DD');
- url = Routing.generate('lineas_gehitu', {
- q: fetxa
- });
- window.location.href = url;
- return selectCurrentWeek();
- },
- beforeShowDay: function(date) {
- var cssClass;
- if (!startDate) {
- date = $.datepicker.parseDate('yy-mm-dd', $('#txtnoiztik').val());
- startDate = new Date(date.getFullYear(), date.getMonth(), date.getDate() - date.getDay() + 1);
- endDate = new Date(date.getFullYear(), date.getMonth(), date.getDate() - date.getDay() + 7);
- }
- cssClass = "";
- if (date >= startDate && date <= endDate) {
- cssClass = "ui-datepicker-current-day";
- selectCurrentWeek();
- }
- return [true, cssClass];
- },
- onChangeMonthYear: function(year, month, inst) {
- return selectCurrentWeek();
- }
- });
- $(".ui-datepicker-calendar tr").live("mousemove", function() {
- return $(this).find("td a").addClass("ui-state-hover");
- });
- return $(".ui-datepicker-calendar tr").live("mouseleave", function() {
- return $(this).find("td a").removeClass("ui-state-hover");
- });
- });
- $('.footable').footable();
- }).call(this);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement