Team:WITS-CSIR SA/client/MenuModel.js
From 2011.igem.org
(Difference between revisions)
Line 33: | Line 33: | ||
this.items.add(new MenuItem({ text: 'Home', path: 'https://2011.igem.org/Team:WITS-CSIR_SA', tag: 'https://2011.igem.org/Team:WITS-CSIR_SA/' })); | this.items.add(new MenuItem({ text: 'Home', path: 'https://2011.igem.org/Team:WITS-CSIR_SA', tag: 'https://2011.igem.org/Team:WITS-CSIR_SA/' })); | ||
this.items.add(new MenuItem({ text: 'Project', path: 'https://2011.igem.org/Team:WITS-CSIR_SA/Project/Concept', tag: 'project' })); | this.items.add(new MenuItem({ text: 'Project', path: 'https://2011.igem.org/Team:WITS-CSIR_SA/Project/Concept', tag: 'project' })); | ||
- | this.items.add(new MenuItem({ text: ' | + | this.items.add(new MenuItem({ text: 'Gallery', path: 'https://2011.igem.org/Team:WITS-CSIR_SA/Diary/Gallery/Minutes', tag: 'gallery' })); |
this.items.add(new MenuItem({ text: 'Outreach', path: 'https://2011.igem.org/Team:WITS-CSIR_SA/Outreach/Workshop', tag: 'outreach' })); | this.items.add(new MenuItem({ text: 'Outreach', path: 'https://2011.igem.org/Team:WITS-CSIR_SA/Outreach/Workshop', tag: 'outreach' })); | ||
this.items.add(new MenuItem({ text: 'Collaboration', path: 'https://2011.igem.org/Team:WITS-CSIR_SA/Collaboration/Index', tag: 'collaboration' })); | this.items.add(new MenuItem({ text: 'Collaboration', path: 'https://2011.igem.org/Team:WITS-CSIR_SA/Collaboration/Index', tag: 'collaboration' })); |
Revision as of 11:28, 17 September 2011
/// <reference path="../../js/lib/backbone.js" /> /// <reference path="../../js/lib/underscore.js" /> /// <reference path="../../js/lib/jlayout.border.js" /> /// <reference path="../../js/lib/jquery-1.5.1.min.js" /> /// <reference path="../../js/lib/jquery-ui-1.8.14.custom.min.js" /> /// <reference path="../../js/lib/jQuery.BlockUI.js" /> /// <reference path="../../js/lib/jquery.fling.js" /> /// <reference path="../../js/lib/jquery.jlayout.js" /> /// <reference path="../../js/lib/jquery.sizes.js" /> /// <reference path="../../js/lib/modernizr-1.7.min.js" /> /// <reference path="../../js/lib/sammy-latest.min.js" /> /// <reference path="../../js/common.js" />
$(function () {
var MenuItem = Backbone.Model.extend({ initialize: function () { }, text: null, path: null, tag: null });
var MenuItems = Backbone.Collection.extend({ initialize: function (models, options) { } });
var MenuView = Backbone.View.extend({ el: $('div.menu'), initialize: function () { this.items = new MenuItems(null, { view: this });
this.items.add(new MenuItem({ text: 'Home', path: 'https://2011.igem.org/Team:WITS-CSIR_SA', tag: 'https://2011.igem.org/Team:WITS-CSIR_SA/' })); this.items.add(new MenuItem({ text: 'Project', path: 'https://2011.igem.org/Team:WITS-CSIR_SA/Project/Concept', tag: 'project' })); this.items.add(new MenuItem({ text: 'Gallery', path: 'https://2011.igem.org/Team:WITS-CSIR_SA/Diary/Gallery/Minutes', tag: 'gallery' })); this.items.add(new MenuItem({ text: 'Outreach', path: 'https://2011.igem.org/Team:WITS-CSIR_SA/Outreach/Workshop', tag: 'outreach' })); this.items.add(new MenuItem({ text: 'Collaboration', path: 'https://2011.igem.org/Team:WITS-CSIR_SA/Collaboration/Index', tag: 'collaboration' })); this.items.add(new MenuItem({ text: 'Sponsors', path: 'https://2011.igem.org/Team:WITS-CSIR_SA/Sponsors', tag: 'sponsors' })); this.items.add(new MenuItem({ text: 'About Us', path: 'https://2011.igem.org/Team:WITS-CSIR_SA/AboutUs/MeetTheTeam', tag: 'aboutus' }));this.template = '
' +
' <% _.forEach(models, function(model) { %>' + ' <% var str = location.toString(); str = str.substr(str.indexOf("Team:WITS-CSIR_SA/") + "Team:WITS-CSIR_SA/".length, str.length); %>' + ' <a <%= (str.toLowerCase().indexOf(model.get(\'tag\').toLowerCase()) > -1) ? \'class="current"\' : \'\' %> href="<%= model.get(\'path\') %>"><%= model.get(\'text\') %></a>' + ' <% }); %>' +' | ' +
' ' +
' ' +
' +
' ' Search:' + ' <input class="styleTextbox" type="text" value="" />' + ' <input class="styleButton" type="button" value="Go" />' + ' <input class="styleButton" type="button" value="Search" />' +' | ' +
'
this.render(); }, render: function () { var html = _.template(this.template, this.items); this.el.html(html);
$('.searchBox').empty(); $('#searchform').width(350).appendTo('.searchBox'); $('#searchform').css({ position: 'relative', top: '100px' });
FormatButtons(); // layout(); } });
$.fling('subscribe', 'ready', function () { var menu = new MenuView(); });
});