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

This commit is contained in:
2014-12-10 14:58:10 +00:00
parent 90e0252f4b
commit 876ee18579
238 changed files with 35068 additions and 0 deletions
+48
View File
@@ -0,0 +1,48 @@
define(['jquery', 'underscore', 'backbone','text!modules/search/foundViewTemplate.html','text!modules/search/foundItemTemplate.html', 'modules/base/baseView'],
function($, _, Backbone, foundViewTemplate, foundItemTemplate, BaseView){
var FoundView = BaseView.extend({
collection: null,
//initialize template
template:_.template(foundViewTemplate),
itemTemplate:_.template(foundItemTemplate),
initialize: function (options) {
var self = this;
FoundView.__super__.initialize.call(this);
this.collection = options.collection;
this.collection.fetch({
success: function(){ self.renderItem(); } });
},
renderItem: function(){
var $ul = $('#foundRicette');
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";
FoundView.__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("#searchBtn").addClass("ui-btn-active");
return this;
}
});
return FoundView;
});
+8
View File
@@ -0,0 +1,8 @@
<% if(data.length == 0){ %>
<h1>Nessuna ricetta trovata</h1>
<%} else { for (var i = 0; i < data.length; i++) { %>
<% var item = data[i]; %>
<li><a href="#ricetta/<%= item.ricetta_id%>" class="ui-btn ui-btn-icon-right ui-icon-carat-r">
<div class='ricettaTitolo'><%= unescape(item.titolo) %> - <%= unescape(item.categoria_name) %></div><div class='ricettaAutore'><%= unescape(item.autore) %></div>
</a></li>
<% }} %>
+5
View File
@@ -0,0 +1,5 @@
<div id="categoryListContent" data-role="content">
<h1>Ricerca Ricette...</h1>
<ul id="foundRicette" data-role="listview" data-autodividers="true" data-inset="true">
</ul>
</div>
+57
View File
@@ -0,0 +1,57 @@
define(['jquery', 'underscore', 'backbone','text!modules/search/searchViewTemplate.html', 'modules/base/baseView', 'classes/profile', 'jQueryPlugins'],
function($, _, Backbone, searchViewTemplate, BaseView, Profile) {
var SearchView = BaseView.extend({
collection: null,
//initialize template
template:_.template(searchViewTemplate),
initialize: function (options) {
var self = this;
SearchView.__super__.initialize.call(this);
this.collection = options.collection;
this.collection.fetch({ success: function () { self.render(); } });
//this.header.title = "pippo";
},
events: {
"click [button='true']": "performSearch"
},
performSearch: function (e) {
e.preventDefault();
var titolo = $('#titolo').val();
var categoria = $('#categoria').val();
var nResult = $('#nResult').val();
var diffi = $('#difficoltaFrm').serialize();
diffi = diffi.replace("difficolta=", "");
if (diffi === "") {
diffi = "0";
}
Backbone.history.navigate('search/' + nResult + "/"+ categoria + "/" + diffi + "/" + titolo, { trigger: true });
},
//render the content into div of view
render: function () {
//this.header.title = "pippo";
SearchView.__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({data:this.collection.toJSON()}));
this.$el.append(this.footer.$el);
this.$el.find('#nResult').val(Profile.data.risRic);
// this.$el.find('#search').on("click", function(e){
// e.preventDefault();
//
// });
this.trigger("renderCompleted:Search", this);
this.$el.find("#searchBtn").addClass("ui-btn-active");
//$("#homeBtn").addClass("ui-btn-active");
//return to enable chained calls
return this;
}
});
return SearchView;
});
+31
View File
@@ -0,0 +1,31 @@
<div data-role="content">
<h1>Ricerca ricetta</h1>
<label for="titolo">Titolo:</label>
<input type="text" name="titolo" id="titolo" placeholder="Titolo..." value="" data-clear-btn="true" ><br>
<label for="categoria">Categoria:</label>
<select name="categoria" id="categoria" data-native-menu="true" >
<option value="0" selected="true">Selezionare Categoria...</option>
<% for (var i = 0; i < data.length; i++) { %>
<% var item = data[i]; %>
<option value="<%=item.category_id%>"><%=item.name%></option>
<% } %>
</select><br>
<label for="difficoltaFrm">Livello Difficoltà:</label>
<form id="difficoltaFrm" data-role="none">
<input name="difficolta" type="radio" data-role="none" value="1" title="Molto Semplice" class="star"/>
<input name="difficolta" type="radio" data-role="none" value="2" title="Semplice" class="star"/>
<input name="difficolta" type="radio" data-role="none" value="3" title="Normale" class="star"/>
<input name="difficolta" type="radio" data-role="none" value="4" title="Difficile" class="star"/>
<input name="difficolta" type="radio" data-role="none" value="5" title="Molto Difficile" class="star"/>
<span id="hover-test" style="margin:0 0 0 20px;">Nessuna</span></form><br>
<label for="nResult">Numero Risultati:</label>
<select name="nResult" id="nResult" >
<option value="10" selected="true">10</option>
<option value="15">15</option>
<option value="20">20</option>
<option value="25">25</option>
<option value="30">30</option>
</select>
<br><br>
<center><a href="" id="search" button="true" class="ui-btn ui-corner-all">Cerca</a></center>
</div>