Commit 4900d23274deaa0c3db9b1ebd7b039a10472ca83

Authored by Goutte
1 parent 2c0e1515

Add the time interval html inputs.

web/static/js/swapp.js
@@ -148,7 +148,7 @@ @@ -148,7 +148,7 @@
148 return active_targets.forEach(function(target){ 148 return active_targets.forEach(function(target){
149 var targetButton; 149 var targetButton;
150 console.info("Loading CSV data of " + target.name + "…"); 150 console.info("Loading CSV data of " + target.name + "…");
151 - targetButton = $(".orbiters_filters .target." + target.slug); 151 + targetButton = $(".targets-filters .target." + target.slug);
152 targetButton.addClass('loading'); 152 targetButton.addClass('loading');
153 return this$.loadData(target.slug, started_at, stopped_at).then(function(data){ 153 return this$.loadData(target.slug, started_at, stopped_at).then(function(data){
154 console.info("Loaded CSV data of " + target.name + "."); 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,7 +148,7 @@ https://gitlab.irap.omp.eu/CDPP/SPACEWEATHERONLINE
148 active_targets = [@targets[k] for k of @targets when @targets[k].active] 148 active_targets = [@targets[k] for k of @targets when @targets[k].active]
149 active_targets.forEach((target) ~> 149 active_targets.forEach((target) ~>
150 console.info "Loading CSV data of #{target.name}…" 150 console.info "Loading CSV data of #{target.name}…"
151 - targetButton = $(".orbiters_filters .target.#{target.slug}") 151 + targetButton = $(".targets-filters .target.#{target.slug}")
152 targetButton.addClass('loading') 152 targetButton.addClass('loading')
153 @loadData(target.slug, started_at, stopped_at).then( 153 @loadData(target.slug, started_at, stopped_at).then(
154 (data) ~> 154 (data) ~>
web/view/home.html.jinja2
@@ -2,6 +2,9 @@ @@ -2,6 +2,9 @@
2 {% set menu_section = 'home' %} 2 {% set menu_section = 'home' %}
3 {% block title %}Home{% endblock %} 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 {% block content %} 8 {% block content %}
6 9
7 {% macro target_button(target) -%} 10 {% macro target_button(target) -%}
@@ -27,9 +30,14 @@ @@ -27,9 +30,14 @@
27 <div class="mdl-layout mdl-js-layout mdl-layout--fixed-drawer"> 30 <div class="mdl-layout mdl-js-layout mdl-layout--fixed-drawer">
28 31
29 <div class="mdl-layout__drawer"> 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 <span class="mdl-layout-title">Planets</span> 38 <span class="mdl-layout-title">Planets</span>
31 39
32 - <section class="orbiters_filters"> 40 + <section class="targets-filters">
33 {% for target in planets %} 41 {% for target in planets %}
34 {{ target_button(target) }} 42 {{ target_button(target) }}
35 {% endfor %} 43 {% endfor %}
@@ -40,7 +48,7 @@ @@ -40,7 +48,7 @@
40 48
41 <span class="mdl-layout-title">Probes &amp; Comets</span> 49 <span class="mdl-layout-title">Probes &amp; Comets</span>
42 50
43 - <section class="orbiters_filters"> 51 + <section class="targets-filters">
44 {% for target in probes %} 52 {% for target in probes %}
45 {{ target_button(target) }} 53 {{ target_button(target) }}
46 {% endfor %} 54 {% endfor %}
@@ -242,24 +250,24 @@ @@ -242,24 +250,24 @@
242 stroke-width: 1px; 250 stroke-width: 1px;
243 stroke-dasharray: 5px; 251 stroke-dasharray: 5px;
244 } 252 }
245 - .orbiters_filters { 253 + .targets-filters {
246 padding-left: 17px; 254 padding-left: 17px;
247 } 255 }
248 - .orbiters_filters .target { 256 + .targets-filters .target {
249 float: left; 257 float: left;
250 cursor: pointer; 258 cursor: pointer;
251 } 259 }
252 - .orbiters_filters .target:not(.active) { 260 + .targets-filters .target:not(.active) {
253 -webkit-filter: grayscale(100%); 261 -webkit-filter: grayscale(100%);
254 -moz-filter: grayscale(100%); 262 -moz-filter: grayscale(100%);
255 -o-filter: grayscale(100%); 263 -o-filter: grayscale(100%);
256 -ms-filter: grayscale(100%); 264 -ms-filter: grayscale(100%);
257 filter: grayscale(100%); 265 filter: grayscale(100%);
258 } 266 }
259 - .orbiters_filters .target.locked { 267 + .targets-filters .target.locked {
260 cursor: not-allowed; 268 cursor: not-allowed;
261 } 269 }
262 - .orbiters_filters .target.loading { 270 + .targets-filters .target.loading {
263 {# margin: 20px;#} 271 {# margin: 20px;#}
264 {# width: 100px;#} 272 {# width: 100px;#}
265 {# height: 100px;#} 273 {# height: 100px;#}
@@ -387,7 +395,7 @@ jQuery().ready(function($){ @@ -387,7 +395,7 @@ jQuery().ready(function($){
387 }; 395 };
388 var isLastTargetEnabled = function(target_slug) { 396 var isLastTargetEnabled = function(target_slug) {
389 var s = 0; 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 if ($(p).hasClass('active') && ! $(p).hasClass('loading')) s++; 399 if ($(p).hasClass('active') && ! $(p).hasClass('loading')) s++;
392 }); 400 });
393 return s < 2; 401 return s < 2;
@@ -404,7 +412,7 @@ jQuery().ready(function($){ @@ -404,7 +412,7 @@ jQuery().ready(function($){
404 } 412 }
405 return false; 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 if ($(this).hasClass('loading')) return false; 416 if ($(this).hasClass('loading')) return false;
409 var switch_on = ! $(this).hasClass('active'); 417 var switch_on = ! $(this).hasClass('active');
410 var target_slug = $(this).attr('data-target-slug'); 418 var target_slug = $(this).attr('data-target-slug');