Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfixes #104

Merged
merged 10 commits into from
Apr 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
134 changes: 82 additions & 52 deletions alouette.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,38 +104,48 @@ def interpolate_index(self, **kwargs):

scripts = ASSET_PATH.joinpath("scripts.js").resolve()

# external_stylesheets = ['https://wet-boew.github.io/themes-dist/GCWeb/assets/favicon.ico',
# 'https://use.fontawesome.com/releases/v5.8.1/css/all.css',
# 'https://wet-boew.github.io/themes-dist/GCWeb/css/theme.min.css',
# 'https://wet-boew.github.io/themes-dist/GCWeb/wet-boew/css/noscript.min.css'] # Link to external CSS
external_stylesheets = [
'https://canada.ca/etc/designs/canada/wet-boew/css/wet-boew.min.css',
'https://canada.ca/etc/designs/canada/wet-boew/css/theme.min.css',
'https://use.fontawesome.com/releases/v5.8.1/css/all.css'
# 'assets/gc_theme_cdn/assets/favicon.ico',
# 'https://use.fontawesome.com/releases/v5.8.1/css/all.css',
# 'assets/gc_theme_cdn/css/theme.min.css',
# 'https://wet-boew.github.io/themes-dist/GCWeb/wet-boew/css/noscript.min.css'
] # Link to external CSS

external_scripts = [
# 'https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.js',
# 'https://wet-boew.github.io/themes-dist/GCWeb/wet-boew/js/wet-boew.min.js',
# 'assets/gc_theme_cdn/js/theme.min.js',
# 'https://cdn.plot.ly/plotly-locale-de-latest.js',
'//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js',
'https://canada.ca/etc/designs/canada/wet-boew/js/wet-boew.min.js',
'https://canada.ca/etc/designs/canada/wet-boew/js/theme.min.js',
'assets/scripts.js'


]

# external_stylesheets = [
# # 'assets/gc_theme/GCWeb/assets/favicon.ico',
# # 'https://wet-boew.github.io/themes-dist/GCWeb/GCWeb/assets/favicon.ico',
# 'https://use.fontawesome.com/releases/v5.8.1/css/all.css',
# # 'assets/gc_theme/GCWeb/css/theme.min.css',
# 'https://wet-boew.github.io/themes-dist/GCWeb/GCWeb/css/theme.min.css',
# 'assets/custom.css'
# # 'assets/gc_theme/wet-boew/css/noscript.min.css',
# # 'https://www.canada.ca/etc/designs/canada/cdts/gcweb/v4_0_30/cdts/compiled/wet-en.js'
# ] # Link to external CSS

external_stylesheets = [
# 'https://wet-boew.github.io/themes-dist/GCWeb/GCWeb/assets/favicon.ico',
'https://use.fontawesome.com/releases/v5.8.1/css/all.css',
'https://wet-boew.github.io/themes-dist/GCWeb/GCWeb/css/theme.min.css',
'assets/custom.css'
# 'assets/gc_theme/wet-boew/css/noscript.min.css',
# 'https://www.canada.ca/etc/designs/canada/cdts/gcweb/v4_0_30/cdts/compiled/wet-en.js'
] # Link to external CSS

external_scripts = [
'https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.js',
'https://wet-boew.github.io/themes-dist/GCWeb/wet-boew/js/i18n/en.min.js',
'https://cdn.plot.ly/plotly-locale-de-latest.js',
'https://wet-boew.github.io/themes-dist/GCWeb/wet-boew/js/deps/jquery.magnific-popup.min.js',
'https://wet-boew.github.io/themes-dist/GCWeb/GCWeb/js/theme.min.js',
'assets/scripts.js',
# 'https://www.canada.ca/etc/designs/canada/cdts/gcweb/v4_0_30/cdts/compiled/wet-en.js',
# 'https://www.canada.ca/etc/designs/canada/cdts/gcweb/v4_0_30/cdts/compiled/soyutils.js'
]
# external_scripts = [
# 'https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.js',
# 'https://wet-boew.github.io/themes-dist/GCWeb/wet-boew/js/i18n/en.min.js',
# 'https://cdn.plot.ly/plotly-locale-de-latest.js',
# 'https://wet-boew.github.io/themes-dist/GCWeb/wet-boew/js/deps/jquery.magnific-popup.min.js',
# 'https://wet-boew.github.io/themes-dist/GCWeb/GCWeb/js/theme.min.js',
# 'assets/scripts.js',
# # 'https://www.canada.ca/etc/designs/canada/cdts/gcweb/v4_0_30/cdts/compiled/wet-en.js',
# # 'https://www.canada.ca/etc/designs/canada/cdts/gcweb/v4_0_30/cdts/compiled/soyutils.js'
# ]

