Add more CSS-classes to buttons (GTK client)


#1

I know, it seems a bit strange :smile: But I’m playing with colors and fonts to give the client a bit more stylish design. I can change a lot by use the gtk inspector. But when I want to change the background color of a button which are used for the workflow (below the forms) all the buttons changes because there are no specific CSS-classes added to the different buttons.

Would it be possible to add a CSS-class to these buttons based on the model (sale, purchase, invoice etc) and the name of the button which is used in the XML-file?
You will get CSS-classes like invoice-post or invoice-pay etc. This CSS-classes then can be styled accordingly.


(Cédric Krier) #2

I find it a little bit random to put method name as class name of a button. This will request to write a lot of CSS rules.
I think it will be better to look up for common type of buttons and create a class for each type. A type, I can foresee, is button with confirm option.


#3

My idea was that adding these classes doesn’t do anything unless you specify them in your custom.css. Otherwise the behaviour is the same as it is now. So you don’t have to add extra CSS rules. You can also combine several classes to one rule like .sale-confirm, .sale-draft, .sale-quote { ... }

That’s also a possible solution. But does the client know the type of the button? For me it should not add extra data, but reuse the data the button-function gets to create the button.


(Nicolas Évrard) #4

I tend to agree with Cédric here. From my point of view the “Confirm” button on the Sale or on the Purchase should have the same visual style as they have the same purpose (but maybe also a button named differently on another model). So if we want to put some class on it, it would be .confirm (or something like that) so that all “Confirmation” buttons would have the same styling throughout the system.

Also I don’t think this is the kind of stuff the client can compute as it’s related to the semantic of the button.


#5

We are at the same side here. I totally agree with both of you. It would be nice to change the color of a “confirm” button or a “post” button or whatever and it should be consistent over the whole client. It was just an idea :smile: and no further thoughts if it would be feasible.

That’s was my biggest fear which basically means to do something at the server side and it relies on the user to define the right classes.
Would it be possible to add a new property (e.g. cssclass) to the button definition in the XML? Something like <button name="cancel" cssclass="btncancel" icon="tryton-cancel"/>. The client then add the cssclass to the definition. Standard no definition is made in the default CSS file, but the user can use this class to do some styling.


(Cédric Krier) #6

For me such class should not be random. We must define a set of different kind of buttons and then apply the corresponding classes.
As I said previously, I see only confirm and not confirm kind of button for now but maybe someone sees some other kinds.


(Nicolas Évrard) #7

Button linked to fresh session RPC calls are also special in some way or else why would they require a fresh session?


(Cédric Krier) #8

For me, they are particular if we can say before clicking on them that it will request the credentials. But I do not think it is possible to know that.


#9

My idea was to make the user responsible (but yeah maybe bad programming practice). If they do nothing, the client uses the desktop-theme just as it is doing now. When they want to customize, they can use the gtk inspector to see the (random) classes.

For now I think we should leave it as is. Maybe in the future this can eventually be picked up. There are other things which needs more attention than this.