From: Bodo S. <bo...@le...> - 2009-01-26 12:57:26
|
Hey Noam, you might want to check out Krang::URL Thanx! Bodo > On the topic of convenience methods, does anyone else find themselves > endlessly writing > > my $story_url = $publisher->is_preview ? $story->preview_url : $story->url; > > ? > > If so, how about an optional parameter to Krang::Story->url and > Krang::Media->url, as in > > my $story_url = $story->url($publisher); > > and > > my $media_url = $media->url($publisher); > > They wouldn't have any effect unless $publisher->is_preview == 1, in which > case they would pass the call to preview_url > > ? > > -------------------------------------------------- > From: "Bodo Schulze" <bo...@le...> > Sent: Wednesday, January 21, 2009 5:28 PM > To: "Noam Weinstein" <nwe...@er...> > Cc: "Bodo Schulze" <bo...@le...>; "krang-devel" > <kra...@li...> > Subject: Re: [Krang-devel] Proposal for two optional arguments > to$story->category() > > > Will do if nobody objects. Any other thoughts on this? > > > > Bodo > > > >> Sounds good to me! Also might be nice to have an option that returns just > >> the depth, like > >> $story->category(depth_only => 1) ? > >> > >> -------------------------------------------------- > >> From: "Bodo Schulze" <bo...@le...> > >> Sent: Wednesday, January 21, 2009 2:19 PM > >> To: "krang-devel" <kra...@li...> > >> Subject: [Krang-devel] Proposal for two optional arguments > >> to$story->category() > >> > >> > Hi guys, > >> > > >> > in my publishing code I often have to make decisions based on the > >> > position of a story in the category tree, e.g. do something if the > >> > story > >> > has a primary category being equal or living below category /xyz > >> > > >> > It's a pain to code this over and over again. So how about adding these > >> > signatures to $story->category(): > >> > > >> > $story->category(level => $num); > >> > $story->category(level => $num, dir_only => 1); > >> > > >> > Level 0 would be the root category, level 1 the first level category > >> > and > >> > so on. Would return the category or undef if the category does not > >> > exist. > >> > > >> > Given 'dir_only' it would return just the category's directory or the > >> > empty string (if the category does not exist). > >> > > >> > Make sense? > >> > > >> > Warmest, > >> > > >> > Bodo > >> > > >> > ------------------------------------------------------------------------ > --- > >> --- > >> > This SF.net email is sponsored by: > >> > SourcForge Community > >> > SourceForge wants to tell your story. > >> > http://p.sf.net/sfu/sf-spreadtheword > >> > _______________________________________________ > >> > Krang-devel mailing list > >> > Kra...@li... > >> > https://lists.sourceforge.net/lists/listinfo/krang-devel > >> > > > > > ----------------------------------------------------------------------------- > - > This SF.net email is sponsored by: > SourcForge Community > SourceForge wants to tell your story. > http://p.sf.net/sfu/sf-spreadtheword > _______________________________________________ > Krang-devel mailing list > Kra...@li... > https://lists.sourceforge.net/lists/listinfo/krang-devel |