Commit dd8621f8c3055afda50e9db1002bdd2b04e6b644

Authored by Goutte
1 parent d08bc6bc

Play some accordion for Nicolas.

Showing 1 changed file with 86 additions and 50 deletions   Show diff stats
web/view/home.html.jinja2
... ... @@ -62,38 +62,50 @@
62 62  
63 63 <div class="mdl-layout__drawer">
64 64  
65   - <span class="mdl-layout-title" title="Two years maximum.">{{ icon('calendar') }} Time Interval</span>
66   -
67   - <form id="form_time_interval" action="#">
68   - <div class="mdl-textfield mdl-js-textfield">
69   - <input type="date" id="started_at" name="started_at" title="The date of the beginning of the interval to observe." class="mdl-textfield__input">
70   - <input type="date" id="stopped_at" name="stopped_at" title="The date of the end of the interval to observe. (exclusive)" class="mdl-textfield__input">
71   - </div>
72   - <input type="submit" id="apply_new_interval" value="Load new interval" title="Two years maximum. This may take a while." class="mdl-button mdl-js-button mdl-js-ripple-effect">
73   - </form>
  65 + <details open>
  66 + <summary>
  67 + <span class="mdl-layout-title" title="Two years maximum.">{{ icon('calendar') }} Time Interval</span>
  68 + </summary>
  69 +
  70 + <form id="form_time_interval" action="#">
  71 + <div class="mdl-textfield mdl-js-textfield">
  72 + <input type="date" id="started_at" name="started_at" title="The date of the beginning of the interval to observe." class="mdl-textfield__input">
  73 + <input type="date" id="stopped_at" name="stopped_at" title="The date of the end of the interval to observe. (exclusive)" class="mdl-textfield__input">
  74 + </div>
  75 + <input type="submit" id="apply_new_interval" value="Load new interval" title="Two years maximum. This may take a while." class="mdl-button mdl-js-button mdl-js-ripple-effect">
  76 + </form>
  77 + </details>
74 78  
75 79 <hr class="clear">
76 80  
77   - <span class="mdl-layout-title">{{ icon('eercast') }} Planets</span>
  81 + <details open>
  82 + <summary>
  83 + <span class="mdl-layout-title">{{ icon('eercast') }} Planets</span>
  84 + </summary>
78 85  
79   - <section class="targets-filters">
80   -{% for target in planets %}
81   - {{ target_button(target) }}
82   -{% endfor %}
83   - </section>
  86 + <section class="targets-filters">
  87 + {% for target in planets %}
  88 + {{ target_button(target) }}
  89 + {% endfor %}
  90 + </section>
  91 + </details>
84 92  
85 93 <hr class="clear">
86 94  
87   - <span class="mdl-layout-title">{{ icon('rocket') }} Probes &amp; Comets</span>
88   -
89   - <section class="targets-filters">
90   -{% for target in probes %}
91   - {{ target_button(target) }}
92   -{% endfor %}
93   -{% for target in comets %}
94   - {{ target_button(target) }}
95   -{% endfor %}
96   - </section>
  95 + <details>
  96 + <summary>
  97 + <span class="mdl-layout-title">{{ icon('rocket') }} Probes &amp; Comets</span>
  98 + </summary>
  99 +
  100 + <section class="targets-filters">
  101 + {% for target in probes %}
  102 + {{ target_button(target) }}
  103 + {% endfor %}
  104 + {% for target in comets %}
  105 + {{ target_button(target) }}
  106 + {% endfor %}
  107 + </section>
  108 + </details>
97 109  
98 110 <hr class="clear">
99 111  
... ... @@ -113,27 +125,36 @@
113 125 {##}
114 126 {# <hr class="clear">#}
115 127  
116   - <span class="mdl-layout-title">{{ icon('flask') }} Parameters</span>
  128 + <details>
  129 + <summary>
  130 + <span class="mdl-layout-title">{{ icon('flask') }} Parameters</span>
  131 + </summary>
117 132  
118   - <nav id="parameters" class="mdl-navigation">
119   -{% for p in parameters %}
120   - <a class="mdl-navigation__link parameter{{ ' active' if p.active }}" data-ts-slug="{{ p.slug }}" href="#" title="{{ p.title }} ({{ p.units }})">{{ p.name }}</a>
121   -{% endfor %}
122   - </nav>
  133 + <nav id="parameters" class="mdl-navigation">
  134 + {% for p in parameters %}
  135 + <a class="mdl-navigation__link parameter{{ ' active' if p.active }}" data-ts-slug="{{ p.slug }}" href="#" title="{{ p.title }} ({{ p.units }})">{{ p.name }}</a>
  136 + {% endfor %}
  137 + </nav>
  138 + </details>
123 139  
124   - <hr class="clear">
125 140  
126   - <span class="mdl-layout-title">{{ icon('area-chart') }} Layers</span>
  141 + <hr class="clear">
127 142  
128   - <section class="section-drawer">
129   -{% for layer in config.layers %}
130   - <label class="mdl-radio mdl-js-radio mdl-js-ripple-effect" for="option-layer-{{ layer.slug }}" title="{{ layer.desc }}">
131   - <input type="checkbox" disabled id="option-layer-{{ layer.slug }}" class="mdl-radio__button" name="layer_slug" value="{{ layer.slug }}" {{ 'checked' if layer.slug == layer_slug }}>
132   - <span class="mdl-radio__label">{{ layer.name }}</span>
133   - </label>
134   - <br />
135   -{% endfor %}
136   - </section>
  143 + <details>
  144 + <summary>
  145 + <span class="mdl-layout-title">{{ icon('area-chart') }} Layers</span>
  146 + </summary>
  147 +
  148 + <section class="section-drawer">
  149 + {% for layer in config.layers %}
  150 + <label class="mdl-radio mdl-js-radio mdl-js-ripple-effect" for="option-layer-{{ layer.slug }}" title="{{ layer.desc }}">
  151 + <input type="checkbox" disabled id="option-layer-{{ layer.slug }}" class="mdl-radio__button" name="layer_slug" value="{{ layer.slug }}" {{ 'checked' if layer.slug == layer_slug }}>
  152 + <span class="mdl-radio__label">{{ layer.name }}</span>
  153 + </label>
  154 + <br />
  155 + {% endfor %}
  156 + </section>
  157 + </details>
137 158  
138 159 <div class="mdl-layout-spacer"></div>
139 160  
... ... @@ -166,12 +187,13 @@
166 187 </button>
167 188 <button id="samp"
168 189 class="samp mdl-button mdl-button--raised mdl-button--primary mdl-button--disabled"
169   - title="Send the data to a connected SAMP hub.">
  190 + title="Send the data to a connected SAMP hub, such as TOPCAT.">
170 191 SAMP
171 192 </button>
172 193 <button id="email_alert"
173   - class="mdl-button mdl-button--raised mdl-button--primary mdl-button--disabled"
174   - title="Set an alert to receive an email when the data validates pre-defined conditions.">
  194 + class="mdl-button mdl-button--raised mdl-button--primary"
  195 + title="Set an alert to receive an email when the data validates pre-defined conditions."
  196 + data-href="http://alerts-psws.irap.omp.eu/tao">
175 197 Alert
176 198 </button>
177 199 </div>
... ... @@ -192,11 +214,19 @@
192 214  
193 215 {% block styles %}
194 216 <style>
195   - .mdl-layout__drawer > .mdl-layout-title {
196   - padding-left: 30px;
  217 + .mdl-layout__drawer hr {
  218 + margin: 0.5em 0;
  219 + }
  220 + .mdl-layout__drawer .mdl-layout-title {
197 221 line-height: 42px;
  222 + display: inline-block;
198 223 }
199   - .mdl-layout__drawer > .mdl-layout-title:first-of-type {
  224 + .mdl-layout__drawer > details > summary {
  225 + padding-left: 15px;
  226 + cursor: pointer;
  227 + outline: none;
  228 + }
  229 + .mdl-layout__drawer .mdl-layout-title:first-of-type {
200 230 line-height: 60px;
201 231 }
202 232  
... ... @@ -714,12 +744,18 @@ jQuery().ready(function($){
714 744 sw.orbits.resize(true);
715 745 return false;
716 746 });
  747 + $('#email_alert').on("click", function(e){
  748 + console.info("Setting an alert…");
  749 + var href = $(this).attr("data-href");
  750 + window.open(href);
  751 + return false;
  752 + });
717 753  
718 754 });
719 755 </script>
720 756  
721 757 {#### SAMP ###################################################################}
722   -<script type="text/javascript">
  758 +<script type="application/javascript">
723 759 jQuery().ready(function ($) {
724 760 // Flag to know when a hub is connected or not
725 761 var isConnected = false;
... ... @@ -739,7 +775,7 @@ jQuery().ready(function($){
739 775  
740 776 // Update the document about the presence of any SAMP hub every 10 sec.
741 777 var connector = new samp.Connector("Sender");
742   - connector.onHubAvailability(onHubAvailability, 10000);
  778 + connector.onHubAvailability(onHubAvailability, 5000);
743 779 window.onunload = function () {
744 780 connector.unregister();
745 781 };
... ...