Skip to Content Skip to Menu

🎃 Happy Halloween! Treat yourself with an awesome discount on memberships! Get 20% off now with code SPOOKY-2024!

Conditional css

  • tiekubd
  • tiekubd
  • OFFLINE
  • Posts: 68
  • Thanks: 1
  • Karma: 0
8 years 8 months ago - 8 years 8 months ago #277861 by tiekubd
Conditional css was created by tiekubd
In List Managemt I am suing a CSS Class cbListFieldCont.cbUserListFC_cb_unreadmessages for my cb_unreadmessagews column which is a Query field:

SELECT COUNT(*) FROM `#__uddeim` WHERE `toid`='[user_id]' AND `toread`='0';

How do I change the CSS class based on the value of the COUNT(*).

e.g.

COUNT(*) = 0 - 5 --> span.cbListFieldCont.cbUserListFC_cb_unreadmessages { color: green;}
COUNT(*) = 6 - 10 --> span.cbListFieldCont.cbUserListFC_cb_unreadmessages { color: yellow;}
COUNT(*) > 10 --> span.cbListFieldCont.cbUserListFC_cb_unreadmessages { color: red;}


Anyone please?
Last edit: 8 years 8 months ago by tiekubd.

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48460
  • Thanks: 8280
  • Karma: 1443
8 years 8 months ago #277893 by krileon
Replied by krileon on topic Conditional css
I recommend using the Userlist Value Layout usage for the field. Edit the field within CB > Field Management. Then under Parameters > Layouts set Userlist Value Layout to something like the following.

Code:
[cb:if cb_unreadmessages<="5"]<span class="text-success">[value]</span>[/cb:if] [cb:if cb_unreadmessages>="6" and cb_unreadmessages<"10"]<span class="text-warning">[value]</span>[/cb:if] [cb:if cb_unreadmessages>="10"]<span class="text-danger">[value]</span>[/cb:if]


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

  • tiekubd
  • tiekubd
  • OFFLINE
  • Posts: 68
  • Thanks: 1
  • Karma: 0
8 years 8 months ago #278019 by tiekubd
Replied by tiekubd on topic Conditional css
Let me try this and get back to you. Thanks!

Please Log in or Create an account to join the conversation.

  • tiekubd
  • tiekubd
  • OFFLINE
  • Posts: 68
  • Thanks: 1
  • Karma: 0
8 years 8 months ago #278032 by tiekubd
Replied by tiekubd on topic Conditional css
It's working. But why does it affect the online status symbol? See attached image.

I don't see an option to submit image?

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48460
  • Thanks: 8280
  • Karma: 1443
8 years 8 months ago #278063 by krileon
Replied by krileon on topic Conditional css

It's working. But why does it affect the online status symbol? See attached image.

Shouldn't affect anything except the field you edited. You should be able to straight copy and paste what I've provided.

I don't see an option to submit image?

You need to do a full reply and add an attachment. Quick reply doesn't display the editor functions as it's just a quick reply.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

  • tiekubd
  • tiekubd
  • OFFLINE
  • Posts: 68
  • Thanks: 1
  • Karma: 0
8 years 8 months ago #278140 by tiekubd
Replied by tiekubd on topic Conditional css
I change date class from text-danger to text-high and the problem went away.
Attachments:

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum