From 267b611a7819a22e711f1703ec8eaa045e5ffab2 Mon Sep 17 00:00:00 2001 From: Anton Khorev Date: Fri, 20 Jun 2025 14:54:18 +0300 Subject: [PATCH] Put language select button next to login button --- app/assets/javascripts/application.js | 11 +++-------- app/views/layouts/_header.html.erb | 5 ++--- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index ad9dea84d..a11973286 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -101,8 +101,7 @@ $(function () { $collapsedSecondaryMenu = $("#compact-secondary-nav > ul"), secondaryMenuItems = [], breakpointWidth = 768; - let moreItemWidth = 0, - notCollapsibleItemsWidth = 0; + let moreItemWidth = 0; OSM.csrf = {}; OSM.csrf[($("meta[name=csrf-param]").attr("content"))] = $("meta[name=csrf-token]").attr("content"); @@ -119,7 +118,7 @@ $(function () { secondaryMenuItems.forEach(function (item) { $(item[0]).remove(); }); - let runningWidth = notCollapsibleItemsWidth, + let runningWidth = 0, i = 0, requiredWidth; for (; i < secondaryMenuItems.length; i++) { @@ -178,14 +177,10 @@ $(function () { * to defer the measurement slightly as a workaround. */ setTimeout(function () { - $expandedSecondaryMenu.find("li:not(#compact-secondary-nav):not(.not-collapsible)").each(function () { + $expandedSecondaryMenu.find("li:not(#compact-secondary-nav)").each(function () { secondaryMenuItems.push([this, $(this).width()]); }); moreItemWidth = $("#compact-secondary-nav").width(); - notCollapsibleItemsWidth = $expandedSecondaryMenu - .find("li.not-collapsible") - .toArray() - .reduce((accWidth, item) => accWidth + $(item).outerWidth(), 0); updateHeader(); diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb index 6206f3dd8..884e61acc 100644 --- a/app/views/layouts/_header.html.erb +++ b/app/views/layouts/_header.html.erb @@ -66,10 +66,9 @@ - + + <%= render "layouts/select_language_button" %> <% if current_user && current_user.id %>