Team:WITS-CSIR SA/calendar.js

From 2011.igem.org

(function($){

 $.fn.AccordionCalendar = function(opts){
   var options  = $.extend({}, opts, $.fn.AccordionCalendar.defaults);
   var tmpl = $('#tmplCalendar').html();
   
   
   function CurrentMonth (){
     var months =['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
     
     return months[new Date().getMonth()];
   }
   
   return $(this).each(function(e, i){
     var caller = $(this);
     
     function BuildAccordion(month){
       $('div.weeks', caller).empty();
       var m = $.grep(options.Data, function(el, index){
         return el.Name == month;
       });
       
       if(m.length > 0){
         m = m[0];
         //log.debug('Found month');
         
         var weekTmpl = $('#tmplWeeks').html();
         $('div.weeks', caller).html(_.template(weekTmpl, m));
         
         $('div.weeks', caller).accordion('destroy');
         $('div.weeks', caller).accordion({
       		autoHeight: false,
     			navigation: true
     		});
         
         //log.debug('Rendered accordion');
       }
     }
     
     try
     {
       caller.empty().hide();
       caller.append(_.template(tmpl, {Months: options.Data}));
       caller.addClass('ui-widget-content ui-corner-all');
       
       //log.debug('Built initial structure');
       $('div.months > a', caller).click(function(){
         $('div.months > a.current', caller).removeClass('current');
         $(this).addClass('current');
         BuildAccordion($(this).html());
       });
       $('div.months > a', caller).each(function(){
         if($(this).html() == CurrentMonth()){
           //log.debug('Current month is "' + CurrentMonth() + '"');
           $(this).click();
         }
       });
       caller.fadeIn('slow');
     }
     catch(ex){
        //log.error(ex);

alert(ex);

     }
   });
 };
 
 $.fn.AccordionCalendar.defaults = {
   
   Data: [{
     Name: 'May',
     Weeks:[{
       Name: '01 - 07 May 2011',
       Days: [
         { Name: 'Monday', Text: 'Natasia worked with the web developer, Shaun, on developing the wiki. We created pages for various aspects of the project. A picture slider was inserted on the home page as well as boxes for the content. A menu bar was also created to allow a visitor to the site to navigate easily from one page to another.' },
         { Name: 'Tuesday', Text: 'We met to discuss various aspects of the project incuding fund raising, community outreach and the specifics involved in the machine construct. We set a deadline for Friday for the choice of aptamers and promoters for the project. The engineers will work on the modelling side of the project once the promoters and aptamers are chosen. We all had a look at the wiki and shared ideas on the look and feel of the site.' },
         { Name: 'Wednesday', Text: 'Brad and Richard worked on the modelling aspect of the project. The biologists researched various aptamers and promoters as potential candicates for the machine construct.' },
         { Name: 'Thursday', Text: 'The biologists worked on doing research on the promoters and the aptamers that will be used in the project. The research indicated that the theophylene aptamer is leaky which is just what we need! The tetracycline aptamer seems to block translation not promote it (where we are looking for aptamers that promote translation). This means we will have to keep looking for our second aptamer.

Natasia met with a connection in a corporate institute who is involved with CSI funding allocations for tips on how to approach potential donors.' }, { Name: 'Friday', Text: 'The biologists met to discuss the choice of aptamers but still only theophylline was a definite. The second aptamer to use was still being searched for. Brad came through to contribute to the biologists. His logic skills were invaluable! The biologists also researched toggle switches further to try come up with a way to create a system that is sensitive to a particular concentration of theophylline.' }, { Name: 'Saturday', Text: 'The biologists read through various articles about toggle switches. The use of a toggle switch will enable us to switch off the attraction of a bacterium to a substance only at a particular concentration.' }, { Name: 'Sunday', Text: } ] }, { Name: '08 - 14 May 2011', Days: [ { Name: 'Monday', Text: 'Sasha and Natasia spoke about the toggle switch that could be used for the circuit. We will be synthesizing the toggle switch and testing its response concentration through the use of a graph as was done in the papers we read through. We went through the CSI handbook to find potential donors. The book contains information on the funding interests of over 100 companies in South Africa! We found over 20 that are interested in donating money for tertiary research. We approached Michelle to source strategies on how to appeal to all of these sponsors.' }, { Name: 'Tuesday', Text: 'Natasia met with Karl and got some ideas for a pamphlet to entice companies to donate. Sasha, Gloria and Ezio took a roadtrip to Pretoria to CSIR, our partners. For the full experience, visit our gallery.' }, { Name: 'Wednesday', Text: 'Team photoshoot! The pamphlet to go to the donors requires scientific photos of the team. The entire team donned lab coats and posed for very serious, academic photos. We hope to prove that the value of donations will be directly proportional to the scientific-ness of the photos. Hold thumbs! The team also edited the pamphlet to go to companies and added in our nerdy pictures.' }, { Name: 'Thursday', Text: 'Natasia worked on the Wiki, adding styles to all the pages. Research continues on toggle switches and aptamers... ' }, { Name: 'Friday', Text: 'Ezio and Sasha put together a document containing information on the genetic circuit used in the project. This was then sent to an expert on chemotaxis to gather some valuable opinions on the genetic construct and any advice on optimizing it. The pamphlet for the donors was also completed and is ready for printing!' }, { Name: 'Saturday', Text: }, { Name: 'Sunday', Text: } ] }] }, { Name: 'June', Weeks:[{ Name: '?? - ?? ???? 2011', Days: [ { Name: 'Monday', Text: 'Content' }, { Name: 'Tuesday', Text: 'Content' }, { Name: 'Wednesday', Text: 'Content' }, { Name: 'Thursday', Text: 'Content' }, { Name: 'Friday', Text: 'Content' }, { Name: 'Saturday', Text: 'Content' }, { Name: 'Sunday', Text: 'Content' } ] }, { Name: '?? - ?? ???? 2011', Days: [ { Name: 'Monday', Text: 'Content' }, { Name: 'Tuesday', Text: 'Content' }, { Name: 'Wednesday', Text: 'Content' }, { Name: 'Thursday', Text: 'Content' }, { Name: 'Friday', Text: 'Content' }, { Name: 'Saturday', Text: 'Content' }, { Name: 'Sunday', Text: 'Content' } ] }, { Name: '?? - ?? ???? 2011', Days: [ { Name: 'Monday', Text: 'Content' }, { Name: 'Tuesday', Text: 'Content' }, { Name: 'Wednesday', Text: 'Content' }, { Name: 'Thursday', Text: 'Content' }, { Name: 'Friday', Text: 'Content' }, { Name: 'Saturday', Text: 'Content' }, { Name: 'Sunday', Text: 'Content' } ] }, { Name: '?? - ?? ???? 2011', Days: [ { Name: 'Monday', Text: 'Content' }, { Name: 'Tuesday', Text: 'Content' }, { Name: 'Wednesday', Text: 'Content' }, { Name: 'Thursday', Text: 'Content' }, { Name: 'Friday', Text: 'Content' }, { Name: 'Saturday', Text: 'Content' }, { Name: 'Sunday', Text: 'Content' } ] }] }, { Name: 'July', Weeks:[{ Name: '?? - ?? ???? 2011', Days: [ { Name: 'Monday', Text: 'Content' }, { Name: 'Tuesday', Text: 'Content' }, { Name: 'Wednesday', Text: 'Content' }, { Name: 'Thursday', Text: 'Content' }, { Name: 'Friday', Text: 'Content' }, { Name: 'Saturday', Text: 'Content' }, { Name: 'Sunday', Text: 'Content' } ] }, { Name: '?? - ?? ???? 2011', Days: [ { Name: 'Monday', Text: 'Content' }, { Name: 'Tuesday', Text: 'Content' }, { Name: 'Wednesday', Text: 'Content' }, { Name: 'Thursday', Text: 'Content' }, { Name: 'Friday', Text: 'Content' }, { Name: 'Saturday', Text: 'Content' }, { Name: 'Sunday', Text: 'Content' } ] }, { Name: '?? - ?? ???? 2011', Days: [ { Name: 'Monday', Text: 'Content' }, { Name: 'Tuesday', Text: 'Content' }, { Name: 'Wednesday', Text: 'Content' }, { Name: 'Thursday', Text: 'Content' }, { Name: 'Friday', Text: 'Content' }, { Name: 'Saturday', Text: 'Content' }, { Name: 'Sunday', Text: 'Content' } ] }, { Name: '?? - ?? ???? 2011', Days: [ { Name: 'Monday', Text: 'Content' }, { Name: 'Tuesday', Text: 'Content' }, { Name: 'Wednesday', Text: 'Content' }, { Name: 'Thursday', Text: 'Content' }, { Name: 'Friday', Text: 'Content' }, { Name: 'Saturday', Text: 'Content' }, { Name: 'Sunday', Text: 'Content' } ] }] }, { Name: 'August', Weeks:[{ Name: '?? - ?? ???? 2011', Days: [ { Name: 'Monday', Text: 'Content' }, { Name: 'Tuesday', Text: 'Content' }, { Name: 'Wednesday', Text: 'Content' }, { Name: 'Thursday', Text: 'Content' }, { Name: 'Friday', Text: 'Content' }, { Name: 'Saturday', Text: 'Content' }, { Name: 'Sunday', Text: 'Content' } ] }, { Name: '?? - ?? ???? 2011', Days: [ { Name: 'Monday', Text: 'Content' }, { Name: 'Tuesday', Text: 'Content' }, { Name: 'Wednesday', Text: 'Content' }, { Name: 'Thursday', Text: 'Content' }, { Name: 'Friday', Text: 'Content' }, { Name: 'Saturday', Text: 'Content' }, { Name: 'Sunday', Text: 'Content' } ] }, { Name: '?? - ?? ???? 2011', Days: [ { Name: 'Monday', Text: 'Content' }, { Name: 'Tuesday', Text: 'Content' }, { Name: 'Wednesday', Text: 'Content' }, { Name: 'Thursday', Text: 'Content' }, { Name: 'Friday', Text: 'Content' }, { Name: 'Saturday', Text: 'Content' }, { Name: 'Sunday', Text: 'Content' } ] }, { Name: '?? - ?? ???? 2011', Days: [ { Name: 'Monday', Text: 'Content' }, { Name: 'Tuesday', Text: 'Content' }, { Name: 'Wednesday', Text: 'Content' }, { Name: 'Thursday', Text: 'Content' }, { Name: 'Friday', Text: 'Content' }, { Name: 'Saturday', Text: 'Content' }, { Name: 'Sunday', Text: 'Content' } ] }] }, { Name: 'September', Weeks:[{ Name: '?? - ?? ???? 2011', Days: [ { Name: 'Monday', Text: 'Content' }, { Name: 'Tuesday', Text: 'Content' }, { Name: 'Wednesday', Text: 'Content' }, { Name: 'Thursday', Text: 'Content' }, { Name: 'Friday', Text: 'Content' }, { Name: 'Saturday', Text: 'Content' }, { Name: 'Sunday', Text: 'Content' } ] }, { Name: '?? - ?? ???? 2011', Days: [ { Name: 'Monday', Text: 'Content' }, { Name: 'Tuesday', Text: 'Content' }, { Name: 'Wednesday', Text: 'Content' }, { Name: 'Thursday', Text: 'Content' }, { Name: 'Friday', Text: 'Content' }, { Name: 'Saturday', Text: 'Content' }, { Name: 'Sunday', Text: 'Content' } ] }, { Name: '?? - ?? ???? 2011', Days: [ { Name: 'Monday', Text: 'Content' }, { Name: 'Tuesday', Text: 'Content' }, { Name: 'Wednesday', Text: 'Content' }, { Name: 'Thursday', Text: 'Content' }, { Name: 'Friday', Text: 'Content' }, { Name: 'Saturday', Text: 'Content' }, { Name: 'Sunday', Text: 'Content' } ] }, { Name: '?? - ?? ???? 2011', Days: [ { Name: 'Monday', Text: 'Content' }, { Name: 'Tuesday', Text: 'Content' }, { Name: 'Wednesday', Text: 'Content' }, { Name: 'Thursday', Text: 'Content' }, { Name: 'Friday', Text: 'Content' }, { Name: 'Saturday', Text: 'Content' }, { Name: 'Sunday', Text: 'Content' } ] }] }, { Name: 'October', Weeks:[{ Name: '?? - ?? ???? 2011', Days: [ { Name: 'Monday', Text: 'Content' }, { Name: 'Tuesday', Text: 'Content' }, { Name: 'Wednesday', Text: 'Content' }, { Name: 'Thursday', Text: 'Content' }, { Name: 'Friday', Text: 'Content' }, { Name: 'Saturday', Text: 'Content' }, { Name: 'Sunday', Text: 'Content' } ] }, { Name: '?? - ?? ???? 2011', Days: [ { Name: 'Monday', Text: 'Content' }, { Name: 'Tuesday', Text: 'Content' }, { Name: 'Wednesday', Text: 'Content' }, { Name: 'Thursday', Text: 'Content' }, { Name: 'Friday', Text: 'Content' }, { Name: 'Saturday', Text: 'Content' }, { Name: 'Sunday', Text: 'Content' } ] }, { Name: '?? - ?? ???? 2011', Days: [ { Name: 'Monday', Text: 'Content' }, { Name: 'Tuesday', Text: 'Content' }, { Name: 'Wednesday', Text: 'Content' }, { Name: 'Thursday', Text: 'Content' }, { Name: 'Friday', Text: 'Content' }, { Name: 'Saturday', Text: 'Content' }, { Name: 'Sunday', Text: 'Content' } ] }, { Name: '?? - ?? ???? 2011', Days: [ { Name: 'Monday', Text: 'Content' }, { Name: 'Tuesday', Text: 'Content' }, { Name: 'Wednesday', Text: 'Content' }, { Name: 'Thursday', Text: 'Content' }, { Name: 'Friday', Text: 'Content' }, { Name: 'Saturday', Text: 'Content' }, { Name: 'Sunday', Text: 'Content' } ] }] }, { Name: 'November', Weeks:[{ Name: '?? - ?? ???? 2011', Days: [ { Name: 'Monday', Text: 'Content' }, { Name: 'Tuesday', Text: 'Content' }, { Name: 'Wednesday', Text: 'Content' }, { Name: 'Thursday', Text: 'Content' }, { Name: 'Friday', Text: 'Content' }, { Name: 'Saturday', Text: 'Content' }, { Name: 'Sunday', Text: 'Content' } ] }, { Name: '?? - ?? ???? 2011', Days: [ { Name: 'Monday', Text: 'Content' }, { Name: 'Tuesday', Text: 'Content' }, { Name: 'Wednesday', Text: 'Content' }, { Name: 'Thursday', Text: 'Content' }, { Name: 'Friday', Text: 'Content' }, { Name: 'Saturday', Text: 'Content' }, { Name: 'Sunday', Text: 'Content' } ] }, { Name: '?? - ?? ???? 2011', Days: [ { Name: 'Monday', Text: 'Content' }, { Name: 'Tuesday', Text: 'Content' }, { Name: 'Wednesday', Text: 'Content' }, { Name: 'Thursday', Text: 'Content' }, { Name: 'Friday', Text: 'Content' }, { Name: 'Saturday', Text: 'Content' }, { Name: 'Sunday', Text: 'Content' } ] }, { Name: '?? - ?? ???? 2011', Days: [ { Name: 'Monday', Text: 'Content' }, { Name: 'Tuesday', Text: 'Content' }, { Name: 'Wednesday', Text: 'Content' }, { Name: 'Thursday', Text: 'Content' }, { Name: 'Friday', Text: 'Content' }, { Name: 'Saturday', Text: 'Content' }, { Name: 'Sunday', Text: 'Content' } ] }] }] };

})(jQuery);