liquid_feedback_frontend

view app/main/index/search.lua @ 1233:ad207be24c7a

Fixed layout of email address confirmation dialog
author bsw
date Tue Dec 01 18:33:06 2015 +0100 (2015-12-01)
parents 701a5cf6b067
children 32cc544d5a5b
line source
1 local search_for = param.get("search_for", atom.string) or "global"
2 local search_string = param.get("q", atom.string)
4 if search_string then
5 ui.title ( _("Search results for: '#{search}'", { search = search_string } ) )
6 else
7 ui.title ( _"Search" )
8 end
10 ui.form{
11 method = "get", module = "index", view = "search",
12 routing = { default = { mode = "redirect",
13 module = "index", view = "search", search_for = search_for, q = search_string
14 } },
15 attr = { class = "vertical section" },
16 content = function()
18 ui.sectionHead( function()
19 ui.heading { level = 1, content = _"Search" }
20 end)
22 ui.sectionRow( function()
23 ui.tag { content = _"Search term (only complete words)" }
24 ui.tag {
25 tag = "input",
26 attr = {
27 name = "q",
28 value = search_string
29 }
30 }
31 ui.tag{
32 tag = "input",
33 attr = {
34 class = "btn btn-search",
35 type = "submit",
36 value = _"search"
37 }
38 }
39 end )
40 end
41 }
44 if not search_string then
45 return
46 end
49 local members_selector = Member:get_search_selector(search_string)
50 local count = members_selector:count()
51 local text
52 if count == 0 then
53 text = _"No matching members found"
54 elseif count == 1 then
55 text = _"1 matching member found"
56 else
57 text = _"#{count} matching members found"
58 end
59 if app.session:has_access("everything") then
60 ui.section( function()
61 ui.sectionHead( function()
62 ui.heading { level = 1, content = _(text, { count = count }) }
63 end )
64 if count > 0 then
65 execute.view{
66 module = "member",
67 view = "_list",
68 params = {
69 members_selector = members_selector,
70 no_filter = true
71 },
72 }
73 end
74 end )
75 end
77 slot.put("<br />")
79 local issues_selector = Issue:get_search_selector(search_string)
80 local count = issues_selector:count()
81 local text
82 if count == 0 then
83 text = _"No matching issues found"
84 elseif count == 1 then
85 text = _"1 matching issue found"
86 else
87 text = _"#{count} matching issues found"
88 end
90 ui.section( function()
91 ui.sectionHead( function()
92 ui.heading { level = 1, content = _(text, { count = count }) }
93 end )
94 if count > 0 then
95 execute.view{
96 module = "issue",
97 view = "_list2",
98 params = {
99 search = search_string,
100 no_filter = true
101 },
102 }
103 end
104 end)

Impressum / About Us