liquid_feedback_frontend
view app/main/timeline/_list.lua @ 15:a3ac899559de
Esperanto support activated in frontend
| author | bsw | 
|---|---|
| date | Sun Jan 31 22:34:45 2010 +0100 (2010-01-31) | 
| parents | 77d58efe99fd | 
| children | 00d1004545f1 | 
 line source
     1 local timeline_selector = param.get("timeline_selector", "table")
     2 local event_names = param.get("event_names", "table")
     3 local initiatives_per_page = param.get("initiatives_per_page", atom.number) or 3
     5 ui.paginate{
     6   per_page = param.get("per_page", atom.number) or 25,
     7   selector = timeline_selector,
     8   content = function()
     9     local timelines = timeline_selector:exec()
    10     timelines:load("issue")
    11     timelines:load("initiative")
    12     timelines:load("member")
    13     ui.list{
    14       attr = { class = "nohover" },
    15       records = timelines,
    16       columns = {
    17         {
    18           field_attr = { style = "width: 10em;" },
    19           content = function(timeline)
    20             ui.field.text{
    21               attr = { style = "font-size: 75%; font-weight: bold; background-color: #ccc; display: block; margin-bottom: 1ex;"},
    22               value = format.time(timeline.occurrence)
    23             }
    24             ui.field.text{
    25               attr = { style = "font-size: 75%; font-weight: bold;"},
    26               value = event_names[timeline.event] or timeline.event
    27             }
    28           end
    29         },
    30         {
    31           content = function(timeline)
    32             local issue
    33             local initiative
    34             if timeline.issue then
    35               issue = timeline.issue
    36             elseif timeline.initiative then
    37               initiative = timeline.initiative
    38               issue = initiative.issue
    39             elseif timeline.draft then
    40               initiative = timeline.draft.initiative
    41               issue = initiative.issue
    42             elseif timeline.suggestion then
    43               initiative = timeline.suggestion.initiative
    44               issue = initiative.issue
    45             end
    46             if issue then
    47               if timeline.is_interested then
    48                 local label = _"You are interested in this issue",
    49                 ui.image{
    50                   attr = { alt = label, title = label, style = "float: left; margin-right: 0.5em;" },
    51                   static = "icons/16/eye.png"
    52                 }
    53               end
    54               slot.put(" ")
    55               ui.tag{
    56                 tag = "span",
    57                 attr = { style = "font-size: 75%; font-weight: bold; background-color: #ccc; display: block; margin-bottom: 1ex;"},
    58                 content = issue.area.name .. ", " .. _("Issue ##{id}", { id = issue.id })
    59               }
    60             else
    61               ui.tag{
    62                 tag = "span",
    63                 attr = { style = "font-size: 75%; background-color: #ccc; display: block; margin-bottom: 1ex;"},
    64                 content = function() slot.put(" ") end
    65               }
    66             end
    68             if timeline.member then
    69               execute.view{
    70                 module = "member_image",
    71                 view = "_show",
    72                 params = {
    73                   member = timeline.member,
    74                   image_type = "avatar",
    75                   show_dummy = true
    76                 }
    77               }
    78               ui.link{
    79                 content = timeline.member.name,
    80                 module = "member",
    81                 view = "show",
    82                 id = timeline.member.id
    83               }
    84             end
    85             if timeline.issue then
    86               local initiatives_selector = timeline.issue
    87                 :get_reference_selector("initiatives")
    88               execute.view{
    89                 module = "initiative",
    90                 view = "_list",
    91                 params = {
    92                   issue = timeline.issue,
    93                   initiatives_selector = initiatives_selector,
    94                   per_page = initiatives_per_page,
    95                   no_sort = true,
    96                   limit = initiatives_per_page
    97                 }
    98               }
    99             elseif initiative then
   100               execute.view{
   101                 module = "initiative",
   102                 view = "_list",
   103                 params = {
   104                   issue = initiative.issue,
   105                   initiatives_selector = Initiative:new_selector():add_where{ "initiative.id = ?", initiative.id },
   106                   per_page = initiatives_per_page,
   107                   no_sort = true
   108                 }
   109               }
   110             end
   111             if timeline.suggestion then
   112               ui.link{
   113                 module = "suggestion",
   114                 view = "show",
   115                 id = timeline.suggestion.id,
   116                 content = timeline.suggestion.name
   117               }
   118             end
   119           end
   120         },
   121       }
   122     }
   123   end
   124 }
