From bf68a2ece667504e656df15ac333e911961d5f4d Mon Sep 17 00:00:00 2001 From: Gehad elrobey Date: Fri, 18 Jul 2014 16:55:16 +0200 Subject: HTML: fix searching tags from the detailed view. When clicking a tag in the detailed view a search must take place on the following tag, the search settings must be specified to search for tags only and ignore the advanced search settings chosen by the user. Signed-off-by: Gehad elrobey Signed-off-by: Miika Turkia Signed-off-by: Dirk Hohndel --- theme/list_lib.js | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) (limited to 'theme/list_lib.js') diff --git a/theme/list_lib.js b/theme/list_lib.js index dd7be94a9..f40151887 100644 --- a/theme/list_lib.js +++ b/theme/list_lib.js @@ -206,8 +206,7 @@ function getExpanded(dive) { var res = '
Date: ' + dive.date + '     Time: ' + dive.time + - '     Location: ' + '' + - dive.location + '' + + '     Location: ' + '' + dive.location + '' + '
Rating:' + putRating(dive.rating) + '   Visibilty:' + putRating(dive.visibility) + '
' + @@ -228,7 +227,7 @@ function putTags(tags) { var result = ""; for (var i in tags) { - result += '' + tags[i] + ''; + result += '' + tags[i] + ''; if (i < tags.length - 1) result += ', '; } @@ -481,14 +480,15 @@ function Node(value) this.key = new Set(); } -function Search_list_Modules(searchfor) +function Search_list_Modules(searchfor, searchOptions) { document.getElementById("search_input").value = searchfor; - SearchModules(searchfor); + SearchModules(searchfor, searchOptions); } -function SearchModules(searchfor) +function SearchModules(searchfor, searchOptions) { + unshowDiveDetails(dive_id); var resultKeys = new Set(); //set if (searchfor.length <= 0) { @@ -502,22 +502,31 @@ function SearchModules(searchfor) var keywords = searchfor.split(" "); + if (searchOptions === null) { + searchOptions = {}; + searchOptions.location = searchingModules["location"].enabled; + searchOptions.divemaster = searchingModules["divemaster"].enabled; + searchOptions.buddy = searchingModules["buddy"].enabled; + searchOptions.notes = searchingModules["notes"].enabled; + searchOptions.tags = searchingModules["tags"].enabled; + } + for (var i = 0; i < keywords.length; i++) { var keywordResult = new Set(); - if (searchingModules["location"].enabled === true) + if (searchOptions.location === true) keywordResult.Union(searchingModules["location"].search(keywords[i])); - if (searchingModules["divemaster"].enabled === true) + if (searchOptions.divemaster === true) keywordResult.Union(searchingModules["divemaster"].search(keywords[i])); - if (searchingModules["buddy"].enabled === true) + if (searchOptions.buddy === true) keywordResult.Union(searchingModules["buddy"].search(keywords[i])); - if (searchingModules["notes"].enabled === true) + if (searchOptions.notes === true) keywordResult.Union(searchingModules["notes"].search(keywords[i])); - if (searchingModules["tags"].enabled === true) + if (searchOptions.tags === true) keywordResult.Union(searchingModules["tags"].search(keywords[i])); if (resultKeys.isEmpty()) { @@ -764,7 +773,7 @@ function get_dive_HTML(dive) { return '

Dive Information

Date: ' + dive.date + '     Time: ' + dive.time + - '     Location: ' + '' + + '     Location: ' + '' + dive.location + '' + '
Rating:' + putRating(dive.rating) + '   Visibilty:' + putRating(dive.visibility) + -- cgit v1.2.3-70-g09d2