git-svn-id: https://msi/svn/firstRepo/WebClient/branches/NewRelease@33 0f545695-f87b-41b6-9a03-7f16563b5454

This commit is contained in:
2015-05-07 13:16:11 +00:00
parent d0d55ee8e5
commit 282ad76c48
79 changed files with 2416 additions and 1824 deletions
+46 -35
View File
@@ -1,38 +1,49 @@
define(['jquery', 'underscore', 'backbone','text!modules/index/indexViewTemplate.html', 'modules/base/baseView'],
function($, _, Backbone, indexViewTemplate, BaseView){
define(['jquery', 'underscore', 'backbone', 'text!modules/index/indexViewTemplate.html', 'text!modules/index/indexItemViewTemplate.html', 'modules/base/baseView'],
function ($, _, Backbone, indexViewTemplate, indexItemViewTemplate, BaseView) {
var IndexView = BaseView.extend({
var IndexView = BaseView.extend({
collection: null,
//initialize template
template: _.template(indexViewTemplate),
//templateItem:_.template(indexItemViewTemplate, {variable: 'item'}),
collection: null,
//initialize template
template:_.template(indexViewTemplate),
initialize: function (options) {
this.id = "IndexView";
var self = this;
IndexView.__super__.initialize.call(this);
/*this.collection = options.collection;
this.collection.fetch({
success: function(){
var $ul = $('#categoryList');
var html = "";
_.each(self.collection.toJSON(), function(d) {
html += self.templateItem(d);
});
$ul.html(html);
$ul.listview("refresh");
$ul.trigger("updatelayout");
self.trigger("renderCompleted:Categories",self);
}
});*/
},
//render the content into div of view
render: function () {
if (this.created === true)
{
//this.header.title = "pippo";
IndexView.__super__.render.call(this);
//this.el is the root element of Backbone.View. By default, it is a div.
//$el is cached jQuery object for the view's element.
//append the compiled template into view div container
this.$el.append(this.header.$el);
this.$el.append(this.template());
this.$el.append(this.footer.$el);
initialize: function (options) {
var self = this;
IndexView.__super__.initialize.call(this);
this.collection = options.collection;
this.collection.fetch({
success: function(data, textStatus, jqXHR){
self.render();
}
});
},
//render the content into div of view
render: function(){
//this.header.title = "pippo";
IndexView.__super__.render.call(this);
//this.el is the root element of Backbone.View. By default, it is a div.
//$el is cached jQuery object for the view's element.
//append the compiled template into view div container
this.$el.append(this.header.$el);
this.$el.append(this.template({data:this.collection.toJSON()}));
this.$el.append(this.footer.$el);
this.trigger("renderCompleted:Categories",this);
//return to enable chained calls
this.$el.find("#indexBtn").addClass("ui-btn-active");
return this;
}
});
return IndexView;
});
//return to enable chained calls
}
this.$el.find("#indexBtn").addClass("ui-btn-active");
return this;
}
});
return IndexView;
});
@@ -0,0 +1 @@
<li><a href="#category/<%=item.name%>/<%= item.category_id%>" class="ui-btn ui-btn-icon-right ui-icon-carat-r"><%= item.name %></a></li>
+12 -6
View File
@@ -1,9 +1,15 @@
<div id="categoryListContent" data-role="content">
<h1>Indice Ricette</h1>
<h1>Indice</h1>
<ul id="categoryList" data-role="listview" data-inset="true">
<% for (var i = 0; i < data.length; i++) { %>
<% var item = data[i]; %>
<li><a href="#category/<%=item.name%>/<%= item.category_id%>" class="ui-btn ui-btn-icon-right ui-icon-carat-r"><%= item.name %></a></li>
<% } %>
</ul>
<li><a href="#category/Dolci/3" class="ui-btn ui-btn-icon-right ui-icon-carat-r">Dolci</a></li>
<li><a href="#category/Esuberi/6" class="ui-btn ui-btn-icon-right ui-icon-carat-r">Esuberi</a></li>
<li><a href="#category/Focacce/4" class="ui-btn ui-btn-icon-right ui-icon-carat-r">Focacce</a></li>
<li><a href="#category/Grandi Lievitati/10" class="ui-btn ui-btn-icon-right ui-icon-carat-r">Grandi Lievitati</a></li>
<li><a href="#category/Pane/1" class="ui-btn ui-btn-icon-right ui-icon-carat-r">Pane</a></li>
<li><a href="#category/Panificati Vari/5" class="ui-btn ui-btn-icon-right ui-icon-carat-r">Panificati Vari</a></li>
<li><a href="#category/Pasquali/9" class="ui-btn ui-btn-icon-right ui-icon-carat-r">Pasquali</a></li>
<li><a href="#category/Pizza/2" class="ui-btn ui-btn-icon-right ui-icon-carat-r">Pizza</a></li>
<li><a href="#category/Senza Glutine/8" class="ui-btn ui-btn-icon-right ui-icon-carat-r">Senza Glutine</a></li>
<li><a href="#category/Vegane/7" class="ui-btn ui-btn-icon-right ui-icon-carat-r">Vegane</a></li>
</ul>
</div>