Skip to content

Commit 233f289

Browse files
edi-odooAntoineVDV
andcommitted
[IMP] design: add an icon behind external links
The external links' target attribute is now also updated to open the link in a new tab. In addition, the "[source]" link of autodoc's models is moved right next to the name of the model to correctly position the icon. task-2790244 closes #2207 X-original-commit: 343decf Signed-off-by: Antoine Vandevenne (anv) <[email protected]> Co-authored-by: Antoine Vandevenne (anv) <[email protected]>
1 parent 79f70d6 commit 233f289

File tree

9 files changed

+25
-2
lines changed

9 files changed

+25
-2
lines changed
200 Bytes
Binary file not shown.

extensions/odoo_theme/static/fonts/icomoon.svg

Lines changed: 1 addition & 0 deletions
Loading
200 Bytes
Binary file not shown.
200 Bytes
Binary file not shown.
-72 Bytes
Binary file not shown.

extensions/odoo_theme/static/js/layout.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,15 @@
33
document.addEventListener('DOMContentLoaded', function () {
44
const content = document.getElementById('o_content');
55

6-
// Enforce the presence of the `img-fluid` class on all images in the body
6+
// Enforce the presence of the `img-fluid` class on all images in the body.
77
content.querySelectorAll('img').forEach(image => {
88
image.classList.add('img-fluid');
99
});
10+
11+
// Make all external links open in a new tab by default.
12+
content.querySelectorAll('a.external').forEach(externalLink => {
13+
externalLink.setAttribute('target', '_blank');
14+
})
1015
});
1116

1217
})();

extensions/odoo_theme/static/scss/_iconfont.scss

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@
5757
content: $i-link;
5858
}
5959
}
60+
.i-external-link {
61+
&:before {
62+
content: $i-external-link;
63+
}
64+
}
6065
.i-websites {
6166
&:before {
6267
content: $i-websites;
@@ -416,4 +421,4 @@
416421
&:before {
417422
content: $i-article;
418423
}
419-
}
424+
}

extensions/odoo_theme/static/scss/_variables.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ $i-chevron-down: "\e949";
8484
$i-chevron-left: "\e94a";
8585
$i-chevron-right: "\e94b";
8686
$i-link: "\e94f";
87+
$i-external-link: "\e940";
8788
$i-websites: "\e944";
8889
$i-sales: "\e953";
8990
$i-sales_2: "\e931";

extensions/odoo_theme/static/style.scss

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@ body {
1515
text-decoration: none !important;
1616
}
1717

18+
a.external:after {
19+
content: '#{$i-external-link}';
20+
font-family: icomoon, sans-serif !important;
21+
@include font-size($font-size-base/1.3);
22+
margin: 0 .2rem;
23+
}
24+
1825
dd {
1926
margin-left: 1rem;
2027
}
@@ -36,6 +43,10 @@ body {
3643
display: none !important;
3744
opacity: 0 !important;
3845
}
46+
47+
span.viewcode-link {
48+
float: none;
49+
}
3950
//------------------------------------------------------------------------------
4051
// Header with logo, searchbar and switchers
4152
//------------------------------------------------------------------------------

0 commit comments

Comments
 (0)