def get_config_dict():
config = configparser.RawConfigParser()
Expand Down Expand Up @@ -167,7 +177,7 @@ def generate_meta_tag(name, content):

else :
prefixe="/alouette"
from .header_footer import gc_header_en, gc_footer_en, gc_header_fr, gc_footer_fr, app_title_en, app_title_fr
from .header_footer import gc_header_en, gc_footer_en, gc_header_fr, gc_footer_fr, app_title_en
from .analytics import analytics_code
from .config import Config
app_config = Config()
Expand Down Expand Up @@ -201,7 +211,7 @@ def generate_meta_tag(name, content):
)
meta_html += generate_meta_tag('keywords', '')
app.title="SCISAT : application d’exploration des données de composition atmosphérique"
app.set_app_header(app_title_fr)
# app.set_app_header(app_title_fr)

app.set_meta_tags(meta_html)
app.set_analytics(analytics_code)
Expand Down Expand Up @@ -491,8 +501,10 @@ def build_filtering():
step=5,
style={"margin-left": "5px"}
)
]),
html.Span(children=html.P(id="lat_selection"),className="wb-inv")],
]
),
html.Div(children=html.P(id="lat_selection"),className="wb-inv")
],
className="col-md-6"
),
html.Div(
Expand Down Expand Up @@ -541,7 +553,7 @@ def build_filtering():
style={"margin-left": "5px"}
)
]),
html.Span(children=html.P(id="lon_selection"),className="wb-inv")],
html.Div(children=html.P(id="lon_selection"),className="wb-inv")],
className="col-md-6"
),
],
Expand All @@ -565,9 +577,6 @@ def build_filtering():
# marks=year_dict
# ),
html.Div([
html.Label(
htmlFor='date_picker_range'
),
dcc.DatePickerRange(
id='date_picker_range',
min_date_allowed=dt.datetime(1962, 9, 29),
Expand All @@ -581,19 +590,19 @@ def build_filtering():
style={"margin-top": "5px"}
),
html.Div(id='output-container-date-picker-range'),
html.Span(children=html.P(id="date_selection"),className="wb-inv")]),
html.Div(children=html.P(id="date_selection"),className="wb-inv")]),
],
id="cross-filter-options",
className="",
),
html.Div(
[
html.Div([
html.Span(
html.Div(
[
html.Label(
id="groundstations-text",
htmlFor="ground_station_list",
htmlFor="ground_station_list_dropdown",
className="control_label",
),
dcc.Dropdown(
Expand All @@ -602,14 +611,23 @@ def build_filtering():
placeholder=_("Sélectionner | Select"),
multi=True,
value=station_values,
className="dcc_control"
className="dcc_control",
label = 'Label test'
),
],
className="drop_down",
className="drop_down col-md-6",
role="listbox",
**{'aria-label': 'Select plotted value'}
),
html.Span(children=html.P(id="ground_station_selection"),className="wb-inv")]),
html.Div(children=html.P(id="ground_station_selection"),className="wb-inv")]),
html.Div([
dbc.Alert(color="secondary", id="pos_alert", is_open=False, fade=False, style={"margin-top":"0.5em"}),
dbc.Alert(
color="secondary",
id="pos_alert",
is_open=False,
fade=False,
style={"margin-top":"0.5em"}
),
]),

],
Expand All @@ -632,7 +650,7 @@ def build_filtering():
style={"margin-left": "5px"},
className="btn btn-primary"
),
html.Span(children=html.P(id="download_selection"),className="wb-inv"),
html.Div(children=html.P(id="download_selection"),className="wb-inv"),
html.Div ([html.B(id="Download_limit")]),
],
),
Expand Down Expand Up @@ -705,7 +723,7 @@ def build_stats():
html.Div(
[
html.Label(
htmlFor='x_axis_selection_1',
htmlFor='x_axis_selection_1_dropdown',
id="x-axis-selection-text",
className="control_label",
),
Expand All @@ -714,17 +732,19 @@ def build_stats():
options=x_axis_options,
multi=False,
value='timestamp',
className="dcc_control"
className="dcc_control",
label = 'Label test'
),
],
className="drop_down col-md-6",
role="listbox",
style={'max-width': '400px'}
style={'max-width': '400px'},
**{'aria-label': 'Select x-axis'}
),
html.Div(
[
html.Label(
htmlFor='y_axis_selection_1',
htmlFor='y_axis_selection_1_dropdown',
id="y-axis-selection-text",
className="control_label",
),
Expand All @@ -734,11 +754,13 @@ def build_stats():
multi=False,
value='max_depth',
className="dcc_control",
label = 'Label test'
),
],
className="drop_down col-md-6",
role="listbox",
style={'max-width': '400px'}
style={'max-width': '400px'},
**{'aria-label': 'Select y-axis'}
),
],
className="row",
Expand Down Expand Up @@ -779,7 +801,7 @@ def build_stats():
html.Div(
[
html.Label(
htmlFor="stat_selection",
htmlFor="stat_selection_dropdown",
id="stat-selection-text",
className="control_label",
),
Expand All @@ -791,17 +813,19 @@ def build_stats():
],
multi=False,
value='mean',
className="dcc_control"
className="dcc_control",
label = 'Label test'
),
],
className="drop_down col-md-6",
role="listbox",
style={'max-width': '400px'}
style={'max-width': '400px'},
**{'aria-label': 'Select Statistic'}
),
html.Div(
[
html.Label(
htmlFor="y_axis_selection_2",
htmlFor="y_axis_selection_2_dropdown",
id="stat-y-axis-text",
className="control_label",
),
Expand All @@ -810,12 +834,14 @@ def build_stats():
options=y_axis_options,
multi=False,
value='max_depth',
className="dcc_control"
className="dcc_control",
label = 'Label test'
),
],
className="drop_down col-md-6",
role="listbox",
style={'max-width': '400px'}
style={'max-width': '400px'},
**{'aria-label': 'Select plotted value'}
),
],
className="row",
Expand Down Expand Up @@ -2046,6 +2072,8 @@ def make_viz_map(start_date, end_date, stat_selection, var_selection, lat_min, l
Output("Graph_description-2", "children"),
Output("stat-selection-text", "children"),
Output("stat-y-axis-text", "children"),
Output("date_picker_range", "start_date_placeholder_text"),
Output("date_picker_range", "end_date_placeholder_text"),
Output("ground_station_list", "options"),
Output("x_axis_selection_1", "options"),
Output("y_axis_selection_1", "options"),
Expand Down Expand Up @@ -2088,6 +2116,8 @@ def translate_static(x):
_("Map showing either minimum frequency or maximum depth values at each ground station. Each station is represented by a circle, the size of which depends on either the mean or median values of the variables selected. Explore the data by selecting different variables in the drop-down menu on the right."),
_("Select statistic:"),
_("Select plotted value:"),
_("Select start date"),
_("Select end date"),
[ # Ground_station_options
{'label': _('Resolute Bay, No. W. Territories'), 'value': 'Resolute Bay, No. W. Territories'},
{'label': _('Blossom Point, Maryland'), 'value': 'Blossom Point, Maryland'},
Expand Down
9 changes: 6 additions & 3 deletions assets/compiled.css
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ input[type="button"] {
padding: 0 30px;
color: #f2f2f2;
text-align: center;
#font-size: 11px;
/* font-size: 11px; */
font-weight: 600;
line-height: 38px;
letter-spacing: 0.1rem;
Expand All @@ -218,8 +218,6 @@ input[type="button"] {
font-size: 13px;
}


}
.button:hover,
button:hover,
input[type="submit"]:hover,
Expand Down Expand Up @@ -280,6 +278,11 @@ select {
font-family: inherit;
font-size: inherit; /*https://stackoverflow.com/questions/6080413/why-doesnt-input-inherit-the-font-from-body*/
}

.Select-placeholder{
color: #000000;
}

/* Removes awkward default styles on some inputs for iOS */
input[type="email"],
input[type="number"],
Expand Down
19 changes: 19 additions & 0 deletions assets/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ const expected_canvas_count = 8;
$(document).ready(function(){
var canvas_check = setInterval(checkForCanvases, 3000);

var css_fixer = setInterval(removeBaddCss, 3500);

var ariaFixes = setInterval(function(){
var dropdowns = $('.Select-input input');
dropdowns.removeAttr('aria-owns');
$('.Select-input').attr('role', 'option');
}, 3000);

// Callback function to execute when mutations are observed
const callback = function(mutationsList, observer) {
// Use traditional 'for loops' for IE 11
Expand All @@ -17,6 +25,17 @@ $(document).ready(function(){
}
};

function removeBaddCss(){
$("head").find('style').each(function () {
// console.log('removing css');
html = $(this).html();
if(html.match(/border-color:\s*transparent\s*inherit\s*transparent\s*transparent\s*!important/gm)){
$(this).html( html.replace(/border-color:\s*transparent\s*inherit\s*transparent\s*transparent\s*!important/gm,"") );
}
});

}

// Create an observer instance linked to the callback function
const observer = new MutationObserver(callback);

Expand Down
Loading