You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bloodhound.apache.org by th...@apache.org on 2014/07/29 19:17:14 UTC

svn commit: r1614421 - in /bloodhound/branches/bep_0013_dynamic_clientside_features/bloodhound_theme/bhtheme: htdocs/js/DupeSearch.js htdocs/js/keywordsuggest_ticket.js htdocs/js/popoverDupSearch.js theme.py

Author: thimal
Date: Tue Jul 29 17:17:14 2014
New Revision: 1614421

URL: http://svn.apache.org/r1614421
Log:
add css to duplicate tickets
show duplicate tickets in all pages

Modified:
    bloodhound/branches/bep_0013_dynamic_clientside_features/bloodhound_theme/bhtheme/htdocs/js/DupeSearch.js
    bloodhound/branches/bep_0013_dynamic_clientside_features/bloodhound_theme/bhtheme/htdocs/js/keywordsuggest_ticket.js
    bloodhound/branches/bep_0013_dynamic_clientside_features/bloodhound_theme/bhtheme/htdocs/js/popoverDupSearch.js
    bloodhound/branches/bep_0013_dynamic_clientside_features/bloodhound_theme/bhtheme/theme.py

Modified: bloodhound/branches/bep_0013_dynamic_clientside_features/bloodhound_theme/bhtheme/htdocs/js/DupeSearch.js
URL: http://svn.apache.org/viewvc/bloodhound/branches/bep_0013_dynamic_clientside_features/bloodhound_theme/bhtheme/htdocs/js/DupeSearch.js?rev=1614421&r1=1614420&r2=1614421&view=diff
==============================================================================
--- bloodhound/branches/bep_0013_dynamic_clientside_features/bloodhound_theme/bhtheme/htdocs/js/DupeSearch.js (original)
+++ bloodhound/branches/bep_0013_dynamic_clientside_features/bloodhound_theme/bhtheme/htdocs/js/DupeSearch.js Tue Jul 29 17:17:14 2014
@@ -32,7 +32,7 @@ jQuery(document).ready(function() {
 						// no dupe tickets
 						duplicate_eticket_list_div.slideUp();
 					} else {
-						html = '<h5>Possible related tickets:</h5><ul id="results">'
+						html = '<h5>Possible related tickets:</h5><ul id="results" style="display:none; list-style-type: none">'
 						tickets = tickets.reverse();
 
 						for (var i = 0; i < tickets.length && i < max_tickets; i++) {

Modified: bloodhound/branches/bep_0013_dynamic_clientside_features/bloodhound_theme/bhtheme/htdocs/js/keywordsuggest_ticket.js
URL: http://svn.apache.org/viewvc/bloodhound/branches/bep_0013_dynamic_clientside_features/bloodhound_theme/bhtheme/htdocs/js/keywordsuggest_ticket.js?rev=1614421&r1=1614420&r2=1614421&view=diff
==============================================================================
--- bloodhound/branches/bep_0013_dynamic_clientside_features/bloodhound_theme/bhtheme/htdocs/js/keywordsuggest_ticket.js (original)
+++ bloodhound/branches/bep_0013_dynamic_clientside_features/bloodhound_theme/bhtheme/htdocs/js/keywordsuggest_ticket.js Tue Jul 29 17:17:14 2014
@@ -1,9 +1,10 @@
-jQuery(document).ready(function () {
+
+                jQuery(document).ready(function($) {
 
                         $('#field-keywords').tagsinput({
                             typeahead: {
                                 source: keywords
                                 }
                             });
+                            });
 
-                    });

Modified: bloodhound/branches/bep_0013_dynamic_clientside_features/bloodhound_theme/bhtheme/htdocs/js/popoverDupSearch.js
URL: http://svn.apache.org/viewvc/bloodhound/branches/bep_0013_dynamic_clientside_features/bloodhound_theme/bhtheme/htdocs/js/popoverDupSearch.js?rev=1614421&r1=1614420&r2=1614421&view=diff
==============================================================================
--- bloodhound/branches/bep_0013_dynamic_clientside_features/bloodhound_theme/bhtheme/htdocs/js/popoverDupSearch.js (original)
+++ bloodhound/branches/bep_0013_dynamic_clientside_features/bloodhound_theme/bhtheme/htdocs/js/popoverDupSearch.js Tue Jul 29 17:17:14 2014
@@ -1,5 +1,5 @@
 jQuery(document).ready(function() {
-
+     var bloodhoundBase = getBaseUrl();
 	$('input#field-summary.input-block-level').blur(function() {
 		var text = $('input#field-summary.input-block-level').val();
 		if (text.length > 0) {
@@ -14,7 +14,7 @@ jQuery(document).ready(function() {
 			dupelicate_ticket_list_div.html(html).slideDown();
 
 			$.ajax({
-				url:'duplicate_ticket_search',
+				url:bloodhoundBase.url+'duplicate_ticket_search',
                 data:{q:text},
 				type:'GET',
 				success: function(data, status) {
@@ -31,7 +31,7 @@ jQuery(document).ready(function() {
 						// no dupe tickets
 						dupelicate_ticket_list_div.slideUp();
 					} else {
-						html = '<h5>Possible related tickets:</h5><ul style="display:none;">';
+						html = '<h5>Possible related tickets:</h5><ul id="results" style="display:none; list-style-type: none">';
 						//tickets = tickets.reverse();
 
 						for (var i = 0; i < tickets.length && i < max_tickets; i++) {
@@ -69,5 +69,28 @@ jQuery(document).ready(function() {
 	function htmlencode(text) {
 		return $('<div/>').text(text).html().replace(/"/g, '&quot;').replace(/'/g, '&apos;');
 	}
+    	function getBaseUrl() {
+		// returns the base URL to bloodhound, based on guesses.
+		var returnVal = { url:null, ticket:null };
+		var urlRegex = /^.+?(?=\/newticket.*|\/ticket\/(\d+).*|\/ticket.*)/i;
+		var match = urlRegex.exec(location.href);
+		if (match) {
+			if (match[1]) {
+				// also have a ticket number
+				returnVal.ticket = match[1];
+			}
+			returnVal.url = match[0] + (match[0].match('/$') ? '' : '/');
+		} else {
+			//check whether the url is base url, if base url add ending '/'
+            var urlRegex1 = /^.+?(?=\/.*)/i;
+            var match1 = urlRegex1.exec(location.pathname);
+            if(match1){
+                returnVal.url = ''
+            }else{
+                returnVal.url = location.href + (location.href.match('/$') ? '' : '/') ;
+            }
+		}
+		return returnVal;
+	}
 });
 

Modified: bloodhound/branches/bep_0013_dynamic_clientside_features/bloodhound_theme/bhtheme/theme.py
URL: http://svn.apache.org/viewvc/bloodhound/branches/bep_0013_dynamic_clientside_features/bloodhound_theme/bhtheme/theme.py?rev=1614421&r1=1614420&r2=1614421&view=diff
==============================================================================
--- bloodhound/branches/bep_0013_dynamic_clientside_features/bloodhound_theme/bhtheme/theme.py (original)
+++ bloodhound/branches/bep_0013_dynamic_clientside_features/bloodhound_theme/bhtheme/theme.py Tue Jul 29 17:17:14 2014
@@ -69,7 +69,7 @@ class BloodhoundTheme(ThemeBase):
     disable_all_trac_css = True
     BLOODHOUND_KEEP_CSS = set(
         (
-            'diff.css', 'code.css'
+            'diff.css', 'code.css', 'jquery-ui.css'
         )
     )
     BLOODHOUND_TEMPLATE_MAP = {
@@ -873,8 +873,10 @@ class KeywordSuggestModule(Component):
             self.log.debug("""
                 No keywords found. KeywordSuggestPlugin is disabled.""")
             keywords = []
-
+        # data = {'keywords': keywords}
+        # add_script_data(req, data)
         if filename == 'bh_ticket.html':
+            # add_script(req, 'keywordssuggest/js/keywordsuggest_ticket.js')
             if req.path_info.startswith('/ticket/'):
                 js = """
                 jQuery(document).ready(function($) {