Commit 4900d23274deaa0c3db9b1ebd7b039a10472ca83

Authored by Goutte
1 parent 2c0e1515

Add the time interval html inputs.

web/static/js/swapp.js
... ... @@ -148,7 +148,7 @@
148 148 return active_targets.forEach(function(target){
149 149 var targetButton;
150 150 console.info("Loading CSV data of " + target.name + "…");
151   - targetButton = $(".orbiters_filters .target." + target.slug);
  151 + targetButton = $(".targets-filters .target." + target.slug);
152 152 targetButton.addClass('loading');
153 153 return this$.loadData(target.slug, started_at, stopped_at).then(function(data){
154 154 console.info("Loaded CSV data of " + target.name + ".");
... ...
web/static/js/swapp.ls
... ... @@ -148,7 +148,7 @@ https://gitlab.irap.omp.eu/CDPP/SPACEWEATHERONLINE
148 148 active_targets = [@targets[k] for k of @targets when @targets[k].active]
149 149 active_targets.forEach((target) ~>
150 150 console.info "Loading CSV data of #{target.name}…"
151   - targetButton = $(".orbiters_filters .target.#{target.slug}")
  151 + targetButton = $(".targets-filters .target.#{target.slug}")
152 152 targetButton.addClass('loading')
153 153 @loadData(target.slug, started_at, stopped_at).then(
154 154 (data) ~>
... ...
web/view/home.html.jinja2
... ... @@ -2,6 +2,9 @@
2 2 {% set menu_section = 'home' %}
3 3 {% block title %}Home{% endblock %}
4 4  
  5 +{# This is the main template file, along with the layout. #}
  6 +{# The engine is Jinja2, close to Twig (yet not as good) #}
  7 +
5 8 {% block content %}
6 9  
7 10 {% macro target_button(target) -%}
... ... @@ -27,9 +30,14 @@
27 30 <div class="mdl-layout mdl-js-layout mdl-layout--fixed-drawer">
28 31  
29 32 <div class="mdl-layout__drawer">
  33 + <span class="mdl-layout-title">Time Interval</span>
  34 + <input type="date" id="started_at" name="started_at" title="The date of the beginning of the interval to observe.">
  35 + <input type="date" id="stopped_at" name="stopped_at" title="The date of the end of the interval to observe. (inclusive)">
  36 + <input type="submit" id="apply_new_interval" value="Load new interval" title="This may take a while if you request a bigger interval.">
  37 +
30 38 <span class="mdl-layout-title">Planets</span>
31 39  
32   - <section class="orbiters_filters">
  40 + <section class="targets-filters">
33 41 {% for target in planets %}
34 42 {{ target_button(target) }}
35 43 {% endfor %}
... ... @@ -40,7 +48,7 @@
40 48  
41 49 <span class="mdl-layout-title">Probes &amp; Comets</span>
42 50  
43   - <section class="orbiters_filters">
  51 + <section class="targets-filters">
44 52 {% for target in probes %}
45 53 {{ target_button(target) }}
46 54 {% endfor %}
... ... @@ -242,24 +250,24 @@
242 250 stroke-width: 1px;
243 251 stroke-dasharray: 5px;
244 252 }
245   - .orbiters_filters {
  253 + .targets-filters {
246 254 padding-left: 17px;
247 255 }
248   - .orbiters_filters .target {
  256 + .targets-filters .target {
249 257 float: left;
250 258 cursor: pointer;
251 259 }
252   - .orbiters_filters .target:not(.active) {
  260 + .targets-filters .target:not(.active) {
253 261 -webkit-filter: grayscale(100%);
254 262 -moz-filter: grayscale(100%);
255 263 -o-filter: grayscale(100%);
256 264 -ms-filter: grayscale(100%);
257 265 filter: grayscale(100%);
258 266 }
259   - .orbiters_filters .target.locked {
  267 + .targets-filters .target.locked {
260 268 cursor: not-allowed;
261 269 }
262   - .orbiters_filters .target.loading {
  270 + .targets-filters .target.loading {
263 271 {# margin: 20px;#}
264 272 {# width: 100px;#}
265 273 {# height: 100px;#}
... ... @@ -387,7 +395,7 @@ jQuery().ready(function($){
387 395 };
388 396 var isLastTargetEnabled = function(target_slug) {
389 397 var s = 0;
390   - $(".orbiters_filters .target:not(.locked)").each(function(i,p) {
  398 + $(".targets-filters .target:not(.locked)").each(function(i,p) {
391 399 if ($(p).hasClass('active') && ! $(p).hasClass('loading')) s++;
392 400 });
393 401 return s < 2;
... ... @@ -404,7 +412,7 @@ jQuery().ready(function($){
404 412 }
405 413 return false;
406 414 });
407   - $(".orbiters_filters .target:not(.locked)").on("click", function(e){
  415 + $(".targets-filters .target:not(.locked)").on("click", function(e){
408 416 if ($(this).hasClass('loading')) return false;
409 417 var switch_on = ! $(this).hasClass('active');
410 418 var target_slug = $(this).attr('data-target-slug');
... ...