Blame view

web/view/home.html.jinja2 6.39 KB
9390ec89   Goutte   Initial experimen...
1
2
3
4
5
6
{% extends 'layout.html.jinja2' %}
{% set menu_section = 'home' %}
{% block title %}Home{% endblock %}

{% block content %}

f6ed8d85   Goutte   Rework layout as ...
7
8
9
10
<div class="mdl-layout mdl-js-layout mdl-layout--fixed-drawer">


  <div class="mdl-layout__drawer">
ae0aa7d2   Goutte   Add an x axis lab...
11
    <span class="mdl-layout-title">Planets</span>
f6ed8d85   Goutte   Rework layout as ...
12

c42fea3a   Goutte   Rework the CSS wi...
13
    <section id="orbiters_filters">
a79c5268   Goutte   Add probes and co...
14
{% for planet in planets %}
961953c4   Goutte   Move targets to t...
15
      <img title="{{ planet.title }}" src="{{ static('img/target/'~planet.slug~'_128.png') }}" width="64px" height="64px" alt="{{ planet.name }}" class="{{ 'locked' if planet.locked }}">
a79c5268   Goutte   Add probes and co...
16
{% endfor %}
c42fea3a   Goutte   Rework the CSS wi...
17
    </section>
a79c5268   Goutte   Add probes and co...
18
19
20
21
22
23
24
25

    <br>
    <hr class="clear">

    <span class="mdl-layout-title">Probes</span>

    <section id="orbiters_filters">
{% for probe in probes %}
961953c4   Goutte   Move targets to t...
26
      <img title="{{ probe.title }}" src="{{ static('img/target/'~probe.slug~'_128.png') }}" width="64px" height="64px" alt="{{ probe.name }}" class="{{ 'locked' if probe.locked }}">
a79c5268   Goutte   Add probes and co...
27
28
29
30
31
32
33
34
35
36
{% endfor %}
    </section>

    <br>
    <hr class="clear">

    <span class="mdl-layout-title">Comets</span>

    <section id="orbiters_filters">
{% for comet in comets %}
961953c4   Goutte   Move targets to t...
37
      <img title="{{ comet.title }}" src="{{ static('img/target/'~comet.slug~'_128.png') }}" width="64px" height="64px" alt="{{ comet.name }}" class="{{ 'locked' if comet.locked }}">
a79c5268   Goutte   Add probes and co...
38
39
40
{% endfor %}
    </section>

b550c2b0   Goutte   Rework the home s...
41
    <br>
c42fea3a   Goutte   Rework the CSS wi...
42
    <hr class="clear">
b550c2b0   Goutte   Rework the home s...
43
44
45
46

    <span class="mdl-layout-title">Parameters</span>

    <nav id="parameters" class="mdl-navigation">
6f9a3852   Goutte   Hide time series ...
47
      <a class="mdl-navigation__link parameter active" data-ts-slug="pdyn" href="">Dynamic Pressure</a>
a79c5268   Goutte   Add probes and co...
48
      <a class="mdl-navigation__link parameter active" data-ts-slug="magn" href="">B Tangential</a>
6f9a3852   Goutte   Hide time series ...
49
      <a class="mdl-navigation__link parameter active" data-ts-slug="vlen" href="">Velocity</a>
a79c5268   Goutte   Add probes and co...
50
51
52
      <a class="mdl-navigation__link parameter active" data-ts-slug="temp" href="">Temperature</a>
      <a class="mdl-navigation__link parameter active" data-ts-slug="dens" href="">Density</a>
      <a class="mdl-navigation__link parameter active" data-ts-slug="angl" href="">Angle Source-Sun-Earth</a>
b550c2b0   Goutte   Rework the home s...
53
54
    </nav>

c42fea3a   Goutte   Rework the CSS wi...
55
  </div>
b550c2b0   Goutte   Rework the home s...
56
57
  <main class="mdl-layout__content">

9390ec89   Goutte   Initial experimen...
58

b550c2b0   Goutte   Rework the home s...
59
60
61
62
63
64
65
66
67
    <div class="mdl-grid">
      <div class="mdl-cell mdl-cell--4-col">
        <section id="orbits"></section>
      </div>
      <div class="mdl-cell mdl-cell--8-col">
        <section id="time_series"></section>
      </div>
    </div>

