From 2affad28f1fd9dd9aa9b9c8f4d5998c9016162ef Mon Sep 17 00:00:00 2001 From: hexstudy Date: Tue, 1 Mar 2016 14:20:31 +0000 Subject: [PATCH] git-svn-id: https://msi/svn/firstRepo/WebClient/branches/Manut_3.0.1@71 0f545695-f87b-41b6-9a03-7f16563b5454 --- js/manifest.js | 2 +- js/model/authors/authorCollection.js | 15 ---------- js/model/authors/authorModel.js | 13 --------- js/model/categoryItem/foundItemCollection.js | 5 ++-- js/modules/search/foundItemTemplate.html | 30 ++++++++++++++++++-- js/modules/search/search.js | 9 +++--- js/modules/search/searchViewTemplate.html | 12 ++------ js/router.js | 15 +++++----- 8 files changed, 46 insertions(+), 55 deletions(-) delete mode 100644 js/model/authors/authorCollection.js delete mode 100644 js/model/authors/authorModel.js diff --git a/js/manifest.js b/js/manifest.js index 2f24286..ede544e 100644 --- a/js/manifest.js +++ b/js/manifest.js @@ -1,7 +1,7 @@ var myManifest = { Debug: (window.location.port !== ""), Name: "Il Lievitario", - Version: "3.0.2.0", + Version: "3.0.3.0", Author: "Denis Ironi", Settings: { DefaultURL: (window.location.port === "" ? "http://" + window.location.host + "/Service": "http://" + window.location.hostname + ":" + window.location.port + "/Service_Manut"), diff --git a/js/model/authors/authorCollection.js b/js/model/authors/authorCollection.js deleted file mode 100644 index cedf22f..0000000 --- a/js/model/authors/authorCollection.js +++ /dev/null @@ -1,15 +0,0 @@ -define(['app', 'jquery', 'underscore', 'backbone', 'model/authors/authorModel'], - function (app, $, _, Backbone, Author) { - - var Authors = Backbone.Collection.extend({ - // Book is the model of the collection - model: Author, - url: function () { - return myManifest.Settings.DefaultURL + "/api/ricette/authors"; - } - }); - - return Authors; - }); - - diff --git a/js/model/authors/authorModel.js b/js/model/authors/authorModel.js deleted file mode 100644 index ec82911..0000000 --- a/js/model/authors/authorModel.js +++ /dev/null @@ -1,13 +0,0 @@ -define(['jquery', 'underscore', 'backbone'], -function ($, _, Backbone){ - - var Author=Backbone.Model.extend({ - //default attributes - defaults:{ - name:'' - } - }); - - return Author; -}); - diff --git a/js/model/categoryItem/foundItemCollection.js b/js/model/categoryItem/foundItemCollection.js index 9fdc836..d8f9a36 100644 --- a/js/model/categoryItem/foundItemCollection.js +++ b/js/model/categoryItem/foundItemCollection.js @@ -10,7 +10,8 @@ define(['app', 'jquery', 'underscore', 'backbone', 'model/categoryItem/searchIte this.dataFilter = { titolo: options.titolo, difficolta: options.difficolta, - categoryId: options.categoryId + categoryId: options.categoryId, + autore: options.autore }; this.numItems = options.nResult; this.indexItems = options.indexItems; @@ -32,7 +33,7 @@ define(['app', 'jquery', 'underscore', 'backbone', 'model/categoryItem/searchIte this.numItems + "/" + this.indexItems + "/" + this.dataFilter.categoryId + - "/" + this.dataFilter.difficolta; + "/" + this.dataFilter.difficolta+ "/" + this.dataFilter.autore; if(this.dataFilter.titolo !== null) u += "/" + this.dataFilter.titolo; diff --git a/js/modules/search/foundItemTemplate.html b/js/modules/search/foundItemTemplate.html index 38d13df..bf2e539 100644 --- a/js/modules/search/foundItemTemplate.html +++ b/js/modules/search/foundItemTemplate.html @@ -2,7 +2,31 @@

Nessuna ricetta trovata

