Commit 8a2f5439 authored by Weblate's avatar Weblate

Merge remote-tracking branch 'origin/master'

parents 06836aee e756cb1e
...@@ -112,7 +112,7 @@ ...@@ -112,7 +112,7 @@
</div> </div>
</form> </form>
<ul class="nav nav-pills"> <ul class="nav nav-pills translation-tabs">
<li class="active"><a href="#nearby" data-toggle="tab" title="{% trans "Messages placed around this one" %}">{% trans "Nearby messages" %}</a></li> <li class="active"><a href="#nearby" data-toggle="tab" title="{% trans "Messages placed around this one" %}">{% trans "Nearby messages" %}</a></li>
{% if unit.suggestions %} {% if unit.suggestions %}
<li><a href="#suggestions" data-toggle="tab">{% trans "Suggestions" %} <span class="badge">{{ unit.suggestions.count }}</span></a></li> <li><a href="#suggestions" data-toggle="tab">{% trans "Suggestions" %} <span class="badge">{{ unit.suggestions.count }}</span></a></li>
......
...@@ -429,11 +429,19 @@ $(function () { ...@@ -429,11 +429,19 @@ $(function () {
/* Load correct tab */ /* Load correct tab */
if (location.hash !== '') { if (location.hash !== '') {
/* From URL hash */
var activeTab = $('[data-toggle=tab][href=' + location.hash + ']'); var activeTab = $('[data-toggle=tab][href=' + location.hash + ']');
if (activeTab.length) { if (activeTab.length) {
activeTab.tab('show'); activeTab.tab('show');
window.scrollTo(0, 0); window.scrollTo(0, 0);
} }
} else if ($('.translation-tabs').length > 0 && $.cookie('translate-tab')) {
/* From cookie */
console.log('switch ' + $.cookie('translate-tab'));
var activeTab = $('[data-toggle=tab][href=' + $.cookie('translate-tab') + ']');
if (activeTab.length) {
activeTab.tab('show');
}
} }
/* Add a hash to the URL when the user clicks on a tab */ /* Add a hash to the URL when the user clicks on a tab */
...@@ -443,6 +451,11 @@ $(function () { ...@@ -443,6 +451,11 @@ $(function () {
$('.selectable-row').removeClass('active'); $('.selectable-row').removeClass('active');
}); });
/* Store active translation tab in cookie */
$('.translation-tabs a[data-toggle="tab"]').on('shown.bs.tab', function(e) {
$.cookie('translate-tab', $(this).attr('href'));
});
/* Navigate to a tab when the history changes */ /* Navigate to a tab when the history changes */
window.addEventListener("popstate", function(e) { window.addEventListener("popstate", function(e) {
var activeTab = $('[data-toggle=tab][href=' + location.hash + ']'); var activeTab = $('[data-toggle=tab][href=' + location.hash + ']');
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment