rev |
line source |
bsw/jbe@19
|
1 local search_for = param.get("search_for", atom.string) or "global"
|
bsw@1045
|
2 local search_string = param.get("q", atom.string)
|
bsw/jbe@0
|
3
|
bsw@480
|
4 if search_string then
|
bsw@1045
|
5 ui.title ( _("Search results for: '#{search}'", { search = search_string } ) )
|
bsw@480
|
6 else
|
bsw@1045
|
7 ui.title ( _"Search" )
|
bsw/jbe@0
|
8 end
|
bsw/jbe@0
|
9
|
bsw@1493
|
10 ui.grid{ content = function()
|
bsw@1493
|
11 ui.cell_main{ content = function()
|
bsw@1493
|
12
|
bsw@1493
|
13 if not search_string then
|
bsw@1493
|
14 return
|
bsw@1493
|
15 end
|
bsw@1493
|
16
|
bsw@1493
|
17 local issues_selector = Issue:get_search_selector(search_string)
|
bsw@1493
|
18 local count = issues_selector:count()
|
bsw@1493
|
19 local text
|
bsw@1493
|
20 if count == 0 then
|
bsw@1493
|
21 text = _"No matching issues found"
|
bsw@1493
|
22 elseif count == 1 then
|
bsw@1493
|
23 text = _"1 matching issue found"
|
bsw@1493
|
24 else
|
bsw@1493
|
25 text = _"#{count} matching issues found"
|
bsw@1493
|
26 end
|
bsw@1493
|
27
|
bsw@1493
|
28 ui.section( function()
|
bsw@1493
|
29 ui.sectionHead( function()
|
bsw@1493
|
30 ui.heading { level = 1, content = _(text, { count = count }) }
|
bsw@1493
|
31 end )
|
bsw@1493
|
32 if count > 0 then
|
bsw@1493
|
33 execute.view{
|
bsw@1493
|
34 module = "issue",
|
bsw@1493
|
35 view = "_list",
|
bsw@1493
|
36 params = {
|
bsw@1493
|
37 search = search_string,
|
bsw@1493
|
38 no_filter = true
|
bsw@1493
|
39 },
|
bsw@1493
|
40 }
|
bsw@1493
|
41 end
|
bsw@1045
|
42 end)
|
bsw@1493
|
43
|
bsw@1493
|
44 slot.put("<br />")
|
bsw@480
|
45
|
bsw@1493
|
46 local members_selector = Member:get_search_selector(search_string)
|
bsw@1493
|
47 local count = members_selector:count()
|
bsw@1493
|
48 local text
|
bsw@1493
|
49 if count == 0 then
|
bsw@1493
|
50 text = _"No matching members found"
|
bsw@1493
|
51 elseif count == 1 then
|
bsw@1493
|
52 text = _"1 matching member found"
|
bsw@1493
|
53 else
|
bsw@1493
|
54 text = _"#{count} matching members found"
|
bsw@1493
|
55 end
|
bsw@1493
|
56 if app.session:has_access("everything") then
|
bsw@1493
|
57 ui.section( function()
|
bsw@1493
|
58 ui.sectionHead( function()
|
bsw@1493
|
59 ui.heading { level = 1, content = _(text, { count = count }) }
|
bsw@1493
|
60 end )
|
bsw@1493
|
61 if count > 0 then
|
bsw@1493
|
62 execute.view{
|
bsw@1493
|
63 module = "member",
|
bsw@1493
|
64 view = "_list",
|
bsw@1493
|
65 params = {
|
bsw@1493
|
66 members_selector = members_selector,
|
bsw@1493
|
67 no_filter = true
|
bsw@1493
|
68 },
|
bsw@1493
|
69 }
|
bsw@1493
|
70 end
|
bsw@1493
|
71 end )
|
bsw@1493
|
72 end
|
bsw@1045
|
73
|
bsw/jbe@19
|
74
|
bsw@1493
|
75 end }
|
bsw@1493
|
76 end }
|