# HG changeset patch # User bsw # Date 1566827748 -7200 # Node ID 6b4deab5160ad1a08c6d32f649a16e3962b4ab33 # Parent faaf9ec3e09c774b3c05fb7650c5ccbb64bbc434 Updated search result page diff -r faaf9ec3e09c -r 6b4deab5160a app/main/index/search.lua --- a/app/main/index/search.lua Mon Aug 26 15:49:37 2019 +0200 +++ b/app/main/index/search.lua Mon Aug 26 15:55:48 2019 +0200 @@ -7,98 +7,70 @@ ui.title ( _"Search" ) end -ui.form{ - method = "get", module = "index", view = "search", - routing = { default = { mode = "redirect", - module = "index", view = "search", search_for = search_for, q = search_string - } }, - attr = { class = "vertical section" }, - content = function() - - ui.sectionHead( function() - ui.heading { level = 1, content = _"Search" } +ui.grid{ content = function() + ui.cell_main{ content = function() + + if not search_string then + return + end + + local issues_selector = Issue:get_search_selector(search_string) + local count = issues_selector:count() + local text + if count == 0 then + text = _"No matching issues found" + elseif count == 1 then + text = _"1 matching issue found" + else + text = _"#{count} matching issues found" + end + + ui.section( function() + ui.sectionHead( function() + ui.heading { level = 1, content = _(text, { count = count }) } + end ) + if count > 0 then + execute.view{ + module = "issue", + view = "_list", + params = { + search = search_string, + no_filter = true + }, + } + end end) - - ui.sectionRow( function() - ui.tag { content = _"Search term (only complete words)" } - ui.tag { - tag = "input", - attr = { - name = "q", - value = search_string - } - } - ui.tag{ - tag = "input", - attr = { - class = "btn btn-search", - type = "submit", - value = _"search" - } - } - end ) - end -} + + slot.put("
") - -if not search_string then - return -end + local members_selector = Member:get_search_selector(search_string) + local count = members_selector:count() + local text + if count == 0 then + text = _"No matching members found" + elseif count == 1 then + text = _"1 matching member found" + else + text = _"#{count} matching members found" + end + if app.session:has_access("everything") then + ui.section( function() + ui.sectionHead( function() + ui.heading { level = 1, content = _(text, { count = count }) } + end ) + if count > 0 then + execute.view{ + module = "member", + view = "_list", + params = { + members_selector = members_selector, + no_filter = true + }, + } + end + end ) + end -local members_selector = Member:get_search_selector(search_string) -local count = members_selector:count() -local text -if count == 0 then - text = _"No matching members found" -elseif count == 1 then - text = _"1 matching member found" -else - text = _"#{count} matching members found" -end -if app.session:has_access("everything") then - ui.section( function() - ui.sectionHead( function() - ui.heading { level = 1, content = _(text, { count = count }) } - end ) - if count > 0 then - execute.view{ - module = "member", - view = "_list", - params = { - members_selector = members_selector, - no_filter = true - }, - } - end - end ) -end - -slot.put("
") - -local issues_selector = Issue:get_search_selector(search_string) -local count = issues_selector:count() -local text -if count == 0 then - text = _"No matching issues found" -elseif count == 1 then - text = _"1 matching issue found" -else - text = _"#{count} matching issues found" -end - -ui.section( function() - ui.sectionHead( function() - ui.heading { level = 1, content = _(text, { count = count }) } - end ) - if count > 0 then - execute.view{ - module = "issue", - view = "_list", - params = { - search = search_string, - no_filter = true - }, - } - end -end) + end } +end } diff -r faaf9ec3e09c -r 6b4deab5160a app/main/issue/_list.lua --- a/app/main/issue/_list.lua Mon Aug 26 15:49:37 2019 +0200 +++ b/app/main/issue/_list.lua Mon Aug 26 15:55:48 2019 +0200 @@ -395,7 +395,9 @@ selector:add_order_by ( "CASE WHEN issue.accepted ISNULL THEN " .. admission_order_field .. " ELSE NULL END" ) selector:add_order_by ( "id" ) end - execute.view{ module = "index", view = "_head" } + if not search then + execute.view{ module = "index", view = "_head" } + end ui.paginate{ selector = selector, per_page = 25,