Handling Icons replacing

Hello Hello,

I was looking into replacing the handling icons, but I can’t find anywhere the PNG files in the Openboxes image directory.


These are scalable vector graphics (SVGs) controlled by CSS classes. More specifically we’re using the Font Awesome library. We’ve hardcoded the CSS classes in the code, but we could consider making this configuratble.

    def getHandlingIcons() {
        def g = getApplicationTagLib()
        def handlingIcons = []
        if (this.coldChain) handlingIcons.add([icon: "fa-snowflake", color: "#3bafda", label: "${g.message(code: 'product.coldChain.label')}"])
        if (this.controlledSubstance) handlingIcons.add([icon: "fa-exclamation-circle", color: "#db1919", label: "${g.message(code: 'product.controlledSubstance.label')}"])
        if (this.hazardousMaterial) handlingIcons.add([icon: "fa-exclamation-triangle", color: "#ffa500", label: "${g.message(code: 'product.hazardousMaterial.label')}"])
        if (this.reconditioned) handlingIcons.add([icon: "fa-prescription-bottle", color: "#a9a9a9", label: "${g.message(code: 'product.reconditioned.label')}"])
        return handlingIcons

Here’s what I think you could 1 do

  1. find an SVG icon set with icons you like (rather than individual icons)
  2. find a way to include the library in the deployed code (copy the library into the js directory in the exploded war)
  3. find a way to reference that library in the GSP code (could be done through custom GSPs for each page where handling icons appear)
  4. find a way to reference the library in the React pages (??)

Your other option would be adding some custom CSS somewhere to redefine the location of the image that the CSS class “fa-snowflake” points to.

A better solution would be to make the change to the source code (Product.groovy) to make this configurable. This doesn’t address the issue of how to include a custom font library.

1 As I describe below in the conclusion, I am in no way endorsing this as a solution … just trying to paint an image of what I think you’re trying to do.

So unfortunately, I don’t have an elegant solution for you.

And while this might be achievable (and may not be all that complicated), I wanted to point out that I’m noticing that you seem to be making a lot of customizations within the code deployed to Tomcat and not to source files. I want to make it clear that this isn’t PHP; changing “deployed” artifacts is a bad idea for many reasons, but primarily because an upgrade to the latest version of OpenBoxes will overwrite any changes you’ve made to the deployed artifacts. In order to avoid that, you’ll need to do some version control on your deployed code, which might make maintaining this solution less fun in the long-run.

Thanks for the fast update again!
I already thought it was hardcoded. So for now no problem :).

I indeed made a few modification’s into the GSP files (small ones) and pointed that out in a Word document so on upgrade I could change the new files again. Anyway, 99,9% of the system seems to work perfect for my needs.

Is there anyway I can contribute at this point?

Is there anyway I can contribute at this point?

Yes, of course.

Here’s our main contributing guide.

And more specific instructions on how to create your first pull request for an open issue.