<%} else { for (var i = 0; i < data.length; i++) { %> <% var item = data[i]; %> -
  • -
    <%= unescape(item.titolo) %> - <%= unescape(item.categoria_name) %>
    <%= unescape(item.autore) %>
    -
  • +
  • + <% if(item.firstImage === ""){ %> + + <%}else{%> + + <%}%> +
    <%= unescape(item.titolo) %>
    +
    <%= unescape(item.autore) %>
    +
    Diff.:  
    +
    +
    +
    1
    +
    +
    +
    2
    +
    +
    +
    3
    +
    +
    +
    4
    +
    +
    +
    5
    +
    +
    +
  • <% }} %> \ No newline at end of file diff --git a/js/modules/search/search.js b/js/modules/search/search.js index bb53d1d..bb80e85 100644 --- a/js/modules/search/search.js +++ b/js/modules/search/search.js @@ -9,9 +9,6 @@ define(['jquery', 'underscore', 'backbone','text!modules/search/searchViewTempla this.id = "SearchView"; var self = this; SearchView.__super__.initialize.call(this); - this.collection = options.collection; - this.collection.fetch({ success: function () { self.render(); } }); - //this.header.title = "pippo"; }, events: { @@ -21,6 +18,7 @@ define(['jquery', 'underscore', 'backbone','text!modules/search/searchViewTempla performSearch: function (e) { e.preventDefault(); var titolo = $('#titolo').val(); + var autore = $('#autore').val(); var categoria = $('#categoria').val(); var nResult = $('#nResult').val(); var diffi = $('#difficoltaFrm').serialize(); @@ -28,7 +26,10 @@ define(['jquery', 'underscore', 'backbone','text!modules/search/searchViewTempla if (diffi === "") { diffi = "0"; } - Backbone.history.navigate('search/' + nResult + "/"+ categoria + "/" + diffi + "/" + titolo, { trigger: true }); + if (autore === "" || autore == undefined) { + autore = "_"; + } + Backbone.history.navigate('search/' + nResult + "/"+ categoria + "/" + diffi + "/" + autore + "/"+titolo, { trigger: true }); }, onShowed: function(){ diff --git a/js/modules/search/searchViewTemplate.html b/js/modules/search/searchViewTemplate.html index ffa1e31..854958e 100644 --- a/js/modules/search/searchViewTemplate.html +++ b/js/modules/search/searchViewTemplate.html @@ -30,15 +30,9 @@ - - + + +


    Cerca
    \ No newline at end of file diff --git a/js/router.js b/js/router.js index 5dff439..077764e 100644 --- a/js/router.js +++ b/js/router.js @@ -4,7 +4,7 @@ define(['jquery', 'underscore', 'backbone', 'modules/sync/sync', 'modules/donation/donation','modules/settings/settings', 'modules/debug/debug','modules/maps/maps', 'model/note/noteCollection', 'model/category/categoryCollection', 'model/categoryItem/categoryItemCollection', - 'model/item/itemCollection', 'model/item/ingredientiCollection', 'model/categoryItem/foundItemCollection','model/authors/authorCollection', + 'model/item/itemCollection', 'model/item/ingredientiCollection', 'model/categoryItem/foundItemCollection', 'classes/cache', 'libs/fastclick', 'jqm', 'jQueryPlugins'], function ($, _, Backbone, @@ -13,7 +13,7 @@ define(['jquery', 'underscore', 'backbone', SyncView, DonationView, SettingsView, DebugView, MapsView, NoteCollection, CategoryCollection, CategoryItemCollection, - ItemCollection, IngredientiCollection, FoundItemCollection, AuthorCollection, + ItemCollection, IngredientiCollection, FoundItemCollection, Cache, FastClick) { 'use strict'; @@ -57,7 +57,7 @@ define(['jquery', 'underscore', 'backbone', 'debugView': 'showDebug', 'settingsView': 'showSettings', 'donationView': 'showDonation', - 'search/:nresult/:categoria/:difficolta/*titolo': 'searchFn', + 'search/:nresult/:categoria/:difficolta/:autore/*titolo': 'searchFn', 'converterView': 'showConverter', 'moreView': 'showMore', '*actions': 'defaultAction' //default action @@ -172,14 +172,13 @@ define(['jquery', 'underscore', 'backbone', this.changePage(mapsView); }, showSearch: function () { - var authors = new AuthorCollection(); // will render home view and navigate to homeView - var searchView = new SearchView({collection: authors}); - //indexView.render(); + var searchView = new SearchView(); + indexView.render(); searchView.bind('renderCompleted:Search', this.changePage, this); }, - searchFn: function (nresult, categoria, difficolta, titolo) { - var foundedItems = new FoundItemCollection({categoryId: categoria, difficolta: difficolta, titolo: titolo, nResult: nresult, indexItems: 0}); + searchFn: function (nresult, categoria, difficolta, autore, titolo) { + var foundedItems = new FoundItemCollection({categoryId: categoria, difficolta: difficolta, titolo: titolo, autore: autore, nResult: nresult, indexItems: 0}); var foundView = new FoundView({collection: foundedItems}); foundView.render();