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

This commit is contained in:
2016-05-16 15:52:37 +00:00
parent 9e22467a0a
commit 13a350cf9a
4 changed files with 72 additions and 5 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
var myManifest = { var myManifest = {
Debug: (window.location.port !== ""), Debug: (window.location.port !== ""),
Name: "Il Management", Name: "Il Management",
Version: "0.3.3.0", Version: "0.4.0.0",
Author: "Denis Ironi", Author: "Denis Ironi",
Settings: { Settings: {
DefaultURL: (window.location.port === "" ? "http://" + window.location.host + "/Service": "http://" + window.location.hostname + ":" + window.location.port + "/Service_Manut"), DefaultURL: (window.location.port === "" ? "http://" + window.location.host + "/Service": "http://" + window.location.hostname + ":" + window.location.port + "/Service_Manut"),
+54 -2
View File
@@ -1,13 +1,16 @@
define(['jquery', 'underscore', 'backbone', 'text!modules/home/homeViewTemplate.html', 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/base/baseView', 'modules/ricette/ricette', 'modules/editricetta/editricetta', 'modules/photos/photos', 'modules/statistics/statistics',
'modules/editricetta/editricetta', 'text!modules/home/inputWindow.html',
'jqx'], 'jqx'],
function($, _, Backbone, homeViewTemplate, BaseView, RicetteView, EditRicettaView, PhotosView, StatisticsView) { function($, _, Backbone, homeViewTemplate, BaseView, RicetteView, EditRicettaView, PhotosView, StatisticsView, EditRicetta, inputWindowTemplate) {
var HomeView = BaseView.extend({ var HomeView = BaseView.extend({
ricetteView: null, ricetteView: null,
statiView: null, statiView: null,
editorRicetta: null,
//initialize template //initialize template
template: _.template(homeViewTemplate), template: _.template(homeViewTemplate),
templateInputWindow: _.template(inputWindowTemplate),
initialize: function() { initialize: function() {
HomeView.__super__.initialize.call(this); HomeView.__super__.initialize.call(this);
//this.header.title = "pippo"; //this.header.title = "pippo";
@@ -30,6 +33,29 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/home/homeViewTemplate.
else else
this.ricetteView.render(); this.ricetteView.render();
}, },
modifyByIDRicetta: function() {
var self = this;
//e.preventDefault();
if(this.editorRicetta == null)
{
this.editorRicetta = new EditRicetta();
this.editorRicetta.render();
$('body').append(this.editorRicetta.$el);
}
$('#openBtn').off('click');
$('#openBtn').on('click', function () {
$('#inputWindow').jqxWindow('close');
self.editorRicetta.openRicetta($('#ricettaId').val());
});
$('#cancelButton').off('click');
$('#cancelButton').on('click', function () {
$('#inputWindow').jqxWindow('close');
});
$('#ricettaId').val("");
$('#inputWindow').jqxWindow('open');
$('#ricettaId').focus();
},
photosView: function(){ photosView: function(){
var photosView = new PhotosView(); var photosView = new PhotosView();
photosView.render(); photosView.render();
@@ -58,6 +84,11 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/home/homeViewTemplate.
{ {
event.data.scope.modifyRicetta(); event.data.scope.modifyRicetta();
} }
else if(item[0].id === "modifyByIDRicetta" ||
item[0].lastChild.id === "modifyByIDRicetta")
{
event.data.scope.modifyByIDRicetta();
}
else if(item[0].id === "viewPhotos" || else if(item[0].id === "viewPhotos" ||
item[0].lastChild.id === "viewPhotos") item[0].lastChild.id === "viewPhotos")
{ {
@@ -73,10 +104,11 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/home/homeViewTemplate.
render: function() { render: function() {
//this.header.title = "pippo"; //this.header.title = "pippo";
HomeView.__super__.render.call(this); HomeView.__super__.render.call(this);
var self = this;
if ($('#jqxMenu').length === 0) if ($('#jqxMenu').length === 0)
{ {
this.$el.append(this.template()); this.$el.append(this.template());
this.$el.append(this.templateInputWindow());
this.$el.find("#jqxMenu").jqxMenu({ this.$el.find("#jqxMenu").jqxMenu({
width: '60%', width: '60%',
@@ -84,6 +116,26 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/home/homeViewTemplate.
}); });
this.$el.find('#jqxMenu').on('itemclick', { scope: this }, this.clickMenu); this.$el.find('#jqxMenu').on('itemclick', { scope: this }, this.clickMenu);
var offset = this.$el.offset();
this.$el.find('#inputWindow').jqxWindow({ width: 400,
height: 110, resizable: false,
cancelButton: $('#cancelButton'),
okButton: $('#openBtn'),
autoOpen: false,
position: { x: offset.left + 50, y: offset.top + 50},
initContent: function () {
$('#openBtn').jqxButton({ width: '80px' });
$('#cancelButton').jqxButton({ width: '80px' });
}
});
$('#inputWindow').keypress(function(e){
if ( e.which == 13 ) {
e.preventDefault();
$('#openBtn').trigger('click');
}
});
} }
//$("#homeBtn").addClass("ui-btn-active"); //$("#homeBtn").addClass("ui-btn-active");
+2 -1
View File
@@ -3,8 +3,9 @@
<ul> <ul>
<li>Gestione Ricette <li>Gestione Ricette
<ul style='width: 250px;'> <ul style='width: 250px;'>
<li><a id="modifyRicetta" href="#">Lista</a></li>
<li><a id="addRicetta" href="#">Aggiungi</a></li> <li><a id="addRicetta" href="#">Aggiungi</a></li>
<li><a id="modifyRicetta" href="#">Modifica</a></li> <li><a id="modifyByIDRicetta" href="#">Modifica per ID</a></li>
</ul> </ul>
</li> </li>
<!-- <!--
+14
View File
@@ -0,0 +1,14 @@
<div id="inputWindow">
<div id="customWindowHeader">
<span id="captureContainer" style="float: left">Inserire ID Ricetta</span>
</div>
<div id="customWindowContent" style="overflow: hidden">
<div style="margin: 10px">
ID Ricetta:
<input type="text" style="width: 175px; border: 1px solid #aaa" id="ricettaId" />
<div style="float: right">
<input type="button" value="Open" style="margin-bottom: 5px;" id="openBtn" /><br />
<input type="button" value="Cancel" id="cancelButton" />
</div>
</div>
</div>