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

[9.0] [IMP] Web Environment Ribbon: support variables in ribbon name (eg db_name) #621

Merged
merged 5 commits into from May 31, 2017

Conversation

ThomasBinsfeld
Copy link
Contributor

  • Add a simple backend to web_environment_ribbon
  • The new method get_environment_ribbon() can be overridden to change the standard behavior
  • The database name is now displayed under the name, in the ribbon (can be changed by overriding the method)

screenshot from 2017-05-16 10-07-25
(Preview on Odoo 9.0 Enterprise)


This PR is an other solution for #588

This commit adds a simple bakend to facilitate inheritance
This commit adds the database name under the ribbon name, in the ribbon
@dreispt
Copy link
Sponsor Member

dreispt commented May 16, 2017

Isn't the dbname already shown next to the legged in user (as long as you are in debug mode)?

@ThomasBinsfeld
Copy link
Contributor Author

@dreispt Yes, indeed, in debug mode. But we would like to see it without enabling the debug mode.

if (strColor && validStrColour(strColor)) {
ribbon.css('color', strColor);
// Ribbon color
if (ribbon_data.color && validStrColour(ribbon_data.color)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

@ThomasBinsfeld maybe an else here for a default color if something goes wrong?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@zakiuu Hi. It's the behavior before my PR. If it's an issue, we should fix it in a separate PR.

if (strBackgroundColor && validStrColour(strBackgroundColor)) {
ribbon.css('background-color', strBackgroundColor);
// Ribbon background color
if (ribbon_data.background_color && validStrColour(ribbon_data.background_color)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

@ThomasBinsfeld samething here

# Add the database name to the ribbon name
db_name = self.env.cr.dbname
name = u"{name}<br/>({db_name})".format(
name=ir_config_model.get_param('ribbon.name'), db_name=db_name)
Copy link
Member

Choose a reason for hiding this comment

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

@ThomasBinsfeld what I had in mind was

name = ir_config_model.get_param('ribbon.name')
name = name.format(db_name=db_name)

So the format can be completely determined in the configuration file.

And put this bit in a separate method that is easy to override.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@sbidoul Done !

top: 25px;
left: -50px;
left: -100px;
Copy link
Member

Choose a reason for hiding this comment

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

Can we leave the ribbon size untouched in this PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If we want to display on two lines, we have to change the size.

@sbidoul sbidoul changed the title [9.0] [IMP] Web Environment Ribbon: display DB name [9.0] [IMP] Web Environment Ribbon: support variables in ribbon name (eg db_name) May 17, 2017
@sbidoul
Copy link
Member

sbidoul commented May 17, 2017

@ThomasBinsfeld LGTM. Can you please update the README with the new feature and an example using db_name?

@yajo yajo merged commit e05d215 into OCA:9.0 May 31, 2017
@sbidoul sbidoul deleted the 9.0-add_web_ribbon_backend_tbi branch May 31, 2017 09:27
sbidoul pushed a commit to acsone/web that referenced this pull request Jul 2, 2017
…(eg db_name) (OCA#621)

* [ADD] .eggs in gitignore

* [IMP] Web Environment Ribbon: add backend
This commit adds a simple bakend to facilitate inheritance

* [IMP] Web Environment Ribbon: add the databse name
This commit adds the database name under the ribbon name, in the ribbon

* [IMP] Web Environment Ribbon: prepare method for ribbon name

* [IMP] README: explain how to use db_name
xavierjimenez pushed a commit to QubiQ/web that referenced this pull request Nov 13, 2017
…(eg db_name) (OCA#621)

* [ADD] .eggs in gitignore

* [IMP] Web Environment Ribbon: add backend
This commit adds a simple bakend to facilitate inheritance

* [IMP] Web Environment Ribbon: add the databse name
This commit adds the database name under the ribbon name, in the ribbon

* [IMP] Web Environment Ribbon: prepare method for ribbon name

* [IMP] README: explain how to use db_name
pedrobaeza pushed a commit to QubiQ/web that referenced this pull request Nov 14, 2017
…(eg db_name) (OCA#621)

* [ADD] .eggs in gitignore

* [IMP] Web Environment Ribbon: add backend
This commit adds a simple bakend to facilitate inheritance

* [IMP] Web Environment Ribbon: add the databse name
This commit adds the database name under the ribbon name, in the ribbon

* [IMP] Web Environment Ribbon: prepare method for ribbon name

* [IMP] README: explain how to use db_name
andreparames pushed a commit to acsone/web that referenced this pull request Jan 23, 2018
…(eg db_name) (OCA#621)

* [ADD] .eggs in gitignore

* [IMP] Web Environment Ribbon: add backend
This commit adds a simple bakend to facilitate inheritance

* [IMP] Web Environment Ribbon: add the databse name
This commit adds the database name under the ribbon name, in the ribbon

* [IMP] Web Environment Ribbon: prepare method for ribbon name

* [IMP] README: explain how to use db_name
yaniaular pushed a commit to vauxoo-dev/web that referenced this pull request May 14, 2018
…(eg db_name) (OCA#621)

* [ADD] .eggs in gitignore

* [IMP] Web Environment Ribbon: add backend
This commit adds a simple bakend to facilitate inheritance

* [IMP] Web Environment Ribbon: add the databse name
This commit adds the database name under the ribbon name, in the ribbon

* [IMP] Web Environment Ribbon: prepare method for ribbon name

* [IMP] README: explain how to use db_name
yaniaular pushed a commit to vauxoo-dev/web that referenced this pull request May 14, 2018
…(eg db_name) (OCA#621)

* [ADD] .eggs in gitignore

* [IMP] Web Environment Ribbon: add backend
This commit adds a simple bakend to facilitate inheritance

* [IMP] Web Environment Ribbon: add the databse name
This commit adds the database name under the ribbon name, in the ribbon

* [IMP] Web Environment Ribbon: prepare method for ribbon name

* [IMP] README: explain how to use db_name
tarteo pushed a commit to tarteo/web that referenced this pull request Oct 2, 2018
…(eg db_name) (OCA#621)

* [ADD] .eggs in gitignore

* [IMP] Web Environment Ribbon: add backend
This commit adds a simple bakend to facilitate inheritance

* [IMP] Web Environment Ribbon: add the databse name
This commit adds the database name under the ribbon name, in the ribbon

* [IMP] Web Environment Ribbon: prepare method for ribbon name

* [IMP] README: explain how to use db_name
tarteo pushed a commit that referenced this pull request Oct 9, 2018
…(eg db_name) (#621)

* [ADD] .eggs in gitignore

* [IMP] Web Environment Ribbon: add backend
This commit adds a simple bakend to facilitate inheritance

* [IMP] Web Environment Ribbon: add the databse name
This commit adds the database name under the ribbon name, in the ribbon

* [IMP] Web Environment Ribbon: prepare method for ribbon name

* [IMP] README: explain how to use db_name
aitorbouzas pushed a commit to aitorbouzas/web that referenced this pull request Oct 10, 2018
…(eg db_name) (OCA#621)

* [ADD] .eggs in gitignore

* [IMP] Web Environment Ribbon: add backend
This commit adds a simple bakend to facilitate inheritance

* [IMP] Web Environment Ribbon: add the databse name
This commit adds the database name under the ribbon name, in the ribbon

* [IMP] Web Environment Ribbon: prepare method for ribbon name

* [IMP] README: explain how to use db_name
lembregtse pushed a commit to lembregtse/web that referenced this pull request Sep 30, 2019
…(eg db_name) (OCA#621)

* [ADD] .eggs in gitignore

* [IMP] Web Environment Ribbon: add backend
This commit adds a simple bakend to facilitate inheritance

* [IMP] Web Environment Ribbon: add the databse name
This commit adds the database name under the ribbon name, in the ribbon

* [IMP] Web Environment Ribbon: prepare method for ribbon name

* [IMP] README: explain how to use db_name
fuentes73 pushed a commit to Studio73/web that referenced this pull request Oct 16, 2020
…(eg db_name) (OCA#621)

* [ADD] .eggs in gitignore

* [IMP] Web Environment Ribbon: add backend
This commit adds a simple bakend to facilitate inheritance

* [IMP] Web Environment Ribbon: add the databse name
This commit adds the database name under the ribbon name, in the ribbon

* [IMP] Web Environment Ribbon: prepare method for ribbon name

* [IMP] README: explain how to use db_name
ap-wtioit pushed a commit to ap-wtioit/web that referenced this pull request Oct 18, 2021
…(eg db_name) (OCA#621)

* [ADD] .eggs in gitignore

* [IMP] Web Environment Ribbon: add backend
This commit adds a simple bakend to facilitate inheritance

* [IMP] Web Environment Ribbon: add the databse name
This commit adds the database name under the ribbon name, in the ribbon

* [IMP] Web Environment Ribbon: prepare method for ribbon name

* [IMP] README: explain how to use db_name
ap-wtioit pushed a commit to ap-wtioit/web that referenced this pull request Oct 19, 2021
…(eg db_name) (OCA#621)

* [ADD] .eggs in gitignore

* [IMP] Web Environment Ribbon: add backend
This commit adds a simple bakend to facilitate inheritance

* [IMP] Web Environment Ribbon: add the databse name
This commit adds the database name under the ribbon name, in the ribbon

* [IMP] Web Environment Ribbon: prepare method for ribbon name

* [IMP] README: explain how to use db_name
ap-wtioit pushed a commit to ap-wtioit/web that referenced this pull request Nov 15, 2021
…(eg db_name) (OCA#621)

* [ADD] .eggs in gitignore

* [IMP] Web Environment Ribbon: add backend
This commit adds a simple bakend to facilitate inheritance

* [IMP] Web Environment Ribbon: add the databse name
This commit adds the database name under the ribbon name, in the ribbon

* [IMP] Web Environment Ribbon: prepare method for ribbon name

* [IMP] README: explain how to use db_name
baimont pushed a commit to acsone/web that referenced this pull request Aug 26, 2022
…(eg db_name) (OCA#621)

* [ADD] .eggs in gitignore

* [IMP] Web Environment Ribbon: add backend
This commit adds a simple bakend to facilitate inheritance

* [IMP] Web Environment Ribbon: add the databse name
This commit adds the database name under the ribbon name, in the ribbon

* [IMP] Web Environment Ribbon: prepare method for ribbon name

* [IMP] README: explain how to use db_name
baimont pushed a commit to acsone/web that referenced this pull request Oct 4, 2022
…(eg db_name) (OCA#621)

* [ADD] .eggs in gitignore

* [IMP] Web Environment Ribbon: add backend
This commit adds a simple bakend to facilitate inheritance

* [IMP] Web Environment Ribbon: add the databse name
This commit adds the database name under the ribbon name, in the ribbon

* [IMP] Web Environment Ribbon: prepare method for ribbon name

* [IMP] README: explain how to use db_name
rven pushed a commit to DynAppsNV/web that referenced this pull request Nov 14, 2023
…(eg db_name) (OCA#621)

* [ADD] .eggs in gitignore

* [IMP] Web Environment Ribbon: add backend
This commit adds a simple bakend to facilitate inheritance

* [IMP] Web Environment Ribbon: add the databse name
This commit adds the database name under the ribbon name, in the ribbon

* [IMP] Web Environment Ribbon: prepare method for ribbon name

* [IMP] README: explain how to use db_name
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.

None yet

8 participants