git-svn-id: https://msi/svn/firstRepo/Management/trunk@91 0f545695-f87b-41b6-9a03-7f16563b5454

This commit is contained in:
2017-03-09 17:09:09 +00:00
parent 13a350cf9a
commit 7c61c24e67
6 changed files with 580 additions and 4 deletions
+62 -4
View File
@@ -1,13 +1,19 @@
define(['jquery', 'underscore', 'backbone', 'text!modules/home/homeViewTemplate.html',
'modules/base/baseView', 'modules/ricette/ricette', 'modules/editricetta/editricetta', 'modules/photos/photos', 'modules/statistics/statistics',
'modules/editricetta/editricetta', 'text!modules/home/inputWindow.html',
define(['jquery', 'underscore', 'backbone', 'text!modules/home/homeViewTemplate.html', 'modules/base/baseView',
'modules/ricette/ricette', 'modules/editricetta/editricetta', 'modules/editricetta/editricetta',
'modules/mulini/mulini', 'modules/editmulino/editmulino', 'modules/editmulino/editmulino',
'modules/photos/photos', 'modules/statistics/statistics', 'text!modules/home/inputWindow.html',
'jqx'],
function($, _, Backbone, homeViewTemplate, BaseView, RicetteView, EditRicettaView, PhotosView, StatisticsView, EditRicetta, inputWindowTemplate) {
function($, _, Backbone, homeViewTemplate, BaseView,
RicetteView, EditRicettaView, EditRicetta,
MuliniView, EditMulinoView, EditMulino,
PhotosView, StatisticsView, inputWindowTemplate) {
var HomeView = BaseView.extend({
ricetteView: null,
muliniView: null,
statiView: null,
editorRicetta: null,
editorMulino: null,
//initialize template
template: _.template(homeViewTemplate),
templateInputWindow: _.template(inputWindowTemplate),
@@ -56,6 +62,43 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/home/homeViewTemplate.
$('#ricettaId').focus();
},
addMulino: function() {
var editMuliniView = new EditMulinoView();
editMuliniView.render();
$('body').append(editMuliniView.$el);
editMuliniView.openMulino();
},
modifyMulino: function() {
if(this.muliniView == null)
{
this.muliniView = new MuliniView();
this.muliniView.render();
$('body').append(this.muliniView.$el);
}
else
this.muliniView.render();
},
modifyByIDMulino: function() {
var self = this;
if(this.editorMulino == null)
{
this.editorMulino = new EditMulino();
this.editorMulino.render();
$('body').append(this.editorMulino.$el);
}
$('#openBtn').off('click');
$('#openBtn').on('click', function () {
$('#inputWindow').jqxWindow('close');
self.editorMulino.openMulino($('#mulinoId').val());
});
$('#cancelButton').off('click');
$('#cancelButton').on('click', function () {
$('#inputWindow').jqxWindow('close');
});
$('#mulinoId').val("");
$('#inputWindow').jqxWindow('open');
$('#mulinoId').focus();
},
photosView: function(){
var photosView = new PhotosView();
photosView.render();
@@ -89,6 +132,21 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/home/homeViewTemplate.
{
event.data.scope.modifyByIDRicetta();
}
else if(item[0].id === "addMulino" ||
item[0].lastChild.id === "addMulino")
{
event.data.scope.addMulino();
}
else if(item[0].id === "modifyMulino" ||
item[0].lastChild.id === "modifyMulino")
{
event.data.scope.modifyMulino();
}
else if(item[0].id === "modifyByIDMulino" ||
item[0].lastChild.id === "modifyByIDMulino")
{
event.data.scope.modifyByIDMulino();
}
else if(item[0].id === "viewPhotos" ||
item[0].lastChild.id === "viewPhotos")
{
+7
View File
@@ -8,6 +8,13 @@
<li><a id="modifyByIDRicetta" href="#">Modifica per ID</a></li>
</ul>
</li>
<li>Gestione Mulini
<ul style='width: 250px;'>
<li><a id="modifyMulino" href="#">Lista</a></li>
<li><a id="addMulino" href="#">Aggiungi</a></li>
<li><a id="modifyByIDMulino" href="#">Modifica per ID</a></li>
</ul>
</li>
<!--
<li>Ingredienti
<ul style='width: 250px;'>