liquid_feedback_frontend
view app/main/index/search.lua @ 1747:eb34fe00cf5c
Fixed syntax error
| author | bsw | 
|---|---|
| date | Mon Oct 11 10:52:52 2021 +0200 (2021-10-11) | 
| parents | 6b4deab5160a | 
| children | 
 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.grid{ content = function()
    11   ui.cell_main{ content = function()
    13     if not search_string then
    14       return
    15     end
    17     local issues_selector = Issue:get_search_selector(search_string)
    18     local count = issues_selector:count()
    19     local text
    20     if count == 0 then
    21       text = _"No matching issues found"
    22     elseif count == 1 then
    23       text = _"1 matching issue found"
    24     else
    25       text = _"#{count} matching issues found"
    26     end
    28     ui.section( function()
    29       ui.sectionHead( function()
    30         ui.heading { level = 1, content = _(text, { count = count }) }
    31       end )
    32       if count > 0 then
    33         execute.view{
    34           module = "issue",
    35           view = "_list",
    36           params = {
    37             search = search_string,
    38             no_filter = true
    39           },
    40         }
    41       end
    42     end)
    44     slot.put("<br />")
    46     local members_selector = Member:get_search_selector(search_string)
    47     local count = members_selector:count()
    48     local text
    49     if count == 0 then
    50       text = _"No matching members found"
    51     elseif count == 1 then
    52       text = _"1 matching member found"
    53     else
    54       text = _"#{count} matching members found"
    55     end
    56     if app.session:has_access("everything") then
    57       ui.section( function()
    58         ui.sectionHead( function()
    59           ui.heading { level = 1, content = _(text, { count = count }) }
    60         end )
    61         if count > 0 then
    62           execute.view{
    63             module = "member",
    64             view = "_list",
    65             params = {
    66               members_selector = members_selector,
    67               no_filter = true
    68             },
    69           }
    70         end
    71       end )
    72     end
    75   end }
    76 end }
