Skip to content

Commit a17b08d

Browse files
uyen-nhuAkron
authored andcommitted
UI improvements and bug fixes (2025-03-04)
- Add shortening function to username, if username is too long (max. 6 characters). - Change 'doc' to 'doc_start' in help button. - Remove help button from dropdown list and add it to navbar. - Remove headerButtonGroup and add links directly to header.html.ep. - Remove tooltip from help button. - Fix sidebar appearance when user navigates to /settings. - Fix content shift for pages (due to /settings modification). - Change fixed value for hint positioning to dynamic value. Change-Id: I7ee84bff170c4985494895cdacd1ed77d60320db
1 parent 4371466 commit a17b08d

File tree

11 files changed

+72
-25
lines changed

11 files changed

+72
-25
lines changed

Makefile.PL

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ WriteMakefile(
2727
'Mojolicious::Plugin::CHI' => 0.20,
2828
'Mojolicious::Plugin::ClientIP' => 0.02,
2929
'Mojolicious::Plugin::AutoSecrets' => 0.006,
30-
'Mojolicious::Plugin::TagHelpers::ContentBlock' => 0.11,
30+
'Mojolicious::Plugin::TagHelpers::ContentBlock' => 0.12,
3131
'Cache::FastMmap' => 1.57,
3232
'DateTime' => 1.63,
3333

dev/js/src/init.js

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,14 @@ define([
143143

144144
// Responsive navbar: hide and show burger menu
145145
const burgerIcon = document.querySelector('.burger-icon');
146+
const navbarGroup = document.querySelector('.navbar-group');
147+
148+
if (burgerIcon && navbarGroup) {
149+
if (navbarGroup.innerHTML.trim() !== '') {
150+
burgerIcon.classList.add('show');
151+
}
152+
}
153+
146154
let isBurgerMenuOpen = false;
147155

148156
if (burgerIcon) {
@@ -322,9 +330,9 @@ define([
322330
document.body.removeChild(span);
323331
let hintLeftPosition = inputWidth;
324332

325-
// TODO: This shouldn't be a fixed position!
326333
if (aside && aside.classList.contains('active') && !isSmallScreen) {
327-
hintLeftPosition += 230;
334+
const asideWidth = aside.getBoundingClientRect().width;
335+
hintLeftPosition += asideWidth;
328336
}
329337

330338
hint.style.left = `${hintLeftPosition}px`;
@@ -342,7 +350,9 @@ define([
342350
if (mutation.type === 'childList') {
343351
const hint = document.querySelector('#hint');
344352
if (hint) {
345-
shiftContent();
353+
if (window.location.pathname !== '/settings' && window.location.pathname !== '/settings/') {
354+
shiftContent();
355+
}
346356
observer.disconnect();
347357
KorAP.Hint.alert().show();
348358
}
@@ -389,6 +399,18 @@ define([
389399
});
390400
}
391401

402+
if (window.location.pathname === '/settings' || window.location.pathname === '/settings/') {
403+
const header = document.querySelector('header');
404+
const main = document.querySelector('main');
405+
const footer = document.querySelector('footer');
406+
407+
aside.style.display = 'none';
408+
409+
if (header) header.style.setProperty('padding-left', '0', 'important');
410+
if (main) main.style.setProperty('padding-left', '0', 'important');
411+
if (footer) footer.style.setProperty('padding-left', '0', 'important');
412+
}
413+
392414
// Replace QL select menus with KorAP menus
393415
var qlField = d.getElementById('ql-field');
394416
if (qlField !== null) {

dev/scss/header/header.scss

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
-o-transition: all .2s ease-in-out;
4242
-moz-transition: all .2s ease-in-out;
4343
-webkit-transition: all .2s ease-in-out;
44+
cursor: pointer;
4445

4546
&:hover {
4647
background-color: $middle-green;
@@ -50,6 +51,7 @@
5051
display: block;
5152
padding: 1.5rem 1rem;
5253
color: $nearly-white;
54+
cursor: pointer;
5355
}
5456
}
5557
}
@@ -72,6 +74,9 @@
7274
}
7375

7476
&-btn {
77+
display: flex;
78+
align-items: center;
79+
column-gap: $base-padding;
7580
height: $standard-size-and-spacing;
7681
padding: 1.25rem 1rem;
7782
color: $nearly-white;
@@ -95,9 +100,12 @@
95100

96101
h3.user-name {
97102
padding-right: 2px;
98-
// font-size: 85%;
99103
font-size: 120%;
100-
display: inline;
104+
display: inline-block;
105+
max-width: 6ch;
106+
overflow: hidden;
107+
text-overflow: ellipsis;
108+
white-space: nowrap;
101109
}
102110
}
103111

@@ -297,10 +305,10 @@ header {
297305

298306
&.right {
299307
float: right;
300-
display: inline-block;
301-
>.tutorial{
302-
margin-left: 10px;
303-
}
308+
// display: inline-block;
309+
// >.tutorial{
310+
// margin-left: 10px;
311+
// }
304312
}
305313

306314
&.top {

dev/scss/media.scss

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,16 @@ $standard-margin: 4px;
4848

4949
.burger-icon {
5050
position: relative;
51-
display: block !important;
51+
display: none;
5252
width: $standard-size-and-spacing;
5353
height: $standard-size-and-spacing;
5454
font-size: 1.8rem;
5555
color: $nearly-white;
5656

57+
&.show {
58+
display: block;
59+
}
60+
5761
&::after {
5862
position: absolute;
5963
top: 2rem;
@@ -145,9 +149,14 @@ $standard-margin: 4px;
145149

146150
&.profile {
147151
& + .dropdown-content {
148-
margin-top: 4rem;
152+
margin-top: 3.9rem;
149153
}
150154
}
155+
156+
h3.user-name {
157+
max-width: unset;
158+
overflow: unset;
159+
}
151160
}
152161

153162
&-content {

kalamar.dict

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ my $THOUSAND_SEP_RE = qr/(
5454
},
5555
activateJS => 'Für den vollen Funktionsumfang aktivieren Sie bitte JavaScript!',
5656
faq => 'FAQ',
57-
tutorial => 'Einführung',
57+
tutorial => 'Hilfe',
58+
tour => 'Tour',
5859
notAvailInCorpus => 'Im vorliegenden Korpus nicht verfügbar',
5960
pubOn => 'veröffentlicht am',
6061
matchCount => 'Treffer',
@@ -191,7 +192,8 @@ my $THOUSAND_SEP_RE = qr/(
191192
faq => 'FAQ',
192193
'oclock' => 'o\'clock',
193194
underConstruction => 'Under Construction!',
194-
tutorial => 'Introduction',
195+
tutorial => 'Help',
196+
tour => 'Tour',
195197
korap => {
196198
-short => 'KorAP',
197199
label => '<%= loc "korap_short" %><% if (loc("title_addon")) { %>-<%= loc("title_addon") %><% } %>',

lib/Kalamar/Plugin/Auth.pm

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -243,11 +243,11 @@ sub register {
243243

244244

245245
# Add logout button to header button list
246-
$app->content_block(
247-
headerButtonGroup => {
248-
template => 'partial/auth/logout'
249-
}
250-
);
246+
# $app->content_block(
247+
# headerButtonGroup => {
248+
# template => 'partial/auth/logout'
249+
# }
250+
# );
251251

252252

253253
# Add hook after search

lib/Kalamar/Plugin/Auth/templates/partial/auth/login.html.ep

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
%# # user not logged in
2-
% if (!stash('documentation') && !$embedded && !$c->auth->token) {
2+
% if (!$embedded && !$c->auth->token) {
33
% if (flash('handle_or_email') && !param('handle_or_email')) {
44
% param(handle_or_email => flash('handle_or_email'));
55
%# Legacy-Support:

lib/Kalamar/Plugin/Auth/templates/partial/auth/logout.html.ep

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@
1212
<span><%= $item->{title} %></span>
1313
</a>
1414
<% } %>
15-
<a href="<%= url_for 'doc' %>" class="dropdown-item tutorial" id="view-tutorial" title="<%= loc 'tutorial' %>">
16-
<span><%= loc 'tutorial' %></span>
17-
</a>
1815
<a href="<%= url_for 'logout' %>"
1916
class="dropdown-item logout"
2017
title="<%= loc 'logout' %>: <%= user_handle %>">

templates/de/intro.html.ep

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<p><strong>KorAP</strong> ist eine neue Korpusanalyseplattform, optimiert für große, mehrfach annotierte Korpora und komplexe Suchmechanismen. Dabei versucht KorAP unabhängig von spezifischen Forschungsfragen zu sein.</p>
66

77
<p><noscript>KorAP erwartet für einige Funktionen die Aktivierung von JavaScript.</noscript></p>
8-
<p><strong>Neu bei KorAP?</strong> Dann starten Sie doch mit unserer <a class="link-guided-tour">Tour</a> oder lesen Sie unsere <%= doc_opener 'ql', begin %>Einführung<% end %>!</p>
8+
<p><strong>Neu bei KorAP?</strong> Dann starten Sie doch mit unserer <a class="link-guided-tour">Tour</a> oder schauen Sie in unsere <%= doc_opener 'ql', begin %>Hilfe<% end %>!</p>
99

1010
<p>KorAP wird am <a href="http://www.ids-mannheim.de">Leibniz-Institut für Deutsche Sprache</a> in Mannheim entwickelt, Mitglied der <a href="http://www.leibniz-gemeinschaft.de">Leibniz Gemeinschaft</a>. Die einzelnen Module werden als Open Source auf <a href="http://github.com/KorAP">GitHub</a> veröffentlicht.</p>
1111
</div>

templates/intro.html.ep

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<p><noscript>KorAP expects activated JavaScript for some features.</noscript></p>
88

9-
<p><strong>New to KorAP?</strong> Please check out our <a class="link-guided-tour">guided tour</a> or our <%= doc_opener 'ql', begin %>tutorial<% end %>!</p>
9+
<p><strong>New to KorAP?</strong> Please check out our <a class="link-guided-tour">guided tour</a> or our <%= doc_opener 'ql', begin %>help<% end %>!</p>
1010

1111
<p>KorAP is developed at the <a href="https://www.ids-mannheim.de">Leibniz Institute for the German Language</a>, member of the <a href="http://www.leibniz-gemeinschaft.de">Leibniz Association</a>. The separated modules are being published as open source at <a href="http://github.com/KorAP">GitHub</a>.</p>
1212
</div>

templates/partial/header.html.ep

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
1+
% content_block 'headerButtonGroup', { position => 50 }, begin
2+
<h3 class="nav-link"><a class="link-guided-tour">Tour</a></h3>
3+
% end
4+
5+
% content_block 'headerButtonGroup', { position => 100 }, begin
6+
<h3 class="nav-link"><a href="<%= url_for 'doc_start' %>" class="tutorial" id="view-tutorial"><%= loc "tutorial" %></a></h3>
7+
% end
8+
19
<nav class="navbar">
210
<%= link_to 'index', class => 'logo', begin %><h1><span><%= title() // loc('korap_desc') %></span><% if (loc('title_addon')) { %><div class="logoaddon"><%= loc('title_addon') %></div><% } %></h1><% end %>
311

412
<div class="navbar-group">
513
%= content_block 'headerButtonGroup'
14+
%= include 'partial/auth/logout'
615
%= include 'partial/auth/login'
716
</div>
817

0 commit comments

Comments
 (0)