Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1# encoding: utf-8 

2from . import * 

3 

4def searchForm( 

5 buttonText="", 

6 span=2, 

7 inlineHelpText=False, 

8 blockHelpText=False, 

9 focusedInputText=False, 

10 htmlId=False): 

11 """ 

12 *Generate a search-form - TBS style* 

13 

14 **Key Arguments** 

15 

16 - ``buttonText`` -- the button text 

17 - ``span`` -- column span 

18 - ``inlineHelpText`` -- inline and block level support for help text that appears around form controls 

19 - ``blockHelpText`` -- a longer block of help text that breaks onto a new line and may extend beyond one line 

20 - ``focusedInputText`` -- make the input focused by providing some initial editable input text 

21 - ``htmlId`` -- htmlId 

22  

23 

24 **Return** 

25 

26 - ``searchForm`` -- the search-form 

27  

28 """ 

29 if span: 

30 span = "span%(span)s" % locals() 

31 else: 

32 span = "" 

33 

34 if not focusedInputText: 

35 focusedInputText = "" 

36 focusId = "" 

37 else: 

38 focusId = "focusedInput" 

39 

40 if inlineHelpText: 

41 inlineHelpText = """<span class="help-inline">%(inlineHelpText)s</span>""" % locals( 

42 ) 

43 else: 

44 inlineHelpText = "" 

45 

46 if blockHelpText: 

47 blockHelpText = """<span class="help-block">%(blockHelpText)s</span>""" % locals( 

48 ) 

49 else: 

50 blockHelpText = "" 

51 

52 if not htmlId: 

53 htmlId = "" 

54 

55 searchForm = """ 

56 <form class="form-search"> 

57 <div class="input-append"> 

58 <input type="text" class="search-query %(span)s" id="%(htmlId)s" id="%(focusId)s" value="%(focusedInputText)s"> 

59 <button type="submit" class="btn">%(buttonText)s</button> 

60 %(inlineHelpText)s%(blockHelpText)s 

61 </div> 

62 </form>""" % locals() 

63 

64 return searchForm