Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[14.0][IMP] web_tree_many2one_clickable: improved visualization #3070

Merged
merged 1 commit into from
Feb 18, 2025

Conversation

SylweKra
Copy link

Before my improvement:
The text was expanding the height of the line, making it harder to maintain consistency and readability across rows.
scheen prima
After my improvement:
The text no longer affects the height of the line, which improves the visibility and alignment of rows.
SCREEN DOPO
This adjustment enhances the overall readability and ensures a more structured layout.

@pedrobaeza pedrobaeza added this to the 14.0 milestone Jan 28, 2025
@SylweKra SylweKra force-pushed the 14.0-IMP-web_tree_many2one_clickable branch from 39a01d2 to a3f4a40 Compare January 29, 2025 08:12
Copy link

@francesco-ooops francesco-ooops left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Functional ok!

@pedrobaeza does code look good?

I have troubles testing on runboat whether the issue is present in later versions

@pedrobaeza
Copy link
Member

I can't say, as I'm not using anymore this version, and this should be compatible with web_responsive, so a code review can't say.

Copy link
Contributor

@aleuffre aleuffre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code and functional review: mostly seems to work fine, but a few issues.

html: this.$el.html(),
class: this.$el.attr("class") + " o_field_text",
class: this.$el.attr("class") + "o_field_text",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue:

Suggested change
class: this.$el.attr("class") + "o_field_text",
class: this.$el.attr("class") + " o_field_text",

margin-left: 0.5;
visibility: hidden;
position: relative;
transition: all 0.2s ease;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment: I find this transition very unpleasant and distracting. Move your mouse across the screen and you have a handful of arrows slowly appearing and disappearing.

I'd personally prefer to have it appear and disappear instantly, as it was before.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have changed the transition as suggested.


&:hover a {
Copy link
Contributor

@aleuffre aleuffre Feb 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick (non-blocking): I would personally prefer, for readability and maintainability, to make use of scss syntax features, such as nesting selectors etc, as it was before

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have taken care of it as suggested.

Copy link
Contributor

@aleuffre aleuffre Feb 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (non-blocking): I probably wasn't very clear. This is what I meant:

td.o_many2one_cell {
    display: flex;
    align-items: center;
    position: relative;

    a {
        margin-left: 0.5em;
        visibility: hidden;
        position: relative;
    }

    &:hover a {
        visibility: visible;
    }
}

And then you can remove lines 33-37

Also:

.o_many2one_container {
    display: flex;
    gap: 0.5em; /* Space between the containers  */

    .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;
    }
    [etc...]
}

white-space: nowrap;
text-overflow: ellipsis;
}
td.o_field_text {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: o_field_text is a class used in base odoo. The chance of causing issues elsewhere by changing the way it is displayed is quite high.

I think it'd be best to use a different class entirely to add this styling; or at the very least the scope of the selectors should be narrowed down a lot more so that there are (almost) no chances for it to affect unrelated elements in other modules, both custom and from base odoo.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added "custom" to the class name to differentiate it from the "field_text" class, preventing any errors, and I have also added the div to ensure a lower scope.

@SylweKra SylweKra force-pushed the 14.0-IMP-web_tree_many2one_clickable branch 2 times, most recently from c88abfb to 05299f9 Compare February 7, 2025 09:27
Copy link
Contributor

@aleuffre aleuffre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Functionally works well for me now.

Code can be cleaned up (probably even further than what I pointed out in the comments) but is mostly ok.

html: this.$el.html(),
class: this.$el.attr("class") + " o_field_text",
class: this.$el.attr("class") + " o_custom_field_text",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: maybe we can have both classes o_field_text and o_custom_field_text?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't add both classes; in fact, if I add the o_field_text class, the rows expand again.


&:hover a {
Copy link
Contributor

@aleuffre aleuffre Feb 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (non-blocking): I probably wasn't very clear. This is what I meant:

td.o_many2one_cell {
    display: flex;
    align-items: center;
    position: relative;

    a {
        margin-left: 0.5em;
        visibility: hidden;
        position: relative;
    }

    &:hover a {
        visibility: visible;
    }
}

And then you can remove lines 33-37

Also:

.o_many2one_container {
    display: flex;
    gap: 0.5em; /* Space between the containers  */

    .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;
    }
    [etc...]
}

}
/*BUTTON CONTAINER AND BUTTON CSS*/
.o_button_container {
left: 0;
Copy link
Contributor

@aleuffre aleuffre Feb 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

chore: can probably be removed?

image

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I rearranged the classes as you requested.

.o_text_container {
max-width: fit-content;
overflow: hidden;
white-space: nowrap;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

chore (non-blocking): I don't think specifying white-space is necessary since it's already inherited.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed the "white-space"; in fact, it was already inherited as you said.

left: 0;
}
td.o_many2one_cell a {
margin-left: 0.5;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

chore: missing UoM

Suggested change
margin-left: 0.5;
margin-left: 0.5em;

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added the UoM

@SylweKra SylweKra force-pushed the 14.0-IMP-web_tree_many2one_clickable branch from 05299f9 to 7be25dc Compare February 10, 2025 16:09
Copy link
Contributor

@aleuffre aleuffre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code and functional review, LGTM

Copy link

@francesco-ooops francesco-ooops left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Functional is looking good

@pedrobaeza how could I check whether it works correctly with web_responsive?

@pedrobaeza
Copy link
Member

In runboat both should be installed.

@francesco-ooops
Copy link

Yes, from what I can see they seem to have the same behavior before and after this PR

@francesco-ooops
Copy link

@OCA/web-maintainers ping :)

@francesco-ooops
Copy link

@pedrobaeza we verified compatibility with web_responsive both functionally and for code.

Can this be merged? Thanks!

@pedrobaeza
Copy link
Member

/ocabot merge patch

@OCA-git-bot
Copy link
Contributor

This PR looks fantastic, let's merge it!
Prepared branch 14.0-ocabot-merge-pr-3070-by-pedrobaeza-bump-patch, awaiting test results.

@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at 526845d. Thanks a lot for contributing to OCA. ❤️

@OCA-git-bot OCA-git-bot merged commit b4e41e3 into OCA:14.0 Feb 18, 2025
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants