Action button

Functionality and usage of the OpenNethome Server
Post Reply
tobbe
Posts: 17
Joined: Mon Dec 15, 2014 8:14 pm

Action button

Post by tobbe » Tue Jul 18, 2017 4:35 pm

Hi

I was wondering if it would be possible to change the way the action buttons look.
Would it be possible to have the label on top of the image instead of under, like it is now?
Currently, if I want text on top of the label, I would have to create two images for each button with the text I want, instead of creating two images, and the just adding the text in the configuration.
As you can imagine, that would be quite the nightmare to do and upkeep.
It would be nice to be able to change to font size and colour of the text as well.

Regards,
Tobbe

stefangsbb
Site Admin
Posts: 311
Joined: Sun Nov 30, 2014 2:16 pm

Re: Action button

Post by stefangsbb » Tue Jul 18, 2017 10:05 pm

Well, here we are entering the area of personal taste and preferences...
I don't want to change the text position just for this element, and making it configurable would kind of open Pandoras box - BUT I can do something better (I think). I now added the possibility to add a custom .css-file to each Plan-Item, so you can style anything on the page anyway you like!
You upload your custom .css-file like a media-file in settings, and then you can go the the Plan-Item (called "CreatedPlan" among "Infrastructure"-Items), and select it as CustomCSS (new attribute I added).

If you for example want the text above the action buttons and in big red letters, the custom css could look like this:

Code: Select all

.actionbutton ul {
  display: flex;
  flex-direction: column;
}
.actionbutton ul li:first-child {
  order: 3;
}

.actionbutton ul li:nth-child(2) {
  order: 2;
  font-family: "Times New Roman", Times, serif;
  font-size: 20px;
  color: red;
}
The changes are in a nightly build near you :D

stefangsbb
Site Admin
Posts: 311
Joined: Sun Nov 30, 2014 2:16 pm

Re: Action button

Post by stefangsbb » Wed Jul 19, 2017 1:05 pm

The custom css opened up more possibilities than I thought of from the beginning! I added identities of all the Items on the plan page, and that makes it possible to change the icons for individual Items via the custom css. If for example a switch is connected to a toaster, it looks silly with a lamp Icon. Now you can upload a toaster icon to the media library and restyle that individual item with the new toaster icon. You have to know the Id of the Item, so I added the ID on the edit item page, so you can find it there.

As an example, if the toaster switch has id 56, the css to change the icons for it would be:

Code: Select all

#ID56 li.icon.lamp_off {
    background: url(toaster_off.png) no-repeat center;
}

#ID56 li.icon.lamp_on {
    background: url(toaster_on.png) no-repeat center;
}
I also made the css-configuration available from the edit mode of the plan page, so you just have to click the "Edit this page"-link and select the css-file in the drop down menu at the top. The changes are in the nightly build

tobbe
Posts: 17
Joined: Mon Dec 15, 2014 8:14 pm

Re: Action button

Post by tobbe » Wed Jul 19, 2017 1:49 pm

Excellent work as usual!
I think this will be very helpful and let me customize my display just the way I want to.
Thank you for taking time out of your day to keep making OpenNetHome the best out there!

Tobbe

Post Reply