
Le admin
Alessia, Elena e Francesca
hanno RIFONDATO IL GRUPPO!!
diff --git a/js/modules/item/item.js b/js/modules/item/item.js
index 39a92fe..241dfec 100644
--- a/js/modules/item/item.js
+++ b/js/modules/item/item.js
@@ -1,21 +1,18 @@
-define(['jquery', 'underscore', 'backbone','text!modules/item/itemViewTemplate.html', 'modules/base/baseView', 'classes/profile'],
- function($, _, Backbone, itemViewTemplate, BaseView, Profile){
+define(['jquery', 'underscore', 'backbone', 'text!modules/item/itemViewTemplate.html', 'modules/base/baseView', 'classes/profile'],
+ function($, _, Backbone, itemViewTemplate, BaseView, Profile) {
- var ItemView = BaseView.extend({
-
- collRicetta: null,
- collIngredienti: null,
-
- fetchedRicetta: false,
- fetchedIngredienti: false,
- //initialize template
- template:_.template(itemViewTemplate),
-
- initialize: function (options) {
- var self = this;
- ItemView.__super__.initialize.call(this);
- this.collRicetta = options.collRicetta;
- this.collIngredienti = options.collIngredienti;
+ var ItemView = BaseView.extend({
+ collRicetta: null,
+ collIngredienti: null,
+ fetchedRicetta: false,
+ fetchedIngredienti: false,
+ //initialize template
+ template: _.template(itemViewTemplate),
+ initialize: function(options) {
+ var self = this;
+ ItemView.__super__.initialize.call(this);
+ this.collRicetta = options.collRicetta;
+ this.collIngredienti = options.collIngredienti;
this.collRicetta.fetch({success: function() {
self.fetchedRicetta = true;
@@ -26,88 +23,160 @@ define(['jquery', 'underscore', 'backbone','text!modules/item/itemViewTemplate.h
self.render();
}});
},
-
- events: {
- "click #favoriteBtn": "favBtn",
- "click #backBtn": "backBtn"
- },
-
- backBtn:function(e){
- e.preventDefault();
- window.history.back();
- },
-
- favBtn:function(e){
- e.preventDefault();
- var self = this;
- var ric = this.collRicetta.toJSON()[0];
-
- if(!Profile.isConnected())
- {
- self.$el.find('#popupDialog').popup("open");
- return;
- }
-
- Profile.addRicettaBloccoNote(ric.ricetta_id,
- function(msg) {
- var favBtn = self.$el.find('#favoriteBtn');
- favBtn.addClass('ui-disabled');
- }
- );
- },
- //render the content into div of view
- render: function(){
- if(this.fetchedIngredienti && this.fetchedRicetta )
- {
- ItemView.__super__.render.call(this);
+ events: {
+ "click #favoriteBtn": "favBtn",
+ "click #optionBtn": "optionBtn",
+ "click #backBtn": "backBtn",
+ "click #scattaPhotoBtn": "scattaPhotoBtn",
+ "change #cameraFile": "cameraFileChanged",
+ "click #uploadPhotoBtn": "uploadPhotoBtn",
+ "change #galleyFile": "galleyFileChanged"
+ },
+ backBtn: function(e) {
+ e.preventDefault();
+ window.history.back();
+ },
+ optionBtn: function(e) {
+ e.preventDefault();
+ var self = this;
+ self.$el.find('#optionPopupDialog').popup("open");
+ },
+ scattaPhotoBtn: function(e) {
+ e.preventDefault();
var self = this;
- var ric = self.collRicetta.toJSON()[0];
+ if (!Profile.isConnected())
+ {
+ self.$el.find('#popupDialog').popup("open");
+ return;
+ }
- Profile.existRicettaBloccoNote(ric.ricetta_id,
- function(exist) {
- self.$el.append(self.template({
- ricetta: self.collRicetta.toJSON()[0],
- ingredienti: self.collIngredienti.toJSON()
- }));
+ $("#cameraFile").click();
+ },
+ uploadPhotoBtn: function(e) {
+ e.preventDefault();
+ var self = this;
- self.$arrayContent = self.$el.find('div[data-role="content"]');
- self.$arrayNavBar = self.$el.find('div[data-role="navbar"] a');
+ if (!Profile.isConnected())
+ {
+ self.$el.find('#popupDialog').popup("open");
+ return;
+ }
- var favBtn = self.$el.find('#favoriteBtn');
- if(exist > 0)
- favBtn.addClass('ui-disabled');
+ $("#galleyFile").click();
+ },
+ loadPhoto: function(objInputFile){
+ var self = this;
+ self.$el.find('#optionPopupDialog').popup("close");
+ $.mobile.loading( "show", {
+ text: "Caricamento immagine in corso...",
+ textVisible: true,
+ theme: "a",
+ textonly: false
+ });
+
+ var ric = this.collRicetta.toJSON()[0];
- self.$arrayNavBar.on("click", function(e){
- e.preventDefault();
- var index = jQuery.inArray( this , self.$arrayNavBar);
- self.goToContent(index);
- });
+ var data = new FormData();
+ data.append("ricetta_id", ric.ricetta_id);
+ data.append("image", objInputFile[0].files[0]);
+ data.append("keyStore", Profile.getKeySave());
- self.$arrayContent.on("swipeleft", function(e) {
- var index = jQuery.inArray(this, self.$arrayContent);
- self.goToContent(index + 1 );
- });
- self.$arrayContent.on("swiperight", function(e) {
- var index = jQuery.inArray(this, self.$arrayContent);
- self.goToContent(index - 1 );
- });
- self.trigger("renderCompleted:Item",self);
+ $.ajax({
+ url: myManifest.Settings.DefaultURL + "/api/photos",
+ cache: false,
+ contentType: false,
+ processData: false,
+ type: 'POST',
+ data: data,
+ success: function(msg) {
+ $.mobile.loading( "hide" );
+ alert("Immagine inviata con successo\n\nSarà cura degl'admin di validare la foto inviata");
+ objInputFile.val("");
}
+ });
+ },
+ galleyFileChanged: function(e) {
+ e.preventDefault();
+ this.loadPhoto($("#galleyFile"));
+ },
+ cameraFileChanged: function(e) {
+ e.preventDefault();
+ this.loadPhoto($("#cameraFile"));
+ },
+ favBtn: function(e) {
+ e.preventDefault();
+ var self = this;
+ var ric = this.collRicetta.toJSON()[0];
+
+ if (!Profile.isConnected())
+ {
+ self.$el.find('#popupDialog').popup("open");
+ return;
+ }
+
+ Profile.addRicettaBloccoNote(ric.ricetta_id,
+ function(msg) {
+ var favBtn = self.$el.find('#favoriteBtn');
+ favBtn.addClass('ui-disabled');
+ }
);
+ },
+ //render the content into div of view
+ render: function() {
+ if (this.fetchedIngredienti && this.fetchedRicetta)
+ {
+ ItemView.__super__.render.call(this);
+ var self = this;
+
+ var ric = self.collRicetta.toJSON()[0];
+
+ Profile.existRicettaBloccoNote(ric.ricetta_id,
+ function(exist) {
+ self.$el.append(self.template({
+ ricetta: self.collRicetta.toJSON()[0],
+ ingredienti: self.collIngredienti.toJSON()
+ }));
+
+ self.$arrayContent = self.$el.find('div[data-role="content"]');
+ self.$arrayNavBar = self.$el.find('div[data-role="navbar"] a');
+
+ var favBtn = self.$el.find('#favoriteBtn');
+ if (exist > 0)
+ favBtn.addClass('ui-disabled');
+
+ self.$arrayNavBar.on("click", function(e) {
+ e.preventDefault();
+ var index = jQuery.inArray(this, self.$arrayNavBar);
+ self.goToContent(index);
+ });
+
+ self.$arrayContent.on("swipeleft", function(e) {
+ var index = jQuery.inArray(this, self.$arrayContent);
+ self.goToContent(index + 1 );
+ });
+ self.$arrayContent.on("swiperight", function(e) {
+ var index = jQuery.inArray(this, self.$arrayContent);
+ self.goToContent(index - 1 );
+ });
+// self.$arrayContent.on("tap", function(e) {
+// self.optionBtn(e);
+// });
+ self.trigger("renderCompleted:Item", self);
+ }
+ );
- //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 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
- //return to enable chained calls
- return this;
- }
- },
-
- goToContent:function(newIndex)
+ //return to enable chained calls
+ return this;
+ }
+ },
+ goToContent: function(newIndex)
{
if(this.$arrayContent.length > newIndex && newIndex >= 0)
{
@@ -115,15 +184,14 @@ define(['jquery', 'underscore', 'backbone','text!modules/item/itemViewTemplate.h
this.switchContent();
}
},
-
- switchContent: function(){
- this.$arrayContent.hide();
- this.$arrayNavBar.removeClass('ui-btn-active');
- this.$arrayNavBar.removeClass('ui-state-persist');
- $(this.$arrayContent[this.indexContent]).show();
- $(this.$arrayNavBar[this.indexContent]).addClass('ui-btn-active');
- $(this.$arrayNavBar[this.indexContent]).addClass('ui-state-persist');
- }
- });
- return ItemView;
- });
\ No newline at end of file
+ switchContent: function() {
+ this.$arrayContent.hide();
+ this.$arrayNavBar.removeClass('ui-btn-active');
+ this.$arrayNavBar.removeClass('ui-state-persist');
+ $(this.$arrayContent[this.indexContent]).show();
+ $(this.$arrayNavBar[this.indexContent]).addClass('ui-btn-active');
+ $(this.$arrayNavBar[this.indexContent]).addClass('ui-state-persist');
+ }
+ });
+ return ItemView;
+ });
\ No newline at end of file
diff --git a/js/modules/item/itemViewTemplate.html b/js/modules/item/itemViewTemplate.html
index 6e09cf4..946a303 100644
--- a/js/modules/item/itemViewTemplate.html
+++ b/js/modules/item/itemViewTemplate.html
@@ -1,7 +1,7 @@
Ingredienti
@@ -46,6 +46,18 @@Link Fonte
<% }%>Opzioni
+Informazione
diff --git a/js/modules/lastricette/lastRicette.js b/js/modules/lastricette/lastRicette.js new file mode 100644 index 0000000..a02e61b --- /dev/null +++ b/js/modules/lastricette/lastRicette.js @@ -0,0 +1,49 @@ +define(['jquery', 'underscore', 'backbone', 'text!modules/lastRicette/lastRicetteViewTemplate.html', + 'text!modules/lastRicette/lastRicetteItemTemplate.html', 'modules/base/baseView'], + function($, _, Backbone, lastRicetteViewTemplate, lastRicetteItemTemplate, BaseView) { + + var LastRicetteView = BaseView.extend({ + collection: null, + //initialize template + template: _.template(lastRicetteViewTemplate), + itemtemplate: _.template(lastRicetteItemTemplate), + initialize: function(options) { + var self = this; + LastRicetteView.__super__.initialize.call(this); + this.collection = options.collection; + this.collection.fetch({ + success: function(data, textStatus, jqXHR) { + self.renderItem(); + } + //success: function(){ self.renderItem(); } + }); + }, + renderItem: function() { + var $ul = $('#allRicette'); + + var items = this.itemtemplate({data: this.collection.toJSON()}); + + $ul.html(items); + $ul.listview("refresh"); + $ul.trigger("updatelayout"); + + $.mobile.loading('hide'); + //$( '[data-alpha="true"]' ).alphascroll(); + }, + //render the content into div of view + render: function() { + //this.header.title = "pippo"; + LastRicetteView.__super__.render.call(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("#indexBtn").addClass("ui-btn-active"); + return this; + } + }); + return LastRicetteView; + }); \ No newline at end of file diff --git a/js/modules/lastricette/lastRicetteItemTemplate.html b/js/modules/lastricette/lastRicetteItemTemplate.html new file mode 100644 index 0000000..da4a0ea --- /dev/null +++ b/js/modules/lastricette/lastRicetteItemTemplate.html @@ -0,0 +1,6 @@ +<% if(data.length == 0){ %> +Nessuna ricetta trovata
+<%} else { for (var i = 0; i < data.length; i++) { %> + <% var item = data[i]; %> +Ultime Ricette Inserite
+-
+
www.sitemaps.org - /schemas/sitemap/0.9/
+ +
[To Parent Directory]
2/1/2013 8:18 PM 2591 siteindex.xsd
2/1/2013 8:19 PM 4451 sitemap.xsd
\ No newline at end of file diff --git a/nbproject/project.properties b/nbproject/project.properties index e27ad3f..471e55f 100644 --- a/nbproject/project.properties +++ b/nbproject/project.properties @@ -1,3 +1,17 @@ -file.reference.IlLievitario-WebClient_210=. +auxiliary.org-netbeans-modules-css-prep.less_2e_compiler_2e_options= +auxiliary.org-netbeans-modules-css-prep.less_2e_enabled=false +auxiliary.org-netbeans-modules-css-prep.less_2e_mappings=/less:/css +auxiliary.org-netbeans-modules-css-prep.sass_2e_compiler_2e_options= +auxiliary.org-netbeans-modules-css-prep.sass_2e_enabled=false +auxiliary.org-netbeans-modules-css-prep.sass_2e_mappings=/scss:/css +auxiliary.org-netbeans-modules-javascript2-requirejs.enabled=true +auxiliary.org-netbeans-modules-web-clientproject-api.js_2e_libs_2e_folder=app-build_prod/libs +browser.autorefresh.SL[/Browsers/webviewBrowser=true +browser.highlightselection.SL[/Browsers/webviewBrowser=true +config.folder= +file.reference.IlLievitario-WebClient=. files.encoding=UTF-8 -site.root.folder=${file.reference.IlLievitario-WebClient_210} +site.root.folder=${file.reference.IlLievitario-WebClient} +start.file=index.php +test.folder= +web.context.root=/WebClient diff --git a/nbproject/project.xml b/nbproject/project.xml index 4dc06ae..6cee9a3 100644 --- a/nbproject/project.xml +++ b/nbproject/project.xml @@ -3,7 +3,7 @@
-
+