CodeGarden 10: The sixth annual Umbraco Developer Conference
June 23-25th 2010 - free ASP.NET MVC pre-conference. Register today!

more feeds in more places

7/24/2009 7:21:25 PMAvatarJames HildemanLocation: Appleton, WI USAposts: 60Karma: 55

I created another version of your renderFeed() that allows me to utilize your nifty creation in other places in my dashboards.  This one takes a feedname, if it's blank it uses the tabname logic you had, if not blank it uses the 'feedname' parm.  This allows me to add more feeds to your dashrss.config and then use them in columns or sidebars on other dashboard tabs.  Thanks for the cool tools.

CODE in dashrss.js (changes in bold)

fmDashRss.renderFeedExt = function(id, umbracoPath, feedname) {
    if(!fmDashRss.css) {
        fmDashRss.css = true;
        var script = f.createElement("link");
        script.setAttribute("rel", "stylesheet");
        script.setAttribute("type", "text/css");
        script.setAttribute("href", umbracoPath + fmDashRss.appVPath + '/dashrss.css');
        head.appendChild(script);
    }
   
    if(!fmDashRss.loadingGif) {
        fmDashRss.loadingGif = umbracoPath + fmDashRss.appVPath + '/ajax-loader.gif';
        fmDashRss.loadingGif = '<img src="'+fmDashRss.loadingGif+'" alt="Loading" width="16" height="16"/>';
    }
       
    if (feedname == "")
    {
      var containerId = $('#'+id).parent().parent().attr('id');
      containerId = containerId.replace(/^(.*?\_tab\d{2}).*$/, "$1");

      var tabName = $('#' + containerId + ' span nobr').html();
      fmDashRss.load(id, tabName, umbracoPath);
    }
    else
    {
      fmDashRss.load(id, feedname, umbracoPath);
    }

}

Example Code to utilize:

      <h3>Help</h3>
        <div id="rssdfblog" class="dashRss">     
        </div>
        <script type="text/javascript">
        <!--
          $(document).ready(function() {
                $('.tabpagecontainer div:first').each(function() {
                    $(this).css({'display': 'block'});
                });
                fmDashRss.renderFeedExt('rssdfblog', '<%= ConfigurationManager.AppSettings["umbracoPath"] %>', 'Darren Ferguson');
          });       
        // -->
        </script>

 

7/27/2009 10:12:52 AMAvatarDarren FergusonLocation: SE3 9EFVendor.posts: 376Karma: 533
Comment with ID: 10775

Good stuff. Thanks!

I'll revisit this package at a later point to add a few new whistles and bells, i'll try and incorporate your ideas at that point.

 

Please login or Sign up To post replies