Plugin Directory

Changeset 1564460


Ignore:
Timestamp:
12/29/2016 04:28:50 PM (9 years ago)
Author:
ughimire1
Message:

update with header date and month change.

Location:
patro/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • patro/trunk/css/patro.css

    r1472023 r1564460  
    101101}
    102102
    103 th.Next {
     103table#NepaliPatro th.Next {
    104104
    105105    background: url("../images/next.png") no-repeat center;
    106106}
    107107
    108 th.Next:hover {
     108table#NepaliPatro th.Next:hover {
    109109    background: url("../images/next_hover.png") no-repeat center;
    110110
    111111}
    112112
    113 th.Prev {
     113table#NepaliPatro th.Prev {
    114114
    115115    background: url("../images/prev.png") no-repeat center;
    116116}
    117117
    118 th.Prev:hover {
     118table#NepaliPatro th.Prev:hover {
    119119    background: url("../images/prev_hover.png") no-repeat center;
    120120
    121121}
     122
     123#NepaliPatro tbody td {
     124    cursor: pointer;
     125}
     126
     127.PatroCenter.CurrentDateAndMonth {
     128    cursor: pointer;
     129}
     130
     131#NepaliPatro .yearSelectionDropDown, #NepaliPatro .monthSelectionDropDown {
     132    border: 1px solid #e1e1e1;
     133    border-radius: 5px;
     134    margin-right: 5px;
     135    height: 26px;
     136    padding: 0 0px;
     137    text-align: center;
     138}
  • patro/trunk/js/patro.js

    r1472028 r1564460  
    255255                    this.CreateCalenderElement();
    256256
     257                    this.bindCalenderEvents();
     258
    257259                    this.getDate();
    258260
    259261
    260262                },
    261 
    262 
     263                bindCalenderEvents: function () {
     264
     265
     266                    $selector.on('click', '.PatroCenter.CurrentDateAndMonth', function () {
     267
     268                        var $obj = $(this);
     269                        if ($obj.find('select').length > 0) {
     270
     271                            return;
     272                        }
     273
     274
     275                        var yearSelectionTab = $('<select class="yearSelectionDropDown">');
     276
     277                        $.each(BS, function (key, val) {
     278
     279                            yearSelectionTab.append('<option data-year="' + key + '">' + self.NumberToLanguageDigit(key) + '</option>');
     280
     281                        });
     282
     283                        var monthSelectionTab = $('<select class="monthSelectionDropDown">');
     284
     285                        for (var i = 0; i < 12; i++) {
     286
     287                            monthSelectionTab.append('<option data-month="' + (i + 1) + '">' + NPMonth[i] + '</option>');
     288
     289                        }
     290
     291                        $obj.html(yearSelectionTab);
     292
     293                        $obj.append(monthSelectionTab);
     294
     295                        var $currentDate = $obj.attr('data-date');
     296
     297                        var currentDateArray = $currentDate.split('/');
     298
     299                        $obj.find(".yearSelectionDropDown").find('option[data-year="' + currentDateArray[0] + '"]').prop("selected", true);
     300
     301                        $obj.find(".monthSelectionDropDown").find('option[data-month="' + currentDateArray[1] + '"]').prop("selected", true);
     302
     303                        var $currentDateObj = $selector.find(".PatroCenter.CurrentDateAndMonth");
     304
     305                        var yearDropDownValue = $currentDateObj.find(".yearSelectionDropDown").find("option:selected").attr("data-year");
     306
     307                        var monthDropDownValue = $currentDateObj.find(".monthSelectionDropDown").find("option:selected").attr("data-month");
     308
     309                        $currentDateObj.find(".yearSelectionDropDown").on("change", function () {
     310
     311                            yearDropDownValue = $(this).find("option:selected").attr("data-year");
     312
     313                            self.JumpToDate(yearDropDownValue + "/" + monthDropDownValue + "/1");
     314                        });
     315                        $currentDateObj.find(".monthSelectionDropDown").on("change", function () {
     316
     317                            monthDropDownValue = $(this).find("option:selected").attr("data-month");
     318
     319                            self.JumpToDate(yearDropDownValue + "/" + monthDropDownValue + "/1");
     320                        });
     321                    });
     322
     323
     324                },
     325
     326
     327                JumpToDate: function (currDate) {
     328
     329                    var dateSplit = currDate.split("/");
     330
     331                    var month = dateSplit[1] - 1;
     332
     333                    if (month == 0) {
     334                        dateSplit[1] = 12;
     335                        dateSplit[0] = dateSplit[0] - 1;
     336                    } else {
     337
     338                        dateSplit[1] = dateSplit[1] - 1;
     339                    }
     340                    $selector.find('.CurrentDateAndMonth').attr('data-date', dateSplit[0] + "/" + dateSplit[1] + "/" + dateSplit[2]);
     341
     342                    $selector.find("th.Next").trigger("click");
     343                },
    263344                CreateCalenderElement: function () {
    264345
     
    272353                    Element += '<tr style="background:#F39A9A" ><th>' + PatroLang.FirstDay + '</th><th>' + PatroLang.SecondDay + '</th><th>' + PatroLang.ThirdDay + '</th><th>' + PatroLang.FourthDay + '</th><th>' +
    273354
    274                     PatroLang.FifthDay + '</th><th>' + PatroLang.SixthDay + '</th><th>' + PatroLang.SeventhDay + '</th></tr></thead>';
     355                        PatroLang.FifthDay + '</th><th>' + PatroLang.SixthDay + '</th><th>' + PatroLang.SeventhDay + '</th></tr></thead>';
    275356
    276357                    Element += '<tbody>';
    277358
    278 
    279359                    Element += '</tbody>';
    280360
    281361                    Element += '</table>';
    282362
    283 
    284                     //$('body').find(selector).append(Element);
    285363                    $selector.append(Element);
    286364
     
    291369                getDate: function () {
    292370
    293 
    294371                    var FullDate = self.GlobalDate.split('/');
    295372
     
    300377
    301378
    302                     //if (GlobalObj) {
    303                     //
    304                     //
    305                     //    $(GlobalObj).closest('.CurrentDateAndMonth').html(PatroLang.CurrentYear + ' ' + PatroLang.CurrentMonth);
    306                     //}
    307 
    308 
    309379                    this.populateMonth(self.GlobalDate, Lang);
    310380
     
    348418
    349419                        NepaliDate = $date.split('/');//this.AdToBsDate(PatroDate.getFullYear() + '/' + (PatroDate.getMonth() + 1) + '/' + PatroDate.getDate()).split('/');
    350 
    351 
    352                         //if (BS[NepaliDate[0]] === undefined) {
    353                         //
    354                         //    alert('Date Overflow');
    355                         //
    356                         //    return;
    357                         //}
    358420
    359421
     
    696758            // $('body').on('click', selector + ' #NepaliPatro .Prev', function () {
    697759            $selector.on('click', '#NepaliPatro .Prev', function () {
     760
     761
     762
    698763                //$('body').on('click', selector + ' #NepaliPatro .Prev', function () {
    699764
     
    870935
    871936            });
     937
     938
    872939        });
    873940    }
Note: See TracChangeset for help on using the changeset viewer.