Skip to content

Commit

Permalink
[IMP] web_tree_many2one_clickable: improved visualization
Browse files Browse the repository at this point in the history
  • Loading branch information
SylweKra committed Feb 7, 2025
1 parent cb8eda2 commit c88abfb
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 10 deletions.
2 changes: 2 additions & 0 deletions web_tree_many2one_clickable/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ Contributors
* Artem Kostyuk <[email protected]>
* Anand Kansagra <[email protected]>
* Alexandre Díaz <[email protected]>
* Ooops404 <https://ooops404.com>
* Sylwester Krasinski <[email protected]>

Maintainers
~~~~~~~~~~~
Expand Down
2 changes: 2 additions & 0 deletions web_tree_many2one_clickable/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@
* Artem Kostyuk <[email protected]>
* Anand Kansagra <[email protected]>
* Alexandre Díaz <[email protected]>
* Ooops404 <https://ooops404.com>
* Sylwester Krasinski <[email protected]>
13 changes: 9 additions & 4 deletions web_tree_many2one_clickable/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@

/*
:Author: David Goodger ([email protected])
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
Despite the name, some widely supported CSS2 features are used.
See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
customize this style sheet.
Expand Down Expand Up @@ -275,7 +276,7 @@
margin-left: 2em ;
margin-right: 2em }

pre.code .ln { color: grey; } /* line numbers */
pre.code .ln { color: gray; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
Expand All @@ -301,7 +302,7 @@
span.pre {
white-space: pre }

span.problematic {
span.problematic, pre.problematic {
color: red }

span.section-subtitle {
Expand Down Expand Up @@ -424,12 +425,16 @@ <h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
<li>Artem Kostyuk &lt;<a class="reference external" href="mailto:a.kostyuk&#64;mobilunity.com">a.kostyuk&#64;mobilunity.com</a>&gt;</li>
<li>Anand Kansagra &lt;<a class="reference external" href="mailto:kansagraanand&#64;hotmail.com">kansagraanand&#64;hotmail.com</a>&gt;</li>
<li>Alexandre Díaz &lt;<a class="reference external" href="mailto:alexandre.diaz&#64;tecnativa.com">alexandre.diaz&#64;tecnativa.com</a>&gt;</li>
<li>Ooops404 &lt;<a class="reference external" href="https://ooops404.com">https://ooops404.com</a>&gt;
* Sylwester Krasinski &lt;<a class="reference external" href="mailto:skrasinski62&#64;gmail.com">skrasinski62&#64;gmail.com</a>&gt;</li>
</ul>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<a class="reference external image-reference" href="https://odoo-community.org">
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
</a>
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.</p>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,37 @@
td.o_many2one_cell {
a {
margin-left: 0.5em;
visibility: hidden;
}
display: flex;
align-items: center;
position: relative;

&:hover a {
visibility: visible;
}
}

/*SECONDARY CONTAINER FOR THE BUTTON AND TEXT*/
.o_many2one_container {
display: flex;
gap: 0.5em; /* Space between the containers */
}

/*TEXT CONTAINER AND TEXT CSS*/
.o_text_container {
max-width: fit-content;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
div.o_custom_field_text {
position: relative;
max-width: fit-content;
vertical-align: bottom;
}
/*BUTTON CONTAINER AND BUTTON CSS*/
.o_button_container {
left: 0;
}
td.o_many2one_cell a {
margin-left: 0.5;
visibility: hidden;
position: relative;
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,26 @@ odoo.define("web_tree_many2one_clickable.many2one_clickable", function (require)
if (!this.noOpen && this.value) {
// Replace '<a>' element
this.$el.removeClass("o_form_uri");
this.$el = $("<span/>", {
var $span = $("<span/>", {
html: this.$el.html(),
class: this.$el.attr("class") + " o_field_text",
name: this.$el.attr("name"),
});
this.$el = $("<div/>", {
class: "o_many2one_container",
});

// Create the container for the text (span)
var $textContainer = $("<div/>", {
class: "o_text_container",
});

$textContainer.append($span);

// Create the container for the button (a)
var $buttonContainer = $("<div/>", {
class: "o_button_container",
});

// Append button
var $a = $("<a/>", {
Expand All @@ -63,7 +78,10 @@ odoo.define("web_tree_many2one_clickable.many2one_clickable", function (require)
}),
});
});
this.$el.append($a);
$buttonContainer.append($a);

// Adding the two containers to the principal
this.$el.append($textContainer).append($buttonContainer);
}
},
});
Expand Down

0 comments on commit c88abfb

Please sign in to comment.