Ignore:
Timestamp:
Jun 14, 2011, 12:21:51 PM (13 years ago)
Author:
dennisw
Message:

Fixed dateFormat bug with minDate.
Proper filtering on only start_date or end_date.

Location:
src/django_gheat/website
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/django_gheat/website/static/heatmap_extensions.js

    r9251 r9253  
    4242    dataset = $('#select_dataset option:selected').text();
    4343    wlnode = $('#select_node option:selected').text();
    44 //    enc = $('#select_enc option:selected').text();
    45 //    date = $('#select_date option:selected').text();
    4644    start_date = $('#start_date').val();
    4745    end_date = $('#end_date').val();
     
    5654    if (dataset != ''){dataset='&meetrondje__naam='+dataset;}
    5755    if (wlnode != ''){wlnode='&accespoint__ssid='+wlnode;}
    58 //    if (enc != ''){enc='&accespoint__encryptie='+enc;}
    59 //    if (date != ''){date='&meetrondje__datum='+date;}
    6056    if (start_date && end_date){
    6157      sd_d=start_date.substr(0,2);
     
    6864
    6965      start_date='&meetrondje__datum__gte=' + sd_y +'-'+ sd_m +'-'+ sd_d;
     66      end_date='&meetrondje__datum__lte=' + ed_y +'-'+ ed_m +'-'+ ed_d;
     67    }
     68    if (start_date && !end_date){
     69      sd_d=start_date.substr(0,2);
     70      sd_m=start_date.substr(3,2);
     71      sd_y=start_date.substr(6,4);
     72      start_date='&meetrondje__datum__gte=' + sd_y +'-'+ sd_m +'-'+ sd_d;
     73      end_date='';
     74    }
     75    if (!start_date && end_date){
     76      ed_d=end_date.substr(0,2);
     77      ed_m=end_date.substr(3,2);
     78      ed_y=end_date.substr(6,4);
     79      start_date='';
    7080      end_date='&meetrondje__datum__lte=' + ed_y +'-'+ ed_m +'-'+ ed_d;
    7181    }
  • src/django_gheat/website/templates/home.html

    r9251 r9253  
    22<head>
    33  <link href="{{ STATIC_URL }}style.css" rel="stylesheet" type="text/css" media="screen" />
     4  <link type="text/css" href="{{ STATIC_URL }}jquery-ui-1.8.13.custom.css" rel="Stylesheet" /> 
    45  <script type="text/javascript" language="Javascript" src="{{ STATIC_URL }}jquery-1.6.1.min.js"></script>
    5 
    66  <script type="text/javascript" language="Javascript" src="{{ STATIC_URL }}OpenLayers.js"></script>
    77  <script type="text/javascript" language="Javascript" src="{{ STATIC_URL }}OpenStreetMap.js"></script>
    88  <script type="text/javascript" language="Javascript" src="{{ STATIC_URL }}heatmap.js"></script>
    9 
    109  <script type="text/javascript" language="javascript" src="{{ STATIC_URL }}jquery.chained.js"></script>
    1110  <script type="text/javascript" language="Javascript" src="{{ STATIC_URL }}heatmap_extensions.js"></script>
    1211  <script type="text/javascript" language="Javascript" src="{{ STATIC_URL }}colorpicker.js"></script>
    13 
    14   <!-- jquery UI datapicker -->
    15   <link type="text/css" href="{{ STATIC_URL }}jquery-ui-1.8.13.custom.css" rel="Stylesheet" /> 
    16   <script type="text/javascript" src="{{ STATIC_URL }}jquery-ui-1.8.13.custom.min.js"></script>
    17 
    18 
     12  <script type="text/javascript" language="Javascript" src="{{ STATIC_URL }}jquery-ui-1.8.13.custom.min.js"></script>
    1913  <script language="javascript" type="text/javascript">
    2014    $(function(){
    2115      $('#colour').colorPicker();
    22       $('#start_date, #end_date').datepicker({
     16      $('#start_date').datepicker({
    2317        dateFormat: 'dd/mm/yy',
    24         beforeShow: setEnd,
     18        onSelect: function(dateValue, inst){
     19          $('#end_date').datepicker('option', 'minDate', dateValue);
     20        }
    2521      });
    2622
    27       function setEnd(element){
    28         if (element.id=='end_date'){
    29           var start_date = new Date($('#start_date').val());
    30           start_date.setDate(start_date.getDate())
    31           return {
    32             minDate: start_date
    33           };
    34         }
    35       return {}
    36       }
    37 
    38       $('#start_date').change(function(){
    39         $('#end_date').val('').text('');
     23      $('#end_date').datepicker({
     24        dateFormat: 'dd/mm/yy',
    4025      });
    4126
Note: See TracChangeset for help on using the changeset viewer.