git-svn-id: https://msi/svn/firstRepo/Management/trunk@49 0f545695-f87b-41b6-9a03-7f16563b5454
This commit is contained in:
@@ -7,6 +7,7 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/editricetta/editricett
|
||||
//initialize template
|
||||
template: _.template(editricettaViewTemplate),
|
||||
addIngrDlg: null,
|
||||
fullScrDlg: null,
|
||||
initialize: function() {
|
||||
EditRicetteView.__super__.initialize.call(this);
|
||||
//this.header.title = "pippo";
|
||||
@@ -36,6 +37,26 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/editricetta/editricett
|
||||
|
||||
$("#listbox").jqxListBox({source: ricetta.ingredienti, itemHeight: 30, height: '90%', width: '100%', theme: 'arctic'});
|
||||
|
||||
var photoFields = [
|
||||
{name: 'id_photo', type: 'int'},
|
||||
{name: 'type_format', type: 'string'},
|
||||
{name: 'from_profile_id', type: 'string'},
|
||||
{name: 'uploaded_date', type: 'datetime'},
|
||||
{name: 'profile_name', type: 'string'},
|
||||
{name: 'published', type: 'bool'}
|
||||
];
|
||||
var photoAdapter = new $.jqx.dataAdapter({
|
||||
datatype: "jsonp",
|
||||
datafields: photoFields,
|
||||
id: 'id_photo',
|
||||
url: myManifest.Settings.DefaultURL + "/backend/ricetta/" + ricetta_id + "/photos",
|
||||
data: {
|
||||
}
|
||||
});
|
||||
|
||||
$("#gridPhotos").jqxGrid({
|
||||
source: photoAdapter});
|
||||
|
||||
// show the popup window.
|
||||
$("#popupWindow").jqxWindow('open');
|
||||
});
|
||||
@@ -80,6 +101,31 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/editricetta/editricett
|
||||
cancelButton: this.$el.find("#Cancel"),
|
||||
modalOpacity: 0.01,
|
||||
initContent: function() {
|
||||
$('#listbox').jqxListBox({
|
||||
renderer: function(index, label, value) {
|
||||
var datarecord = this.source[index];
|
||||
if (datarecord)
|
||||
{
|
||||
datarecord.note = unescape(datarecord.note);
|
||||
var div = '';
|
||||
if (datarecord.id_tipo_ingredienti === "22")
|
||||
{
|
||||
div = '<div><b>' + datarecord.nome_ingrediente + '</b>: <i>' + datarecord.note + '</i></div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
div = '<div><b>' + datarecord.nome_ingrediente + '</b>: ' + datarecord.quantita + ' ' + datarecord.unita + ' <i>' + datarecord.note + '</i></div>';
|
||||
}
|
||||
return div;
|
||||
}
|
||||
return "";
|
||||
},
|
||||
dragEnd: function(dragItem, dropItem) {
|
||||
this.source.move(dragItem.index, dropItem.index);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
$('#jqxTabs').jqxTabs({
|
||||
width: '100%',
|
||||
height: "90%",
|
||||
@@ -223,29 +269,7 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/editricetta/editricett
|
||||
|
||||
$('#listbox').jqxListBox({
|
||||
//allowDrag: true,
|
||||
source: dataAdapter, itemHeight: 30, height: '90%', width: '100%', theme: 'arctic',
|
||||
renderer: function(index, label, value) {
|
||||
var datarecord = this.source[index];
|
||||
if (datarecord)
|
||||
{
|
||||
datarecord.note = unescape(datarecord.note);
|
||||
var div = '';
|
||||
if (datarecord.id_tipo_ingredienti === "22")
|
||||
{
|
||||
div = '<div><b>' + datarecord.nome_ingrediente + '</b>: <i>' + datarecord.note + '</i></div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
div = '<div><b>' + datarecord.nome_ingrediente + '</b>: ' + datarecord.quantita + ' ' + datarecord.unita + ' <i>' + datarecord.note + '</i></div>';
|
||||
}
|
||||
return div;
|
||||
}
|
||||
return "";
|
||||
},
|
||||
dragEnd: function(dragItem, dropItem) {
|
||||
this.source.move(dragItem.index, dropItem.index);
|
||||
return true;
|
||||
}
|
||||
source: dataAdapter, itemHeight: 30, height: '90%', width: '100%', theme: 'arctic'
|
||||
});
|
||||
|
||||
$('#listbox').on('select', function(event) {
|
||||
@@ -285,6 +309,117 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/editricetta/editricett
|
||||
if (text)
|
||||
$('#procedimento').jqxEditor('val', text);
|
||||
}
|
||||
else if (tab === 3)
|
||||
{
|
||||
var source =
|
||||
{
|
||||
datatype: "jsonp",
|
||||
datafields: [
|
||||
{name: 'id'},
|
||||
{name: 'name'}
|
||||
],
|
||||
url: myManifest.Settings.DefaultURL + "/backend/profiles",
|
||||
data: {
|
||||
}
|
||||
};
|
||||
var dataAdapter = new $.jqx.dataAdapter(source);
|
||||
$("#autorePhoto").jqxDropDownList(
|
||||
{
|
||||
width: "250px",
|
||||
height: "25px",
|
||||
source: dataAdapter,
|
||||
//selectedIndex: -1,
|
||||
displayMember: "name",
|
||||
valueMember: "id"
|
||||
});
|
||||
$('#jqxFileUpload').jqxFileUpload({ width: '50%',
|
||||
fileInputName: 'image',
|
||||
multipleFilesUpload: false,
|
||||
accept: 'image/*',
|
||||
uploadUrl: myManifest.Settings.DefaultURL + '/backend/photos' });
|
||||
|
||||
$('#jqxFileUpload').on('uploadStart', function (event) {
|
||||
var profileID = "10203753344023406";
|
||||
|
||||
if($("#autorePhoto").val() != 0)
|
||||
profileID = $("#autorePhoto").val();
|
||||
|
||||
$('form[action="' + myManifest.Settings.DefaultURL + '/backend/photos' + '"]').
|
||||
append('<input type="hidden" name="ricetta_id" value="' + self.ricettaEditing.ricetta_id +'" />').
|
||||
append('<input type="hidden" name="keyStore" value="' + profileID + '" />');
|
||||
});
|
||||
$('#jqxFileUpload').on('uploadEnd', function (event) {
|
||||
$("#gridPhotos").jqxGrid('updatebounddata');
|
||||
});
|
||||
$("#gridPhotos").jqxGrid({
|
||||
width: "100%",
|
||||
height: "100%",
|
||||
//source: photoAdapter,
|
||||
rowsheight: 100,
|
||||
//filterable: true,
|
||||
autoshowfiltericon: true,
|
||||
columns: [
|
||||
{text: 'Autore', dataField: 'profile_name', width: "170px"},
|
||||
{text: 'Image', dataField: 'image', height: "100px",
|
||||
cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
|
||||
return '<center><img style="margin-left: 5px;height: 100px;" src="' + myManifest.Settings.DefaultURL + '/api/photos/thumbnail/' + rowdata.id_photo + '"/></center>';
|
||||
}
|
||||
},
|
||||
{text: 'Published', editable: false, dataField: 'published', width: "70px",
|
||||
cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
|
||||
var valueBool = rowdata.published;
|
||||
return "<div style='margin: 4px;' class='jqx-center-align'>" + valueBool + "</div>";
|
||||
}
|
||||
},
|
||||
{text: '', datafield: 'FullView', columntype: 'button', width: '10%',
|
||||
cellsrenderer: function() {
|
||||
return "View Full";
|
||||
},
|
||||
buttonclick: function(row) {
|
||||
var items = $("#gridPhotos").jqxGrid('source');
|
||||
var item = items.records[row];
|
||||
self.fullScrDlg.$el.find('#imgFullScr').attr('src', myManifest.Settings.DefaultURL + '/api/photos/' + item.id_photo);
|
||||
self.fullScrDlg.open();
|
||||
}
|
||||
},
|
||||
{text: '', datafield: 'Pubblica', columntype: 'button', width: '10%',
|
||||
cellsrenderer: function() {
|
||||
return "Pubblica";
|
||||
},
|
||||
buttonclick: function(row) {
|
||||
var items = $("#gridPhotos").jqxGrid('source');
|
||||
var item = items.records[row];
|
||||
if(item.published === false)
|
||||
{
|
||||
$.ajax({
|
||||
url: myManifest.Settings.DefaultURL + "/backend/photo/publish/" + item.id_photo,
|
||||
//dataType: "json",
|
||||
type: 'GET'
|
||||
}).then(function (response) {
|
||||
$("#gridPhotos").jqxGrid('updatebounddata');
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
{text: '', datafield: 'Cancella', columntype: 'button', width: '10%',
|
||||
cellsrenderer: function() {
|
||||
return "Cancella";
|
||||
},
|
||||
buttonclick: function(row) {
|
||||
var items = $("#gridPhotos").jqxGrid('source');
|
||||
var item = items.records[row];
|
||||
$.ajax({
|
||||
url: myManifest.Settings.DefaultURL + "/backend/photo/" + item.id_photo,
|
||||
//dataType: "json",
|
||||
type: 'DELETE'
|
||||
}).then(function (response) {
|
||||
$("#gridPhotos").jqxGrid('updatebounddata');
|
||||
});
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -337,12 +472,25 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/editricetta/editricett
|
||||
$("#Cancel").jqxButton({width: '48%', height: 40});
|
||||
}
|
||||
});
|
||||
//
|
||||
// $('#popupWindow').on('resized', function (event) {
|
||||
// $('#procedimento').jqxEditor({width: '100%', height: 380});
|
||||
// });
|
||||
|
||||
|
||||
this.fullScrDlg = new Window({
|
||||
title: "Foto Full Screen",
|
||||
width: "600px",
|
||||
height: "600px",
|
||||
margin_top: "50px",
|
||||
id: "fullScrDlg",
|
||||
showCloseButton: true,
|
||||
resizable: true,
|
||||
isModal: true,
|
||||
autoOpen: false,
|
||||
content: "<img id='imgFullScr' style='margin-left: 5px;width: 565px;' src='' />",
|
||||
initContentFn: null
|
||||
});
|
||||
|
||||
self.$el.find("#content").append(this.fullScrDlg.$el);
|
||||
this.fullScrDlg.render();
|
||||
|
||||
this.addIngrDlg = new AddIngrDlg();
|
||||
this.$el.find("#content").append(this.addIngrDlg.$el);
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
<li style="margin-left: 30px;">Informazioni Generali</li>
|
||||
<li>Ingredienti</li>
|
||||
<li>Procedimento</li>
|
||||
<li>Foto</li>
|
||||
</ul>
|
||||
<div>
|
||||
<table>
|
||||
@@ -47,8 +48,15 @@
|
||||
<div style="border: none;" id="listbox"></div>
|
||||
</div>
|
||||
<div><textarea id="procedimento"></textarea></div>
|
||||
<div>Autore Foto: <div id="autorePhoto"></div><div id="jqxFileUpload"></div><div id="gridPhotos"></div></div>
|
||||
</div>
|
||||
<input style="margin-right: 5px;" type="button" id="Save" value="Save" /><input id="Cancel" type="button" value="Cancel" />
|
||||
<div id="fullScreenWindow" style="overflow: hidden; display: none;">
|
||||
<div>Foto Full Screen</div>
|
||||
<div>
|
||||
<img id="imgFullScr" style="margin-left: 5px;width: 200px;" src=""/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
+27
-5
@@ -1,9 +1,11 @@
|
||||
define(['jquery', 'underscore', 'backbone', 'text!modules/home/homeViewTemplate.html',
|
||||
'modules/base/baseView', 'modules/ricette/ricette', 'modules/editricetta/editricetta', 'modules/photos/photos',
|
||||
'modules/base/baseView', 'modules/ricette/ricette', 'modules/editricetta/editricetta', 'modules/photos/photos', 'modules/statistics/statistics',
|
||||
'jqx'],
|
||||
function($, _, Backbone, homeViewTemplate, BaseView, RicetteView, EditRicettaView, PhotosView) {
|
||||
function($, _, Backbone, homeViewTemplate, BaseView, RicetteView, EditRicettaView, PhotosView, StatisticsView) {
|
||||
|
||||
var HomeView = BaseView.extend({
|
||||
ricetteView: null,
|
||||
statiView: null,
|
||||
//initialize template
|
||||
template: _.template(homeViewTemplate),
|
||||
initialize: function() {
|
||||
@@ -19,15 +21,30 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/home/homeViewTemplate.
|
||||
},
|
||||
modifyRicetta: function() {
|
||||
//e.preventDefault();
|
||||
var ricetteView = new RicetteView();
|
||||
ricetteView.render();
|
||||
$('body').append(ricetteView.$el);
|
||||
if(this.ricetteView == null)
|
||||
{
|
||||
this.ricetteView = new RicetteView();
|
||||
this.ricetteView.render();
|
||||
$('body').append(this.ricetteView.$el);
|
||||
}
|
||||
else
|
||||
this.ricetteView.render();
|
||||
},
|
||||
photosView: function(){
|
||||
var photosView = new PhotosView();
|
||||
photosView.render();
|
||||
$('body').append(photosView.$el);
|
||||
},
|
||||
statisticsView: function(){
|
||||
if(this.statiView == null)
|
||||
{
|
||||
this.statiView = new StatisticsView();
|
||||
this.statiView.render();
|
||||
$('body').append(this.statiView.$el);
|
||||
}
|
||||
else
|
||||
this.statiView.render();
|
||||
},
|
||||
clickMenu: function(event) {
|
||||
var item = $(event.target);
|
||||
//var clickedItem = event.args;
|
||||
@@ -46,6 +63,11 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/home/homeViewTemplate.
|
||||
{
|
||||
event.data.scope.photosView();
|
||||
}
|
||||
else if(item[0].id === "viewStatistics" ||
|
||||
item[0].lastChild.id === "viewStatistics")
|
||||
{
|
||||
event.data.scope.statisticsView();
|
||||
}
|
||||
},
|
||||
//render the content into div of view
|
||||
render: function() {
|
||||
|
||||
@@ -13,19 +13,19 @@
|
||||
<li><a id="addIngredienti" href="#">Aggiungi</a></li>
|
||||
<li><a id="modifyIngredienti" href="#">Modifica</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</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="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>
|
||||
<li><a id="viewStatistics" href="#">Statistiche</a></li>
|
||||
</ul>
|
||||
</li>-->
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
@@ -49,7 +49,11 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/photos/photosViewTempl
|
||||
filterable: true,
|
||||
autoshowfiltericon: true,
|
||||
columns: [
|
||||
{text: 'Titolo', dataField: 'titolo', width: "400px"},
|
||||
{text: 'Titolo', dataField: 'titolo', width: "400px",
|
||||
cellsrenderer: function(row, columnfield, value, defaulthtml, columnproperties) {
|
||||
return "<div style='overflow: hidden; text-overflow: ellipsis; padding-bottom: 2px; text-align: left; margin-right: 2px; margin-left: 4px; margin-top: 4px;'>" + unescape(value ) + "</div>";
|
||||
}
|
||||
},
|
||||
{text: 'Inviate', dataField: 'num_img', width: "65px"},
|
||||
{text: 'All Published', editable: false, dataField: 'all_published', width: "70px",
|
||||
cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
|
||||
|
||||
+107
-101
@@ -6,7 +6,7 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/ricette/ricetteViewTem
|
||||
dataAdapter: undefined,
|
||||
//initialize template
|
||||
template: _.template(ricetteViewTemplate),
|
||||
|
||||
window:null,
|
||||
editorRicetta: null,
|
||||
|
||||
initialize: function() {
|
||||
@@ -19,7 +19,7 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/ricette/ricetteViewTem
|
||||
if (event.args) {
|
||||
var item = event.args.item;
|
||||
if (item) {
|
||||
self.dataAdapter._source.url = myManifest.Settings.DefaultURL + "/backend/categoryitems/" + item.value;
|
||||
self.dataAdapter._source.url = myManifest.Settings.DefaultURL + "/backend/ricette/" + item.value;
|
||||
self.dataAdapter.dataBind();
|
||||
$("#jqxgrid").jqxGrid('updatebounddata');
|
||||
}
|
||||
@@ -35,112 +35,118 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/ricette/ricetteViewTem
|
||||
//this.header.title = "pippo";
|
||||
RicetteView.__super__.render.call(this);
|
||||
var self = this;
|
||||
var window = new Window({
|
||||
title: "Ricette",
|
||||
width: "850px",
|
||||
resizable: true,
|
||||
height: "510px",
|
||||
maxHeight: 1000,
|
||||
maxWidth: 1000,
|
||||
content: "<p><div id=\"categoriaCmb\"></div></p>\n\
|
||||
<p><div id=\"jqxgrid\"></div></p>",
|
||||
initContentFn: function() {
|
||||
var source =
|
||||
{
|
||||
datatype: "jsonp",
|
||||
datafields: [
|
||||
{name: 'category_id'},
|
||||
{name: 'name'}
|
||||
],
|
||||
url: myManifest.Settings.DefaultURL + "/backend/categories",
|
||||
data: {
|
||||
}
|
||||
};
|
||||
var dataAdapter = new $.jqx.dataAdapter(source);
|
||||
$("#categoriaCmb").jqxDropDownList(
|
||||
{
|
||||
width: 200,
|
||||
height: 25,
|
||||
source: dataAdapter,
|
||||
selectedIndex: 0,
|
||||
displayMember: "name",
|
||||
valueMember: "category_id"
|
||||
});
|
||||
|
||||
$("#categoriaCmb").on('select', {scope: self}, self.fillGrid);
|
||||
if(self.window === null)
|
||||
{
|
||||
self.window = new Window({
|
||||
id: "ricette",
|
||||
title: "Ricette",
|
||||
width: "850px",
|
||||
resizable: true,
|
||||
height: "510px",
|
||||
maxHeight: 1000,
|
||||
maxWidth: 1000,
|
||||
content: "<p><div id=\"categoriaCmb\"></div></p>\n\
|
||||
<p><div id=\"jqxgrid\"></div></p>",
|
||||
initContentFn: function() {
|
||||
var source =
|
||||
{
|
||||
datatype: "jsonp",
|
||||
datafields: [
|
||||
{name: 'category_id'},
|
||||
{name: 'name'}
|
||||
],
|
||||
url: myManifest.Settings.DefaultURL + "/backend/categories",
|
||||
data: {
|
||||
}
|
||||
};
|
||||
var dataAdapter = new $.jqx.dataAdapter(source);
|
||||
$("#categoriaCmb").jqxDropDownList(
|
||||
{
|
||||
width: 200,
|
||||
height: 25,
|
||||
source: dataAdapter,
|
||||
selectedIndex: 0,
|
||||
displayMember: "name",
|
||||
valueMember: "category_id"
|
||||
});
|
||||
|
||||
// prepare the data
|
||||
self.dataAdapter = new $.jqx.dataAdapter({
|
||||
datatype: "jsonp",
|
||||
datafields: [
|
||||
{name: 'ricetta_id', type: 'int'},
|
||||
{name: 'titolo', type: 'string'},
|
||||
{name: 'autore', type: 'string'}
|
||||
],
|
||||
id: 'ricetta_id',
|
||||
url: myManifest.Settings.DefaultURL + "/backend/categoryitems/0"
|
||||
});
|
||||
$("#jqxgrid").jqxGrid({
|
||||
width: "100%",
|
||||
height: "87%",
|
||||
source: self.dataAdapter,
|
||||
filterable: true,
|
||||
autoshowfiltericon: true,
|
||||
columns: [
|
||||
{text: 'Titolo', dataField: 'titolo', width: "50%",
|
||||
cellsrenderer: function(row, columnfield, value, defaulthtml, columnproperties) {
|
||||
return "<div style='overflow: hidden; text-overflow: ellipsis; padding-bottom: 2px; text-align: left; margin-right: 2px; margin-left: 4px; margin-top: 4px;'>" + unescape(value ) + "</div>";
|
||||
}
|
||||
},
|
||||
{text: 'Autore', dataField: 'autore', width: "30%",
|
||||
cellsrenderer: function(row, columnfield, value, defaulthtml, columnproperties) {
|
||||
return "<div style='overflow: hidden; text-overflow: ellipsis; padding-bottom: 2px; text-align: left; margin-right: 2px; margin-left: 4px; margin-top: 4px;'>" + unescape(value ) + "</div>";
|
||||
}
|
||||
},
|
||||
{text: '', datafield: 'Edit', columntype: 'button', width: '10%',
|
||||
cellsrenderer: function() {
|
||||
return "Modifica";
|
||||
$("#categoriaCmb").on('select', {scope: self}, self.fillGrid);
|
||||
|
||||
// prepare the data
|
||||
self.dataAdapter = new $.jqx.dataAdapter({
|
||||
datatype: "jsonp",
|
||||
datafields: [
|
||||
{name: 'ricetta_id', type: 'int'},
|
||||
{name: 'titolo', type: 'string'},
|
||||
{name: 'autore', type: 'string'}
|
||||
],
|
||||
id: 'ricetta_id',
|
||||
url: myManifest.Settings.DefaultURL + "/backend/ricette/3"
|
||||
});
|
||||
$("#jqxgrid").jqxGrid({
|
||||
width: "100%",
|
||||
height: "87%",
|
||||
source: self.dataAdapter,
|
||||
filterable: true,
|
||||
autoshowfiltericon: true,
|
||||
columns: [
|
||||
{text: 'Titolo', dataField: 'titolo', width: "50%",
|
||||
cellsrenderer: function(row, columnfield, value, defaulthtml, columnproperties) {
|
||||
return "<div style='overflow: hidden; text-overflow: ellipsis; padding-bottom: 2px; text-align: left; margin-right: 2px; margin-left: 4px; margin-top: 4px;'>" + unescape(value ) + "</div>";
|
||||
}
|
||||
},
|
||||
buttonclick: function(row) {
|
||||
self.openRicetta(row);
|
||||
}
|
||||
},
|
||||
{text: '', datafield: 'Del', columntype: 'button', width: '10%',
|
||||
cellsrenderer: function() {
|
||||
return "Elimina";
|
||||
{text: 'Autore', dataField: 'autore', width: "30%",
|
||||
cellsrenderer: function(row, columnfield, value, defaulthtml, columnproperties) {
|
||||
return "<div style='overflow: hidden; text-overflow: ellipsis; padding-bottom: 2px; text-align: left; margin-right: 2px; margin-left: 4px; margin-top: 4px;'>" + unescape(value ) + "</div>";
|
||||
}
|
||||
},
|
||||
buttonclick: function(row) {
|
||||
$.ajax({
|
||||
url: myManifest.Settings.DefaultURL + "/backend/ricetta/" + row.id,
|
||||
//dataType: "json",
|
||||
type: 'DELETE'
|
||||
}).then(function (response) {
|
||||
var msg = response;
|
||||
alert(msg.message);
|
||||
});
|
||||
{text: '', datafield: 'Edit', columntype: 'button', width: '10%', filterable: false, sortable: false, menu: false,
|
||||
cellsrenderer: function() {
|
||||
return "Modifica";
|
||||
},
|
||||
buttonclick: function(row) {
|
||||
self.openRicetta(row);
|
||||
}
|
||||
},
|
||||
{text: '', datafield: 'Del', columntype: 'button', width: '10%', filterable: false, sortable: false, menu: false,
|
||||
cellsrenderer: function() {
|
||||
return "Elimina";
|
||||
},
|
||||
buttonclick: function(row) {
|
||||
$.ajax({
|
||||
url: myManifest.Settings.DefaultURL + "/backend/ricetta/" + row.id,
|
||||
//dataType: "json",
|
||||
type: 'DELETE'
|
||||
}).then(function (response) {
|
||||
var msg = response;
|
||||
alert(msg.message);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
]
|
||||
});
|
||||
|
||||
$('#jqxgrid').on('rowdoubleclick', function(event)
|
||||
{
|
||||
var args = event.args;
|
||||
var row = args.rowindex;
|
||||
self.openRicetta(row);
|
||||
});
|
||||
}
|
||||
});
|
||||
window.id = "ricette";
|
||||
$('#jqxgrid').on('rowdoubleclick', function(event)
|
||||
{
|
||||
var args = event.args;
|
||||
var row = args.rowindex;
|
||||
self.openRicetta(row);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
this.$el.append(this.template());
|
||||
this.$el.find("#content").append(window.$el);
|
||||
window.render();
|
||||
|
||||
this.editorRicetta = new EditRicetta();
|
||||
this.$el.find("#content").append(this.editorRicetta.$el);
|
||||
|
||||
this.editorRicetta.render();
|
||||
this.$el.append(this.template());
|
||||
this.$el.find("#content").append(self.window.$el);
|
||||
self.window.render();
|
||||
|
||||
this.editorRicetta = new EditRicetta();
|
||||
this.$el.find("#content").append(this.editorRicetta.$el);
|
||||
|
||||
this.editorRicetta.render();
|
||||
}
|
||||
else
|
||||
self.window.open();
|
||||
return this;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<div id='chartContainer1' style="width: 400px; height: 250px;">
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div id='chartContainer2' style="width: 400px; height: 250px;">
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<div id='chartContainer3' style="width: 400px; height: 250px;">
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<!-- <div id='chartContainer4' style="width: 400px; height: 250px;">
|
||||
</div>-->
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -0,0 +1,116 @@
|
||||
define(['jquery', 'underscore', 'backbone',
|
||||
'text!modules/statistics/statisticsViewTemplate.html',
|
||||
'text!modules/statistics/pieTabTemplate.html',
|
||||
'modules/base/baseView', 'controls/window/window', 'jqx'],
|
||||
function ($, _, Backbone, statisticsViewTemplate, pieTabTemplate, BaseView, Window) {
|
||||
|
||||
var StatisticsView = BaseView.extend({
|
||||
dataAdapter: undefined,
|
||||
//initialize template
|
||||
template: _.template(statisticsViewTemplate),
|
||||
editorRicetta: null,
|
||||
initialize: function () {
|
||||
StatisticsView.__super__.initialize.call(this);
|
||||
//this.header.title = "pippo";
|
||||
},
|
||||
//render the content into div of view
|
||||
render: function () {
|
||||
//this.header.title = "pippo";
|
||||
StatisticsView.__super__.render.call(this);
|
||||
var self = this;
|
||||
var chartSettings = {
|
||||
// source: new $.jqx.dataAdapter({
|
||||
// datatype: "jsonp",
|
||||
// datafields: [
|
||||
// {name: 'CountSerie', type: 'int'},
|
||||
// {name: 'Serie', type: 'string'}
|
||||
// ],
|
||||
// url: myManifest.Settings.DefaultURL + "/backend/statistics/gender"
|
||||
// }),
|
||||
title: '',
|
||||
//description: "Genere",
|
||||
enableAnimations: false,
|
||||
showLegend: true,
|
||||
showBorderLine: true,
|
||||
padding: {left: 5, top: 5, right: 5, bottom: 5},
|
||||
titlePadding: {left: 0, top: 0, right: 0, bottom: 10},
|
||||
colorScheme: 'scheme03',
|
||||
seriesGroups: [
|
||||
{
|
||||
type: 'pie',
|
||||
showLegend: true,
|
||||
enableSeriesToggle: true,
|
||||
series:
|
||||
[
|
||||
{
|
||||
dataField: 'CountSerie',
|
||||
displayText: 'Serie',
|
||||
showLabels: true,
|
||||
labelRadius: 160,
|
||||
labelLinesEnabled: true,
|
||||
labelLinesAngles: true,
|
||||
labelsAutoRotate: false,
|
||||
initialAngle: 0,
|
||||
radius: 125,
|
||||
minAngle: 0,
|
||||
maxAngle: 180,
|
||||
centerOffset: 0,
|
||||
offsetY: 170
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
var window = new Window({
|
||||
title: "Statistiche",
|
||||
width: "850px",
|
||||
resizable: true,
|
||||
height: "510px",
|
||||
maxHeight: 1000,
|
||||
maxWidth: 1000,
|
||||
content: _.template(pieTabTemplate),
|
||||
initContentFn: function () {
|
||||
chartSettings.source = new $.jqx.dataAdapter({
|
||||
datatype: "jsonp",
|
||||
datafields: [
|
||||
{name: 'CountSerie', type: 'int'},
|
||||
{name: 'Serie', type: 'string'}
|
||||
],
|
||||
url: myManifest.Settings.DefaultURL + "/backend/statistics/gender"
|
||||
});
|
||||
chartSettings.title = "Genere";
|
||||
$("#chartContainer1").jqxChart(chartSettings);
|
||||
|
||||
chartSettings.source = new $.jqx.dataAdapter({
|
||||
datatype: "jsonp",
|
||||
datafields: [
|
||||
{name: 'CountSerie', type: 'int'},
|
||||
{name: 'Serie', type: 'string'}
|
||||
],
|
||||
url: myManifest.Settings.DefaultURL + "/backend/statistics/typeAccess"
|
||||
});
|
||||
chartSettings.title = "Tipo Accessi";
|
||||
$("#chartContainer2").jqxChart(chartSettings);
|
||||
|
||||
chartSettings.source = new $.jqx.dataAdapter({
|
||||
datatype: "jsonp",
|
||||
datafields: [
|
||||
{name: 'CountSerie', type: 'int'},
|
||||
{name: 'Serie', type: 'string'}
|
||||
],
|
||||
url: myManifest.Settings.DefaultURL + "/backend/statistics/themesUsage"
|
||||
});
|
||||
chartSettings.title = "Temi Usati";
|
||||
$("#chartContainer3").jqxChart(chartSettings);
|
||||
}
|
||||
});
|
||||
window.id = "statistics";
|
||||
|
||||
this.$el.append(this.template());
|
||||
this.$el.find("#content").append(window.$el);
|
||||
window.render();
|
||||
return this;
|
||||
}
|
||||
});
|
||||
return StatisticsView;
|
||||
});
|
||||
@@ -0,0 +1,2 @@
|
||||
<div id="content">
|
||||
</div>
|
||||
Reference in New Issue
Block a user