ae0aa7d2   Goutte   Add an x axis lab...
68
{#    <div class="loader"><div class="hole"></div></div>#}
f6ed8d85   Goutte   Rework layout as ...
69
70
  </main>
</div>
9390ec89   Goutte   Initial experimen...
71
72
73
{% endblock %}


7d6dee0f   Goutte   Continue refacto ...
74

9390ec89   Goutte   Initial experimen...
75
76
{% block styles %}
  <style>
c42fea3a   Goutte   Rework the CSS wi...
77
    html, body {
f6ed8d85   Goutte   Rework layout as ...
78
79
{#      background-color: #322e3f;#}
{#      color: #e3e3e3;#}
c42fea3a   Goutte   Rework the CSS wi...
80
    }
18f38374   Goutte   Crisp edges for a...
81
82
    .axis path, .axis line {
      fill: none;
f6ed8d85   Goutte   Rework layout as ...
83
{#      stroke: #f4f4f4;#}
18f38374   Goutte   Crisp edges for a...
84
85
86
      shape-rendering: crispEdges;
      stroke-width: 1px;
    }
c42fea3a   Goutte   Rework the CSS wi...
87
    svg text {
f6ed8d85   Goutte   Rework layout as ...
88
{#      fill: #f4f4f4;#}
c42fea3a   Goutte   Rework the CSS wi...
89
    }
9390ec89   Goutte   Initial experimen...
90
91
92
93
94
    path.line {
      fill: none;
      stroke: steelblue;
      stroke-width: 1px;
    }
81c9b2e8   Goutte   Add the values to...
95
    circle.cursor-circle {
b550c2b0   Goutte   Rework the home s...
96
97
98
99
100
101
102
103
      fill: black;
      stroke: rgba(20, 20, 20, 0.48);
    }
    text.cursor-text {
{#      font-family: 'Ubuntu', 'Lucida Grande', 'Lucida Sans Unicode', 'Geneva', 'Verdana', sans-serif;#}
{#      font-family: 'Consolas', 'Deja Vu Sans Mono', 'Bitstream Vera Sans Mono', monospace;#}
      font-family: "Ubuntu Mono", 'Consolas', 'Deja Vu Sans Mono', 'Bitstream Vera Sans Mono', monospace;
      text-align: right;
81c9b2e8   Goutte   Add the values to...
104
105
106
    }
    text.cursor-text-shadow {
      stroke: white;
b550c2b0   Goutte   Rework the home s...
107
108
      stroke-width: 5px;
      opacity: 0.777
81c9b2e8   Goutte   Add the values to...
109
    }
c42fea3a   Goutte   Rework the CSS wi...
110
    path.orbit.orbit_section {
2d2af24b   Goutte   Add a basic orbit...
111
112
      fill: none;
      stroke: steelblue;
c42fea3a   Goutte   Rework the CSS wi...
113
114
115
116
117
118
119
120
      stroke-width: 3px;
    }
    ellipse.orbit.orbit_ellipse {
      fill: none;
      stroke: #a3a3a3;
      stroke-width: 1px;
      stroke-dasharray: 5px;
    }
a79c5268   Goutte   Add probes and co...
121
122
123
    #orbiters_filters {
      padding-left: 17px;
    }
c42fea3a   Goutte   Rework the CSS wi...
124
125
126
127
128
129
130
131
132
133
134
135
    #orbiters_filters img {
      float: left;
    }
    #orbiters_filters img.locked {
      -webkit-filter: grayscale(100%);
         -moz-filter: grayscale(100%);
           -o-filter: grayscale(100%);
          -ms-filter: grayscale(100%);
              filter: grayscale(100%);
    }

    #orbits {
f6ed8d85   Goutte   Rework layout as ...
136
137
138
{#      background-image: url('{{ static('img/orbitals_background.png') }}');#}
{#      background-repeat: repeat;#}
{#      background-size: 42%;#}
2d2af24b   Goutte   Add a basic orbit...
139
    }
6f9a3852   Goutte   Hide time series ...
140
141
142
143
144
145
146

    #parameters .parameter {
      outline: 0;
    }
    #parameters .parameter.active {
      background-color: #c8d3e1;
    }
9390ec89   Goutte   Initial experimen...
147
148
149
150
  </style>
{% endblock %}


7d6dee0f   Goutte   Continue refacto ...
151

9390ec89   Goutte   Initial experimen...
152
{% block scripts_footer %}
84cb553d   Goutte   Move to material ...
153
<script type="application/javascript" src="{{ static('js/vendor/d3.min.js') }}"></script>
438929a4   Goutte   Rewrite the orbit...
154
<script type="application/javascript" src="{{ static('js/swapp.js') }}"></script>
9390ec89   Goutte   Initial experimen...
155
156
<script type="application/javascript">

ae0aa7d2   Goutte   Add an x axis lab...
157
158
159
var configuration = {
  time_series_container: '#time_series',
  orbits_container: '#orbits',
f75faf5f   Goutte   WIP
160
161
162
163
  api : {
      'data_for_interval': "{{ request.url_root }}<source>/data.csv"
                           // ?started_at=<started_at>&stopped_at=<stopped_at>
  },
8bd715ad   Goutte   Use a pixel art i...
164
165
166
  sun: {
    img: '{{ static('img/sun_128.png') }}'
  },
ae0aa7d2   Goutte   Add an x axis lab...
167
  sources : {
a21f81d9   Goutte   Enable Venus and ...
168
169
170
171
172
{% for target in targets if not target.locked%}
    {% if not loop.first %},{% endif %}
    '{{ target.slug }}': {
      slug: '{{ target.slug }}',
      name: '{{ target.name }}',
ae0aa7d2   Goutte   Add an x axis lab...
173
      active: true,
a21f81d9   Goutte   Enable Venus and ...
174
175
      orbit: { a: {{ target.orbit.semimajor }}, b: {{ target.orbit.semiminor }} },
      img: '{{ static('img/target/'~target.slug~'_128.png') }}'
ae0aa7d2   Goutte   Add an x axis lab...
176
    }
a21f81d9   Goutte   Enable Venus and ...
177
178
179
180
181
182
183
184
185
186
{% endfor %}
{#    jupiter: {#}
{#      slug: 'jupiter',#}
{#      name: 'Jupiter',#}
{#      active: true,#}
{#      minDate: '1990-01-01T01:30:00',#}
{#      maxDate: '2017-02-19T00:00:00',#}
{#      orbit: { a: 5.45516759, b: 4.95155843 },#}
{#      img: '{{ static('img/target/jupiter_128.png') }}'#}
{#    },#}
aba70d3a   Goutte   Refactor time ser...
187
  },
f75faf5f   Goutte   WIP
188
{# todo @Nicolas Define -somehow- error margins of each parameter #}
aba70d3a   Goutte   Refactor time ser...
189
190
191
  parameters : [
    {
      id: 'pdyn',
f75faf5f   Goutte   WIP
192
193
      title: "Dynamic Pressure (nPa)",
      unit: "nPa"
aba70d3a   Goutte   Refactor time ser...
194
195
196
    },
    {
      id: 'magn',
f75faf5f   Goutte   WIP
197
198
      title: "Magnetism (nT)",
      unit: "nT"
aba70d3a   Goutte   Refactor time ser...
199
200
201
    },
    {
      id: 'vlen',
f75faf5f   Goutte   WIP
202
203
      title: "Velocity (km/s)",
      unit: "km/s"
aba70d3a   Goutte   Refactor time ser...
204
205
206
    },
    {
      id: 'temp',
f75faf5f   Goutte   WIP
207
208
      title: "Temperature (K)",
      unit: "K"
aba70d3a   Goutte   Refactor time ser...
209
210
211
    },
    {
      id: 'dens',
f75faf5f   Goutte   WIP
212
213
      title: "Density N (cm⁻³)",
      unit: "cm⁻³"
aba70d3a   Goutte   Refactor time ser...
214
215
216
    },
    {
      id: 'angl',
f75faf5f   Goutte   WIP
217
218
      title: "Angle S-S-E (deg)",
      unit: "deg"
aba70d3a   Goutte   Refactor time ser...
219
220
    }
  ]
438929a4   Goutte   Rewrite the orbit...
221
};
9390ec89   Goutte   Initial experimen...
222
223

jQuery().ready(function($){
ae0aa7d2   Goutte   Add an x axis lab...
224
  var sw = new SpaceWeather(configuration);
fe3132dd   Goutte   Refactor even more.
225
  sw.init();
ae0aa7d2   Goutte   Add an x axis lab...
226

6f9a3852   Goutte   Hide time series ...
227
228
229
230
231
232
233
234
235
236
  var toggleTimeSeries = function(slug) {
    $('#time_series .'+slug).toggleClass('hidden');
  };

  $("#parameters .parameter").click(function(e){
    $(this).toggleClass('active');
    toggleTimeSeries($(this).attr('data-ts-slug'));
    return false;
  });

961953c4   Goutte   Move targets to t...
237
  window.addEventListener('resize', function() { sw.resize(); });
9390ec89   Goutte   Initial experimen...
238
239
});
</script>
9390ec89   Goutte   Initial experimen...
240
{% endblock %}