Projekt

Obecné

Profil

« Předchozí | Další » 

Revize c883131e

Přidáno uživatelem Martin Sebela před asi 4 roky(ů)

Re #8076 - implemented new datepicker

Zobrazit rozdíly:

website/templates/heatmap.html.twig
2 2
  
3 3
{% block title %} Heatmap.ZČU {% endblock %}
4 4
{% block stylesheets %}
5
  <link rel="stylesheet" href="{{ asset('css/leaflet.css') }}" />
6
  <link rel="stylesheet" href="{{ asset('css/bootstrap.min.css') }}" />
7
  <link rel="stylesheet" href="{{ asset('css/style.css') }}" />
5
  <link rel="stylesheet" href="{{ asset('css/leaflet.css') }}">
6
  <link rel="stylesheet" href="{{ asset('css/bootstrap.min.css') }}">
7
  <link rel="stylesheet" href="{{ asset('css/style.css') }}">
8
  <link rel="stylesheet" href="{{ asset('css/bootstrap-datepicker3.css') }}">
8 9
{% endblock %}
9 10

  
10 11

  
......
30 31
              {{
31 32
                form_widget(form.date,
32 33
                {
33
                  'type' : 'date',
34
                  'type' : 'text',
34 35
                  'id' : 'date',
35 36
                  'attr' : {
36
                    'max' : 'now'|date('Y-m-d'),
37 37
                    'class' : 'form-control',                 
38 38
                    'onChange' : 'checkDataSetsAvailability("' ~ path('available') ~ '")'
39 39
                  }
......
151 151

  
152 152
    <script src="{{ asset('js/jquery-3.4.1.min.js') }}"></script>
153 153
    <script src="{{ asset('js/bootstrap.min.js') }}"></script>
154
    <script src="{{ asset('js/bootstrap-datepicker.min.js') }}"></script>
155
    <script src="{{ asset('js/bootstrap-datepicker.cs.min.js') }}" charset="UTF-8"></script>
154 156
    <script src="{{ asset('js/leaflet.js') }}"></script>
155 157
    <script src="{{ asset('js/leaflet-heat.js') }}"></script>
156 158
    <script src="{{ asset('js/zcu-heatmap.js') }}"></script>
......
160 162
        {% if submitted %}
161 163
          loadCurrentTimeHeatmap("{{ path('opendata') }}");
162 164
        {% endif %}
163
    </script>
164

  
165
      
166
        var datesetDates = '23-04-2019,24-04-2019,25-04-2019,24-05-2020,27-05-2020'.split(',');
167

  
168
        function formatDate(date) {
169
          var day = String(date.getDate());
170
          var month = String(date.getMonth() + 1);
171

  
172
          if (day.length === 1) {
173
            day = '0' + day;
174
          }
175

  
176
          if (month.length === 1) {
177
            month = '0' + month;
178
          }
179

  
180
          return day + '-' + month + '-' + date.getFullYear();
181
        }
182

  
183
        $(function () {
184
          $('#date').datepicker({
185
            format: 'yyyy-mm-dd',
186
            language: 'cs',
187
            beforeShowDay: function(date) {
188
              if (datesetDates.indexOf(formatDate(date)) < 0) {
189
                return {enabled: false, tooltip: 'Žádná data'}
190
              }
191
              else {
192
                return {enabled: true}
193
              }
194
            },
195
            autoclose: true
196
          })
197
        });
198
  </script>
165 199

  
166 200
{% endblock %}

Také k dispozici: Unified diff