[ 12 posts ] Go to page 1, 2 Next

Marc

YUI Contributor

  • Offline
  • Profile

How to specify a gallery dependency with YUI.add

Post Posted: Wed Jun 02, 2010 10:03 am
+0-
Hi,

I'm trying to specify a gallery dependency for a YUI.add statement but can't seem to find a way to do it.

I would have thought, this might do the trick:
YUI.add{
//code
} ,'1.0',{
gallery:['gallery-2010.05.26-19-47'],
use:['overlay','gallery-overlay-extras']
}

Any suggestions on this?

Kind regards,

Marc

Adam Moore

YUI Contributor

  • Username: adam
  • Joined: Wed Sep 03, 2008 11:16 am
  • Posts: 356
  • GitHub: apm
  • Gists: apm
  • Offline
  • Profile

Re: How to specify a gallery dependency with YUI.add

Post Posted: Wed Jun 02, 2010 10:17 am
+0-
Code:
YUI.add('usesgallery', function(Y) {
        // code
    }, '1.0.0', {
        requires: ['overlay','gallery-overlay-extras']                                                                                                                                   
    });

Marc

YUI Contributor

  • Offline
  • Profile

Re: How to specify a gallery dependency with YUI.add

Post Posted: Wed Jun 02, 2010 11:26 am
+0-
Doesn't work for me. Overlay, yes, gallery stuff, no. I'm thinking it has something to do with the fact that I cannot specify the gallery id

Marc

YUI Contributor

  • Offline
  • Profile

Re: How to specify a gallery dependency with YUI.add

Post Posted: Wed Jun 02, 2010 12:35 pm
+0-
Hmm, it seems to work on Firefox but not on Chrome. No error messages. I'll have to dig a little further

Marc

YUI Contributor

  • Offline
  • Profile

Re: How to specify a gallery dependency with YUI.add

Post Posted: Wed Jun 02, 2010 12:41 pm
+0-
Actually, it didn't. It just worked because I placed a bit of test code on the page:
Code:
YUI({
   gallery: 'gallery-2010.05.12-19-08'
}).use('gallery-overlay-extras', function(Y){
   var fbOverlay = new Y.Overlay({
      srcNode      : '#fbOverlay',
      width      : '540px',
      height      : '300px',
      zIndex      : 100,
      centered   : true,
      constrain   : true,
      render      : true,
      visible      : false,
      plugins      : [
         { fn: Y.Plugin.OverlayModal },
         { fn: Y.Plugin.OverlayKeepaligned },
         { fn: Y.Plugin.OverlayAutohide }
      ]
   });   
});




The reason it doesn't worked, is that I can't specify the library id.

Adam Moore

YUI Contributor

  • Username: adam
  • Joined: Wed Sep 03, 2008 11:16 am
  • Posts: 356
  • GitHub: apm
  • Gists: apm
  • Offline
  • Profile

Re: How to specify a gallery dependency with YUI.add

Post Posted: Wed Jun 02, 2010 1:12 pm
+0-
Correct, the gallery tag is in the domain of YUI().use(), not YUI.add.

Marc

YUI Contributor

  • Offline
  • Profile

Re: How to specify a gallery dependency with YUI.add

Post Posted: Wed Jun 02, 2010 2:58 pm
+0-
Ok, that doesn't make sense to me.

I worked around it by initializing the init method with the gallery module dependent module with
YUI.add('gallery_thatuses_module',function(e){}, '1.0',{
requires:['gallery_module']
});

YUI(gallery:'gallery_id').use('gallery_thatuses_module',etc{
// call init method
})

But if gallery is going to be a full citizen and be directly integrated in YUI().use(), imho YUI.add function should also support it.

Cheers,

Marc

Marc

YUI Contributor

  • Offline
  • Profile

Re: How to specify a gallery dependency with YUI.add

Post Posted: Thu Jun 03, 2010 3:10 am
+0-
This little workaround doesn't work. Best way I found was to download the gallery items and dependencies and store them locally, then :

Code:
YUI_config.groups={
      mygallery:{
         base:baseUrl + '/js/yui-library/',
         modules:{
            'gallery-outside-events':{
               requires:['event-focus', 'event-synthetic']
            }
            ,'gallery-overlay-modal':{}
            ,'gallery-overlay-extras':{
               requires:['overlay','gallery-outside-events','plugin','event-resize']
            }
         }
      }
   };

Caridy Patino

YUI Contributor

  • Username: caridy
  • Joined: Mon Dec 08, 2008 5:40 pm
  • Posts: 493
  • Location: Miami, FL
  • Twitter: caridy
  • GitHub: caridy
  • Gists: caridy
  • IRC: caridy
  • YUI Developer
  • Offline
  • Profile
Tags:

Re: How to specify a gallery dependency with YUI.add

Post Posted: Thu Jun 03, 2010 6:18 am
+0-
Hey Marc,

What version of the YUI seed file are you using? Normally, if the gallery module has the requirements well defined, you don't need to do it again, and YUI loader will be smart enough to compute them. That was introduced in 3.1.x if I remember correctly.

Best Regards,
Caridy

Marc

YUI Contributor

  • Offline
  • Profile

Re: How to specify a gallery dependency with YUI.add

Post Posted: Thu Jun 03, 2010 8:06 am
+0-
Hi Caridy,

I'm using 3.1.1. The problem I think was that with YUI.add there is no option to define a gallery, like with YUI().use. I was trying to work around that but the groups approach is much better and works fine for me.

All my stuff migrated to YUI 3 now, just calendar and simple editor left. Me happy :-)

Kind regards,

Marc
  [ 12 posts ] Go to page 1, 2 Next
Display posts from previous:  Sort by  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum