Updating Environment Badges widget

Hi there, (Especially Herman Geldenhuys) Instead of adding an image in the right corner, I would like to set a different background color for every environment. I changed the widget a little bit by adding a different class to the body: if (this.badgeLoaded === undefined) mx.data.get({ xpath : "//System.LicenseInformation", callback : dojo.hitch(this, function(objs) { this.badgeLoaded = true; var imageDom = dojo.byId(dojo.byId(this.WidgetDOM).querySelector("#environment-badge")), environmentMode = objs[0].getAttribute("RuntimeMode"), body = dojo.query("body")[0]; document.body.className += " DEV"; if (environmentMode === 'Testing') { document.body.className += " TEST"; } else if (environmentMode === 'Acceptance') { document.body.className += " ACCP"; } else if (environmentMode === 'Production') { document.body.className += " PROD"; } imageDom.setAttribute("src", 'widgets/EnvironmentBadges/widget/' + imageFilename); dojo.style(imageDom, 'visibility', 'visible'); dojo.place(imageDom, body); }) }); This way I can use specific styles for every environment by doing something like this: body.DEV { overflow:hidden; background-color:#FF0000; } Maybe this could be added to the widget in the appstore and republished again, so others can use it also.
1 answers

Hey Samet, nice approach. Glad to see that the environment thing is a useful pattern ;)

I've added 3 more Badge widgets to the Appstore, just waiting for approval, namely Environment-, Named-, URL and Predefined badges.

I will create another separate package with a few different widgets that allow you to do more CSSy things and upload it to the Appstore. Originally we went the colour route, until the badge angle took precedence because our existing application had an image for a background.