Monday 19 October 2015

Advanced CSS questions answered.

This is from the excellent and well recommended Advanced Sass Team Treehouse course.

The following Sass uses the @at-root directive within a media query. Sass considered @media to be root, so how can you update this so that the .barselector is at the absolute root of the document?



.foo {
@media (min-width: 400px) {
display: flex;
@at-root ( without: rule media ) {
.bar {
display: inline-block;
}
}
}
}



In the following code challenge, we are hard-coding the name of the nested selector .foo-bar. How can we update this to inherit the parent selector of .foo?

.foo {
@media (min-width: 400px) {
display: flex;
@at-root (without: media rule) {
&-bar {
display: inline-block;
}
}
}
}

Wednesday 14 October 2015

TypeError: this.form_*.options is undefined */sites/all/libraries/chosen/chosen.jquery.min.js?v=1.1.0 Line 2

This post is relevant to Drupal 7 chosen module and using Views and having an exposed filer.

So using Pages to set this up the first dropdown list wasn't displaying correctly .  And in Firebug error I could see the message

TypeError: this.form_*.options is undefined */sites/all/libraries/chosen/chosen.jquery.min.js?v=1.1.0 Line 2

What made this even stranger is that when calling the panel for the exposed filter again on the page the second version works fine.  Swap them around and it's always the top one that fell down.

In the end I found the code at fault in a customized file in themes.



 if (typeof $selects.chosen === 'function' && categoryLocation !== 'client-stories' ) {

        $selects.chosen({ 

          disable_search_threshold: 1,

          placeholder_text_multiple: 'Choose options',

          placeholder_text_single: 'Choose'

        });

      } 

A temporary fix was to ignore for the page I was on.  But does anyone know why the issue is occurring , I'd love to know.  Here's my fix .


             // an issue with the dropdown on 'client-stories' that's linked to this page - going to ignore this code for that page

        // 1. lets get the folder we're in.



        var pathArray = window.location.pathname.split( '/' );

        var categoryLocation = pathArray[1];

        // 2. and ignore the following if we are on the client-stories page .



      if (typeof $selects.chosen === 'function' && categoryLocation !== 'client-stories' ) {

        $selects.chosen({

          disable_search_threshold: 1,

          placeholder_text_multiple: 'Choose options',

          placeholder_text_single: 'Choose'

        });

      }



Thursday 8 October 2015

drupal 7 mini panels not being picked up in pages add content


drupal 7 mini panels not being picked up in pages add content



What you need to do here is set the category in the Mini Panel to 'Mini panel'  .

You'll then see it listed in 'mini panel' when adding content in pages.