PageRenderTime 26ms CodeModel.GetById 1ms RepoModel.GetById 0ms app.codeStats 0ms

/Src/WS.EKA.Portal/Scripts/models/catalog.js

http://mobileshop.codeplex.com
JavaScript | 43 lines | 37 code | 6 blank | 0 comment | 0 complexity | c02ef6fbdf66783a85f0557f03663256 MD5 | raw file
Possible License(s): Apache-2.0, BSD-3-Clause
  1. var catalogData = [
  2. { href: "#", src: "/Content/Images/catalog/myhome.png", text: "??ShopNum1", type: "myhome" },
  3. { href: "#", src: "/Content/Images/catalog/categorys.png", text: "????", type: "categorys" },
  4. { href: "#", src: "/Content/Images/catalog/collect.png", text: "????", type: "collect" },
  5. { href: "#", src: "/Content/Images/catalog/message.png", text: "????", type: "message" },
  6. { href: "#", src: "/Content/Images/catalog/ebook.png", text: "???", type: "buyer" },
  7. { href: "#", src: "/Content/Images/catalog/band.png", text: "????", type: "order" }
  8. ];
  9. window.Catalog = Backbone.Model.extend({
  10. defaults: {
  11. href: "#",
  12. src: "/Content/Images/catalog/myhome.png",
  13. text: "??ShopNum1"
  14. }
  15. });
  16. window.CatalogCollection = Backbone.Collection.extend({
  17. model: Catalog
  18. });
  19. window.CatalogView = Backbone.View.extend({
  20. el: "#jqt",
  21. initialize: function () {
  22. this.collection = new CatalogCollection(catalogData);
  23. this.template = $('#IndexCatalogTemplate').html();
  24. },
  25. render: function () {
  26. var partial = { header: $('#HeaderTemplate').html(), footer: $('#FooterTemplate').html(), innerFooter: $('#InnerFooterTemplate').html() };
  27. var data = { hasLogo: true, btnListR: [{ name: 'avatar' }, { name: 'cart'}], btnListL: [{ name: 'sort'}],
  28. list: this.collection.toJSON()
  29. };
  30. this.$el.append(Mustache.render(this.template, data, partial));
  31. new Plugins.SearchPlugin('#Catalog .searchContainer', {
  32. id: 'keyword_catalog',
  33. isGlobalSearch:true
  34. });
  35. return this;
  36. }
  37. });