annotate app/main/member/history.lua @ 1344:047a4c0f17fe
Fixed wrong place to set correct form enctype
 | author | 
 bsw | 
 | date | 
 Fri Aug 03 17:45:19 2018 +0200 (2018-08-03) | 
 | parents | 
 32cc544d5a5b  | 
 | children | 
  | 
 
 | rev | 
   line source | 
| 
bsw@9
 | 
     1 local member = Member:by_id(param.get_id())
 | 
| 
bsw@9
 | 
     2 
 | 
| 
bsw/jbe@1309
 | 
     3 if not member then
 | 
| 
bsw/jbe@1309
 | 
     4   execute.view { module = "index", view = "404" }
 | 
| 
bsw/jbe@1309
 | 
     5   request.set_status("404 Not Found")
 | 
| 
bsw/jbe@1309
 | 
     6   return
 | 
| 
bsw/jbe@1309
 | 
     7 end
 | 
| 
bsw/jbe@1309
 | 
     8 
 | 
| 
bsw/jbe@1309
 | 
     9 
 | 
| 
bsw@1045
 | 
    10 ui.titleMember(member)
 | 
| 
bsw@1045
 | 
    11 
 | 
| 
bsw/jbe@1309
 | 
    12 ui.grid{ content = function()
 | 
| 
bsw/jbe@1309
 | 
    13   ui.cell_main{ content = function()
 | 
| 
bsw/jbe@1309
 | 
    14     ui.container{ attr = { class = "mdl-card mdl-card__fullwidth mdl-shadow--2dp" }, content = function()
 | 
| 
bsw/jbe@1309
 | 
    15       
 | 
| 
bsw/jbe@1309
 | 
    16       ui.container{ attr = { class = "mdl-card__title mdl-card--border" }, content = function()
 | 
| 
bsw/jbe@1309
 | 
    17         ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = _"Account history" }
 | 
| 
bsw/jbe@1309
 | 
    18       end }
 | 
| 
bsw@1045
 | 
    19 
 | 
| 
bsw/jbe@1309
 | 
    20       ui.container{ attr = { class = "mdl-card__content" }, content = function()
 | 
| 
bsw/jbe@1309
 | 
    21 
 | 
| 
bsw/jbe@1309
 | 
    22       
 | 
| 
bsw/jbe@1309
 | 
    23         ui.form{
 | 
| 
bsw/jbe@1309
 | 
    24           attr = { class = "vertical" },
 | 
| 
bsw/jbe@1309
 | 
    25           content = function()
 | 
| 
bsw/jbe@1309
 | 
    26             ui.field.text{ label = _"Current name", value = member.name }
 | 
| 
bsw/jbe@1309
 | 
    27             ui.field.text{ label = _"Current status", value = member.active and _'activated' or _'deactivated' }
 | 
| 
bsw/jbe@1309
 | 
    28           end
 | 
| 
bsw/jbe@1309
 | 
    29         }
 | 
| 
bsw@77
 | 
    30 
 | 
| 
bsw@77
 | 
    31 
 | 
| 
bsw/jbe@1309
 | 
    32         local entries = member:get_reference_selector("history_entries"):add_order_by("id DESC"):exec()
 | 
| 
bsw/jbe@1309
 | 
    33         
 | 
| 
bsw/jbe@1309
 | 
    34         if #entries > 0 then
 | 
| 
bsw@77
 | 
    35           ui.tag{
 | 
| 
bsw/jbe@1309
 | 
    36             tag = "table",
 | 
| 
bsw@1045
 | 
    37             content = function()
 | 
| 
bsw@1045
 | 
    38               ui.tag{
 | 
| 
bsw/jbe@1309
 | 
    39                 tag = "tr",
 | 
| 
bsw/jbe@1309
 | 
    40                 content = function()
 | 
| 
bsw/jbe@1309
 | 
    41                   ui.tag{
 | 
| 
bsw/jbe@1309
 | 
    42                     tag = "th",
 | 
| 
bsw/jbe@1309
 | 
    43                     content = _("Name")
 | 
| 
bsw/jbe@1309
 | 
    44                   }
 | 
| 
bsw/jbe@1309
 | 
    45                   ui.tag{
 | 
| 
bsw/jbe@1309
 | 
    46                     tag = "th",
 | 
| 
bsw/jbe@1309
 | 
    47                     content = _("Status")
 | 
| 
bsw/jbe@1309
 | 
    48                   }
 | 
| 
bsw/jbe@1309
 | 
    49                   ui.tag{
 | 
| 
bsw/jbe@1309
 | 
    50                     tag = "th",
 | 
| 
bsw/jbe@1309
 | 
    51                     content = _("until")
 | 
| 
bsw/jbe@1309
 | 
    52                   }
 | 
| 
bsw/jbe@1309
 | 
    53                 end
 | 
| 
bsw@1045
 | 
    54               }
 | 
| 
bsw/jbe@1309
 | 
    55               for i, entry in ipairs(entries) do
 | 
| 
bsw/jbe@1309
 | 
    56                 ui.tag{
 | 
| 
bsw/jbe@1309
 | 
    57                   tag = "tr",
 | 
| 
bsw/jbe@1309
 | 
    58                   content = function()
 | 
| 
bsw/jbe@1309
 | 
    59                     ui.tag{
 | 
| 
bsw/jbe@1309
 | 
    60                       tag = "td",
 | 
| 
bsw/jbe@1309
 | 
    61                       content = entry.name
 | 
| 
bsw/jbe@1309
 | 
    62                     }
 | 
| 
bsw/jbe@1309
 | 
    63                     ui.tag{
 | 
| 
bsw/jbe@1309
 | 
    64                       tag = "td",
 | 
| 
bsw/jbe@1309
 | 
    65                       content = entry.active and _'activated' or _'deactivated',
 | 
| 
bsw/jbe@1309
 | 
    66                     }
 | 
| 
bsw/jbe@1309
 | 
    67                     ui.tag{
 | 
| 
bsw/jbe@1309
 | 
    68                       tag = "td",
 | 
| 
bsw/jbe@1309
 | 
    69                       content = format.timestamp(entry["until"])
 | 
| 
bsw/jbe@1309
 | 
    70                     }
 | 
| 
bsw/jbe@1309
 | 
    71                   end
 | 
| 
bsw/jbe@1309
 | 
    72                 }
 | 
| 
bsw/jbe@1309
 | 
    73               end
 | 
| 
bsw@1045
 | 
    74             end
 | 
| 
bsw@77
 | 
    75           }
 | 
| 
bsw@9
 | 
    76         end
 | 
| 
bsw/jbe@1309
 | 
    77         slot.put("<br />")
 | 
| 
bsw/jbe@1309
 | 
    78         ui.container{
 | 
| 
bsw/jbe@1309
 | 
    79           content = _("This member account has been created at #{created}", { created = format.timestamp(member.activated)})
 | 
| 
bsw/jbe@1309
 | 
    80         }
 | 
| 
bsw/jbe@1309
 | 
    81         
 | 
| 
bsw/jbe@1309
 | 
    82       end}
 | 
| 
bsw/jbe@1309
 | 
    83     end}
 | 
| 
bsw/jbe@1309
 | 
    84   end }
 | 
| 
bsw/jbe@1309
 | 
    85   ui.cell_sidebar{ content = function()
 | 
| 
bsw/jbe@1309
 | 
    86     execute.view {
 | 
| 
bsw/jbe@1309
 | 
    87       module = "member", view = "_sidebar_whatcanido", params = {
 | 
| 
bsw/jbe@1309
 | 
    88         member = member
 | 
| 
bsw@77
 | 
    89       }
 | 
| 
bsw@1045
 | 
    90     }
 | 
| 
bsw/jbe@1309
 | 
    91   end }
 | 
| 
bsw@1045
 | 
    92 
 | 
| 
bsw/jbe@1309
 | 
    93 end }
 |