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
+72 -74
View File
@@ -1,82 +1,80 @@
define(['jquery', 'underscore', 'backbone','text!modules/note/noteViewTemplate.html', 'text!modules/note/noteItemTemplate.html', 'modules/base/baseView', 'classes/profile'],
function($, _, Backbone, noteViewTemplate, noteItemTemplate, BaseView, Profile){
define(['jquery', 'underscore', 'backbone', 'text!modules/note/noteViewTemplate.html', 'text!modules/note/noteItemTemplate.html', 'modules/base/baseView', 'classes/profile'],
function ($, _, Backbone, noteViewTemplate, noteItemTemplate, BaseView, Profile) {
var NoteView = BaseView.extend({
var NoteView = BaseView.extend({
collection: null,
//initialize template
template: _.template(noteViewTemplate),
itemtemplate: _.template(noteItemTemplate),
current_ricetta_id: null,
initialize: function (options) {
this.id = "NoteView";
var self = this;
NoteView.__super__.initialize.call(this);
this.collection = options.collection;
this.collection.fetch({success: function () {
self.renderItem();
}});
},
events: {
"click #deleteItem": "deleteItemClick",
"popupafterclose #popupMenu": "popupMenuPopupafterclose"
},
updateList: function () {
var $ul = this.$el.find('#allNote');
$ul.html('');
var items = this.itemtemplate({data: this.collection.toJSON()});
collection: null,
//initialize template
template:_.template(noteViewTemplate),
itemtemplate:_.template(noteItemTemplate),
current_ricetta_id: null,
$ul.html(items);
$ul.listview("refresh");
$ul.trigger("updatelayout");
},
renderItem: function () {
this.updateList();
initialize: function (options) {
var self = this;
NoteView.__super__.initialize.call(this);
this.collection = options.collection;
this.collection.fetch({ success: function(){ self.renderItem(); } });
},
events: {
"click #deleteItem": "deleteItemClick",
"popupafterclose #popupMenu": "popupMenuPopupafterclose"
},
updateList: function(){
var $ul = this.$el.find('#allNote');
var items = this.itemtemplate({data:this.collection.toJSON()});
$ul.html( items );
$ul.listview( "refresh" );
$ul.trigger( "updatelayout");
},
renderItem: function(){
this.updateList();
$.mobile.loading( 'hide' );
var self = this;
this.$el.find('.optionLink').on("click", function(e){
$.mobile.loading('hide');
var self = this;
this.$el.find('.optionLink').on("click", function (e) {
e.preventDefault();
self.current_ricetta_id = $(e.target.parentElement).find('#itemID').text();
self.$el.find('#popupMenu').popup("open");
});
},
deleteItemClick: function (e) {
e.preventDefault();
self.current_ricetta_id = $(e.target.parentElement).find('#itemID').text();
self.$el.find('#popupMenu').popup("open");
});
},
var self = this;
Profile.removeRicettaBloccoNote(this.current_ricetta_id, function (msg) {
var item = self.collection.get(self.current_ricetta_id);
deleteItemClick: function(e){
e.preventDefault();
var self = this;
Profile.removeRicettaBloccoNote(this.current_ricetta_id, function(msg) {
var item = self.collection.get(self.current_ricetta_id);
self.$el.find('#popupMenu').popup("close");
self.$el.find('#popupMenu').popup("close");
self.collection.remove(item);
self.updateList();
});
},
popupMenuPopupafterclose: function (event, ui) {
this.current_ricetta_id = null;
},
//render the content into div of view
render: function () {
if (this.created === true)
{
//this.header.title = "pippo";
NoteView.__super__.render.call(this);
self.collection.remove(item);
self.updateList();
});
},
var self = 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);
popupMenuPopupafterclose: function( event, ui ) {
this.current_ricetta_id = null;
},
//render the content into div of view
render: function(){
//this.header.title = "pippo";
NoteView.__super__.render.call(this);
var self = 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);
//return to enable chained calls
this.$el.find("#noteBtn").addClass("ui-btn-active");
return this;
}
});
return NoteView;
});
//return to enable chained calls
}
this.$el.find("#noteBtn").addClass("ui-btn-active");
return this;
}
});
return NoteView;
});