Saturday, 12 April 2014

Context-Specific CSS Rules

One of the most frequent questions on the Xataface forum is how to hide parts of the UI in a context-specific way.  E.g. You might want to hide the search box only for a specific table, or for a specific class of user, or only when logged in.  As with most things in Xataface, there are many ways to achieve this, but one of the most flexible methods is using CSS.

If you haven't already added a custom CSS file to your application, you can do so by way of the Dataface_Application::addHeadContent() method.  Usually I place this inside my application delegate class' beforeHandleRequest() method.  E.g.

For this example, you would create a file named style.css and place it in the root directory of your application.  Because the beforeHandleRequest() method is called at the beginning of every request, this will result in the style.css stylesheet being included in every page of the site.  Now, if we wanted to hide the search box on the top of the UI (assuming we're using the g2 theme), we could add the following rule to our CSS file:

(This is because the "id" attribute of the search form is "top-search-form".  See the template source here).

This solution hides the search box throughout the entire site.  But what if you want to only hide it for certain tables.  E.g. I recently received a question on the forum about hiding the search box only in the "dashboard" table.  Two possible solutions for this come to mind:

  1. Create a separate stylesheet for the dashboard table and only include it if the request is for the dashboard table.

  2. Add CSS classes to the HTML <body> tag conditionally, and then use these to add CSS rules that only apply for desired context:

    This solution makes use of the block__body_atts to add a class attribute to the <body> tag and adds a CSS class of the form "table-{tablename}" to the body tag which can be targeted from the CSS file. In the case of the dashboard table, the <body> tag will have a "table-dashboard" class.
I personally prefer the second approach because it is much more flexible, and we can keep all of our styles in a single stylesheet.  For example, if we wanted to hide the search form for both the dashboard and foobar tables, we would just change our rule to:
This strategy can be expanded to mark more than just table contexts. For example, you could also add classes to mark whether the user is logged in or the role of the user.  Then you could create CSS rules that only apply to a particular role of user or whether or not the user is logged in.

13 comments:

  1. If you need your ex-girlfriend or ex-boyfriend to come crawling back to you on their knees (even if they're dating somebody else now) you have to watch this video
    right away...

    (VIDEO) Have your ex CRAWLING back to you...?

    ReplyDelete
    Replies
    1. Get your ex lover back urgently Dr Larry email: assurancesulotionhome@gmail com call him on or whatsapp +2348102316854 immediately
      Life without my husband was a real  mess for me and my children I am so happy to get my Ex back through the  help of Dr Larry the spell caster . My greatest surprise was that 48 hours after the Doctor prepared the spell for me, my husband who has abandoned me for 4 years suddenly called me unexpectedly and am so happy that we have come to become one again through the help of Dr Larry and am so happy to be with my husband once again. Dr Larry is a very wonderful spell caster, you can contact him if you need his assistant because i know he can also help you. contact him through his email: assurancesolutionhome@gmail com call him on or whatsapp +2348102316854 immediately website  http://assurancesolutionhome.website2.me/



      Get your ex lover back urgently Dr Larry email: assurancesulotionhome@gmail com call him on or whatsapp +2348102316854 immediately
      Life without my husband was a real  mess for me and my children I am so happy to get my Ex back through the  help of Dr Larry the spell caster . My greatest surprise was that 48 hours after the Doctor prepared the spell for me, my husband who has abandoned me for 4 years suddenly called me unexpectedly and am so happy that we have come to become one again through the help of Dr Larry and am so happy to be with my husband once again. Dr Larry is a very wonderful spell caster, you can contact him if you need his assistant because i know he can also help you. contact him through his email: assurancesolutionhome@gmail com call him on or whatsapp +2348102316854 immediately website  http://assurancesolutionhome.website2.me/




      Get your ex lover back urgently Dr Larry email: assurancesulotionhome@gmail com call him on or whatsapp +2348102316854 immediately
      Life without my husband was a real  mess for me and my children I am so happy to get my Ex back through the  help of Dr Larry the spell caster . My greatest surprise was that 48 hours after the Doctor prepared the spell for me, my husband who has abandoned me for 4 years suddenly called me unexpectedly and am so happy that we have come to become one again through the help of Dr Larry and am so happy to be with my husband once again. Dr Larry is a very wonderful spell caster, you can contact him if you need his assistant because i know he can also help you. contact him through his email: assurancesolutionhome@gmail com call him on or whatsapp +2348102316854 immediately website  http://assurancesolutionhome.website2.me/

      Delete
    2. URGENT AND EFFECTIVE LOVE SPELL CASTER TO HELP YOU GET BACK YOUR EX LOVER VERY FAST 2019 Contact DR LARRY assurancesolutionhome@gmail. com WhatsApp  +2348102316854 I am Laura Peggy  from (ALABAMA), When I eventually found testimonies about this spell caster Dr Larry, how he helped many people to get their lovers and broken homes back, i contacted him too because I was absolutely desperate to get my lover back. Life without my lover was a real mess for me and my kids. i wanted a dramatic change and I thought love spell could be the solution. After discussing the resolution with Dr Larry, he gave me hope that he will restore my relationship. I felt confident that he will actually make my lover to return home and he did! It’s fantastic what this great spell caster have done for me, his help is priceless! I don't know what I would have done without Dr Larry, He does his job so well he is organized and highly functional, i believe he is the best spell caster i can count on when it comes to all kinds of spell, I am so happy that my lover return back home. If you need help, contact him right now through these details below: Email: assurancesolutionhome@gmail. com WhatsApp +2348102316854 Website: http://assurancesolutionhome.wordpress.com  http://assurancesolutionhome.website2.me/





      URGENT AND EFFECTIVE LOVE SPELL CASTER TO HELP YOU GET BACK YOUR EX LOVER VERY FAST 2019 Contact DR LARRY assurancesolutionhome@gmail. com WhatsApp  +2348102316854 I am Laura Peggy  from (ALABAMA), When I eventually found testimonies about this spell caster Dr Larry, how he helped many people to get their lovers and broken homes back, i contacted him too because I was absolutely desperate to get my lover back. Life without my lover was a real mess for me and my kids. i wanted a dramatic change and I thought love spell could be the solution. After discussing the resolution with Dr Larry, he gave me hope that he will restore my relationship. I felt confident that he will actually make my lover to return home and he did! It’s fantastic what this great spell caster have done for me, his help is priceless! I don't know what I would have done without Dr Larry, He does his job so well he is organized and highly functional, i believe he is the best spell caster i can count on when it comes to all kinds of spell, I am so happy that my lover return back home. If you need help, contact him right now through these details below: Email: assurancesolutionhome@gmail. com WhatsApp +2348102316854 Website: http://assurancesolutionhome.wordpress.com  http://assurancesolutionhome.website2.me/

      Delete
    3. My husband and I have been married for about 7 yrs now. We were happily married with two kids, a boy and a girl. 3 months ago, I started to notice some strange behavior from him and a few weeks later I found out that my husband is seeing someone. He started coming home late from work, he hardly care about me or the kids anymore, Sometimes he goes out and doesn't even come back home for about 2-3 days. I did all I could to rectify this problem but all to no avail. I became very worried and needed help. As I was browsing through the Internet one day, I came across a website that suggested that Dr Great can help solve marital problems, restore broken relationships and so on. So, I felt I should give him a try. I contacted him and he did a spell for me. Two days later, my husband came to me and apologized for the wrongs he did and promise never to do it again. Ever since then, everything has returned back to normal. I and my family are living together happily again.. All thanks to Dr Great . If you need a spell caster that can cast a spell that truly works, I suggest you contact him. He will not disappoint you. This is his E-mail: 

      infinitylovespell@gmail.com or infinitylovespell@yahoo.com

      WhatsApp +2348118829899

      website http://infinitylovespell.website2.me/

      Blog http://infinitylovespell1.blogspot.com







      My husband and I have been married for about 7 yrs now. We were happily married with two kids, a boy and a girl. 3 months ago, I started to notice some strange behavior from him and a few weeks later I found out that my husband is seeing someone. He started coming home late from work, he hardly care about me or the kids anymore, Sometimes he goes out and doesn't even come back home for about 2-3 days. I did all I could to rectify this problem but all to no avail. I became very worried and needed help. As I was browsing through the Internet one day, I came across a website that suggested that Dr Great can help solve marital problems, restore broken relationships and so on. So, I felt I should give him a try. I contacted him and he did a spell for me. Two days later, my husband came to me and apologized for the wrongs he did and promise never to do it again. Ever since then, everything has returned back to normal. I and my family are living together happily again.. All thanks to Dr Great . If you need a spell caster that can cast a spell that truly works, I suggest you contact him. He will not disappoint you. This is his E-mail: 

      infinitylovespell@gmail.com or infinitylovespell@yahoo.com

      WhatsApp +2348118829899

      website http://infinitylovespell.website2.me/

      Blog http://infinitylovespell1.blogspot.com









      My husband and I have been married for about 7 yrs now. We were happily married with two kids, a boy and a girl. 3 months ago, I started to notice some strange behavior from him and a few weeks later I found out that my husband is seeing someone. He started coming home late from work, he hardly care about me or the kids anymore, Sometimes he goes out and doesn't even come back home for about 2-3 days. I did all I could to rectify this problem but all to no avail. I became very worried and needed help. As I was browsing through the Internet one day, I came across a website that suggested that Dr Great can help solve marital problems, restore broken relationships and so on. So, I felt I should give him a try. I contacted him and he did a spell for me. Two days later, my husband came to me and apologized for the wrongs he did and promise never to do it again. Ever since then, everything has returned back to normal. I and my family are living together happily again.. All thanks to Dr Great . If you need a spell caster that can cast a spell that truly works, I suggest you contact him. He will not disappoint you. This is his E-mail: 

      infinitylovespell@gmail.com or infinitylovespell@yahoo.com

      WhatsApp +2348118829899

      website http://infinitylovespell.website2.me/

      Blog http://infinitylovespell1.blogspot.com

      Delete

  2. Thanks for providing good information,Thanks for your sharing.Tableau Online Training

    ReplyDelete
  3. TCA, being an online setup, resolves this concern of such aspirants and plays a critical role in saving time, money and energy costs of the aspirants.We are proud to win the trust of hundreds of students with our effectual strategies and powerful mechanism. You can come and join us as TCA Online is surely your gateway to bureaucracy.whatsapp call for
    more info +923133319144


    https://tcaonline.pk/

    Online CSS Academy,

    Online CSS Institute,

    Online CSS Preparation,

    Best CSS Academy,

    Best Online CSS Academy in Pakistan,

    Best CSS Academy in Pakistan,

    Best CSS Academy in Islamabad,

    Best CSS Academy in Lahore,

    Best CSS Academy in Karachi,

    Best CSS Academy in Peshawar,

    GK MCQs

    ReplyDelete
  4. Get your ex lover back urgently Dr Larry email: assurancesulotionhome@gmail com call him on or whatsapp +2348102316854 immediately
    Life without my husband was a real  mess for me and my children I am so happy to get my Ex back through the  help of Dr Larry the spell caster . My greatest surprise was that 48 hours after the Doctor prepared the spell for me, my husband who has abandoned me for 4 years suddenly called me unexpectedly and am so happy that we have come to become one again through the help of Dr Larry and am so happy to be with my husband once again. Dr Larry is a very wonderful spell caster, you can contact him if you need his assistant because i know he can also help you. contact him through his email: assurancesolutionhome@gmail com call him on or whatsapp +2348102316854 immediately website  http://assurancesolutionhome.website2.me/



    Get your ex lover back urgently Dr Larry email: assurancesulotionhome@gmail com call him on or whatsapp +2348102316854 immediately
    Life without my husband was a real  mess for me and my children I am so happy to get my Ex back through the  help of Dr Larry the spell caster . My greatest surprise was that 48 hours after the Doctor prepared the spell for me, my husband who has abandoned me for 4 years suddenly called me unexpectedly and am so happy that we have come to become one again through the help of Dr Larry and am so happy to be with my husband once again. Dr Larry is a very wonderful spell caster, you can contact him if you need his assistant because i know he can also help you. contact him through his email: assurancesolutionhome@gmail com call him on or whatsapp +2348102316854 immediately website  http://assurancesolutionhome.website2.me/



    Get your ex lover back urgently Dr Larry email: assurancesulotionhome@gmail com call him on or whatsapp +2348102316854 immediately
    Life without my husband was a real  mess for me and my children I am so happy to get my Ex back through the  help of Dr Larry the spell caster . My greatest surprise was that 48 hours after the Doctor prepared the spell for me, my husband who has abandoned me for 4 years suddenly called me unexpectedly and am so happy that we have come to become one again through the help of Dr Larry and am so happy to be with my husband once again. Dr Larry is a very wonderful spell caster, you can contact him if you need his assistant because i know he can also help you. contact him through his email: assurancesolutionhome@gmail com call him on or whatsapp +2348102316854 immediately website  http://assurancesolutionhome.website2.me/

    ReplyDelete
  5. cheap ray bans sunglasses uk sale, combining elegant style and cutting-edge technology, a variety of styles of replica ray ban clubmaster, the pointer walks between your exclusive taste style.

    ReplyDelete
  6. URGENT AND EFFECTIVE LOVE SPELL CASTER TO HELP YOU GET BACK YOUR EX LOVER VERY FAST 2019 Contact DR LARRY assurancesolutionhome@gmail. com WhatsApp  +2348102316854 I am Laura Peggy  from (ALABAMA), When I eventually found testimonies about this spell caster Dr Larry, how he helped many people to get their lovers and broken homes back, i contacted him too because I was absolutely desperate to get my lover back. Life without my lover was a real mess for me and my kids. i wanted a dramatic change and I thought love spell could be the solution. After discussing the resolution with Dr Larry, he gave me hope that he will restore my relationship. I felt confident that he will actually make my lover to return home and he did! It’s fantastic what this great spell caster have done for me, his help is priceless! I don't know what I would have done without Dr Larry, He does his job so well he is organized and highly functional, i believe he is the best spell caster i can count on when it comes to all kinds of spell, I am so happy that my lover return back home. If you need help, contact him right now through these details below: Email: assurancesolutionhome@gmail. com WhatsApp +2348102316854 Website: http://assurancesolutionhome.wordpress.com  http://assurancesolutionhome.website2.me/





    URGENT AND EFFECTIVE LOVE SPELL CASTER TO HELP YOU GET BACK YOUR EX LOVER VERY FAST 2019 Contact DR LARRY assurancesolutionhome@gmail. com WhatsApp  +2348102316854 I am Laura Peggy  from (ALABAMA), When I eventually found testimonies about this spell caster Dr Larry, how he helped many people to get their lovers and broken homes back, i contacted him too because I was absolutely desperate to get my lover back. Life without my lover was a real mess for me and my kids. i wanted a dramatic change and I thought love spell could be the solution. After discussing the resolution with Dr Larry, he gave me hope that he will restore my relationship. I felt confident that he will actually make my lover to return home and he did! It’s fantastic what this great spell caster have done for me, his help is priceless! I don't know what I would have done without Dr Larry, He does his job so well he is organized and highly functional, i believe he is the best spell caster i can count on when it comes to all kinds of spell, I am so happy that my lover return back home. If you need help, contact him right now through these details below: Email: assurancesolutionhome@gmail. com WhatsApp +2348102316854 Website: http://assurancesolutionhome.wordpress.com  http://assurancesolutionhome.website2.me/

    ReplyDelete
  7. My husband and I have been married for about 7 yrs now. We were happily married with two kids, a boy and a girl. 3 months ago, I started to notice some strange behavior from him and a few weeks later I found out that my husband is seeing someone. He started coming home late from work, he hardly care about me or the kids anymore, Sometimes he goes out and doesn't even come back home for about 2-3 days. I did all I could to rectify this problem but all to no avail. I became very worried and needed help. As I was browsing through the Internet one day, I came across a website that suggested that Dr Great can help solve marital problems, restore broken relationships and so on. So, I felt I should give him a try. I contacted him and he did a spell for me. Two days later, my husband came to me and apologized for the wrongs he did and promise never to do it again. Ever since then, everything has returned back to normal. I and my family are living together happily again.. All thanks to Dr Great . If you need a spell caster that can cast a spell that truly works, I suggest you contact him. He will not disappoint you. This is his E-mail: 

    infinitylovespell@gmail.com or infinitylovespell@yahoo.com

    WhatsApp +2348118829899

    website http://infinitylovespell.website2.me/

    Blog http://infinitylovespell1.blogspot.com

    ReplyDelete
  8. My husband and I have been married for about 7 yrs now. We were happily married with two kids, a boy and a girl. 3 months ago, I started to notice some strange behavior from him and a few weeks later I found out that my husband is seeing someone. He started coming home late from work, he hardly care about me or the kids anymore, Sometimes he goes out and doesn't even come back home for about 2-3 days. I did all I could to rectify this problem but all to no avail. I became very worried and needed help. As I was browsing through the Internet one day, I came across a website that suggested that Dr Great can help solve marital problems, restore broken relationships and so on. So, I felt I should give him a try. I contacted him and he did a spell for me. Two days later, my husband came to me and apologized for the wrongs he did and promise never to do it again. Ever since then, everything has returned back to normal. I and my family are living together happily again.. All thanks to Dr Great . If you need a spell caster that can cast a spell that truly works, I suggest you contact him. He will not disappoint you. This is his E-mail: 

    infinitylovespell@gmail.com or infinitylovespell@yahoo.com

    WhatsApp +2348118829899

    website http://infinitylovespell.website2.me/

    Blog http://infinitylovespell1.blogspot.com

    ReplyDelete
  9. TCA, being an online setup, resolves this concern of such aspirants and plays a critical role in saving time, money and energy costs of the aspirants.We are proud to win the trust of hundreds of students with our effectual strategies and powerful mechanism. You can come and join us as TCA Online is surely your gateway to bureaucracy.whatsapp call for
    more info +923133319144

    https://tcaonline.pk/


    Online CSS Academy,

    Online CSS Institute,

    Online CSS Preparation,

    Best CSS Academy,

    Best Online CSS Academy in Pakistan,

    Best CSS Academy in Pakistan,

    Best CSS Academy in Islamabad,

    Best CSS Academy in Lahore,

    Best CSS Academy in Karachi,

    Best CSS Academy in Peshawar,

    GK MCQs

    CSS Past Papers

    CSS Optional

    CSS Study

    CSS Subjects

    CSS Exam

    CSS Exam Pattern

    CSS Information

    PMS Syllabus

    CSS Age Limit

    ReplyDelete
  10. PROFESSIONAL SPELL CASTER WHO CAN HELP YOU WITH LOVE-SPELL TO GET YOUR EX LOVER BACK URGENTLY AFTER BREAKUP/DIVORCE EVEN IF YOUR SITUATION SEEMS HOPELESS! CONTACT: INFINITYLOVESPELL@GMAIL.COM IS CERTAINLY THE BEST SPELL CASTER ONLINE AND HIS RESULT IS 100% GUARANTEE..

    After 3 Years in a relationship with my Boyfriend, my Boyfriend started going out with other girls and showing me cold love, on several occasions he threatens to broke-up with me if I dare question him about his affair with other girls, I was totally devastated and confused until an old friend of mine told me about a spell caster on the internet DR GREAT who help people with their relationship and marriage problem by the powers of love Spells, At first I doubted If such thing ever exists but decided to give it a try, When I contact him, he told me everything I needed to do and I did and he helped me cast a Love Spell and within 28Hours my boyfriend came back to me and started apologizing, now he has stopped going out with girls and he is with me for good and for real. Contact this Great spell Caster for your relationship or marriage problem.

    Here's his contact..

    CALL/WHATSAPP: +2348118829899

    EMAIL: infinitylovespell@gmail.com OR infinitylovespell@yahoo.com

    WEBSITE: http://infinitylovespell.website2.me/

    BLOG http://infinitylovespell1.blogspot.com

    ReplyDelete