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.


Wednesday, 23 September 2015

drupal 7 how to add exposed form view to pages

Go to the view you want to use the Form from . 

In advanced you can add ‘Exposed form in a block ‘ 

SAVE - Clear Cache. 

Once you do this then go the Page you are changing in Pages

Add content to a Panel 


> in the tab Views you will now see the form . starting with ‘exposed : ‘

Thursday, 17 September 2015

To Add a New Display in Drupal 7 Display Suite.


> Navigate to ‘ Structure > Display suite > View modes > add a view mode


drupal 7 display suite mode not showing


Then go to the Display of the Article Type etc

> structure/types/manage/ARTICLE TYPE /display

> scroll down and find 'Custom display Setting' 

> select your display suite mode from here and save. 

Monday, 14 September 2015

Drupal 7 Feed Importer Notes.

Just a couple of notes I've made regarding the Feed Importer.

Using Views and Feeds to Import. 



Tips -

  1. Save as ‘Windows Comma Separated Value’  
  2. Just Import New nodes
  3. We can expire nodes here. 
  4. FEED TAMPER - use if you want to make modifications to any fields. i.e. many php functions like rewrite, regex etc.  


Whats comes with Feeds. 


  1. Feed import
  2. Feed Import Base
  3. Feeds
  4. Feeds Admin Ui
  5. Feeds News
  6. Feeds Xpath Parser 

Twitter API working locally but not Live.

I had this issue recently and could not find and resolutions for it online.


After checking in Firebug > Dom >  I could see this issue


2015-08-25 10:03:24PHP errorPHP Fatal error: Cannot redeclare class OAuthException in jquery-social-stream/twitter.php on line 0 request_id="v-863a6920-4b10-11e5-bfa3-22000a22a668”


The solution for me here was to in the JQuery Social Stream JS file.  There is a class call for OAuthException  .  By wrapping that in an argument that checks whether it exists fixed my issue.




// redclare issue fixed by if statement

if (!class_exists('OAuthException')) {

  class OAuthException extends Exception {

    // pass

  }

}