git-svn-id: https://msi/svn/firstRepo/Management/trunk@8 0f545695-f87b-41b6-9a03-7f16563b5454
This commit is contained in:
@@ -0,0 +1,73 @@
|
||||
define(['jquery', 'underscore', 'backbone', 'text!modules/home/homeViewTemplate.html',
|
||||
'modules/base/baseView', 'modules/ricette/ricette', 'modules/editricetta/editricetta', 'modules/photos/photos',
|
||||
'jqxbuttons', 'jqxmenu', 'jqxwindow'],
|
||||
function($, _, Backbone, homeViewTemplate, BaseView, RicetteView, EditRicettaView, PhotosView) {
|
||||
|
||||
var HomeView = BaseView.extend({
|
||||
//initialize template
|
||||
template: _.template(homeViewTemplate),
|
||||
initialize: function() {
|
||||
HomeView.__super__.initialize.call(this);
|
||||
//this.header.title = "pippo";
|
||||
},
|
||||
addRicetta: function() {
|
||||
//e.preventDefault();
|
||||
var editRicetteView = new EditRicettaView();
|
||||
editRicetteView.render();
|
||||
$('body').append(editRicetteView.$el);
|
||||
editRicetteView.openRicetta();
|
||||
},
|
||||
modifyRicetta: function() {
|
||||
//e.preventDefault();
|
||||
var ricetteView = new RicetteView();
|
||||
ricetteView.render();
|
||||
$('body').append(ricetteView.$el);
|
||||
},
|
||||
photosView: function(){
|
||||
var photosView = new PhotosView();
|
||||
photosView.render();
|
||||
$('body').append(photosView.$el);
|
||||
},
|
||||
clickMenu: function(event) {
|
||||
var item = $(event.target);
|
||||
//var clickedItem = event.args;
|
||||
if(item[0].id === "addRicetta" ||
|
||||
item[0].lastChild.id === "addRicetta")
|
||||
{
|
||||
event.data.scope.addRicetta();
|
||||
}
|
||||
else if(item[0].id === "modifyRicetta" ||
|
||||
item[0].lastChild.id === "modifyRicetta")
|
||||
{
|
||||
event.data.scope.modifyRicetta();
|
||||
}
|
||||
else if(item[0].id === "viewPhotos" ||
|
||||
item[0].lastChild.id === "viewPhotos")
|
||||
{
|
||||
event.data.scope.photosView();
|
||||
}
|
||||
},
|
||||
//render the content into div of view
|
||||
render: function() {
|
||||
//this.header.title = "pippo";
|
||||
HomeView.__super__.render.call(this);
|
||||
|
||||
if ($('#jqxMenu').length === 0)
|
||||
{
|
||||
this.$el.append(this.template());
|
||||
|
||||
this.$el.find("#jqxMenu").jqxMenu({
|
||||
width: '60%',
|
||||
height: '30px'
|
||||
});
|
||||
|
||||
this.$el.find('#jqxMenu').on('itemclick', { scope: this }, this.clickMenu);
|
||||
}
|
||||
|
||||
//$("#homeBtn").addClass("ui-btn-active");
|
||||
//return to enable chained calls
|
||||
return this;
|
||||
}
|
||||
});
|
||||
return HomeView;
|
||||
});
|
||||
@@ -0,0 +1,31 @@
|
||||
<div id="contentMenu">
|
||||
<div id='jqxMenu'>
|
||||
<ul>
|
||||
<li>Gestione Ricette
|
||||
<ul style='width: 250px;'>
|
||||
<li><a id="addRicetta" href="#">Aggiungi</a></li>
|
||||
<li><a id="modifyRicetta" href="#">Modifica</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<!--
|
||||
<li>Ingredienti
|
||||
<ul style='width: 250px;'>
|
||||
<li><a id="addIngredienti" href="#">Aggiungi</a></li>
|
||||
<li><a id="modifyIngredienti" href="#">Modifica</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Gestione Foto
|
||||
<ul style='width: 250px;'>
|
||||
<li><a id="viewPhotos" href="#">Visualizza</a></li>
|
||||
<!--<li><a id="publishPhoto" href="#">Approva</a></li>
|
||||
<li><a id="deletePhoto" href="#">Cancella</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Gestione Profili
|
||||
<ul style='width: 250px;'>
|
||||
<li><a id="viewProfiles" href="#">Visualizza</a></li>
|
||||
</ul>
|
||||
</li>-->
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user