liquid_feedback_frontend

changeset 426:87dd4f128206

Add support to ignore member for events
author bsw
date Sat Mar 10 18:26:50 2012 +0100 (2012-03-10)
parents 0a49a5268171
children a6c164f0c193
files app/main/member/_action/update_ignore_member.lua app/main/member/show.lua locale/translations.de.lua
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/app/main/member/_action/update_ignore_member.lua	Sat Mar 10 18:26:50 2012 +0100
     1.3 @@ -0,0 +1,20 @@
     1.4 +local member = app.session.member
     1.5 +local other_member = Member:by_id(param.get_id())
     1.6 +
     1.7 +local ignore_member = IgnoredMember:by_pk(member.id, other_member.id)
     1.8 +
     1.9 +if param.get("delete", atom.boolean) then
    1.10 +  if ignore_member then
    1.11 +    ignore_member:destroy()
    1.12 +  end
    1.13 +  return
    1.14 +end
    1.15 +
    1.16 +if not ignore_member then
    1.17 +  ignore_member = IgnoredMember:new()
    1.18 +  ignore_member.member_id = member.id
    1.19 +  ignore_member.other_member_id = other_member.id
    1.20 +  ignore_member:save()
    1.21 +end
    1.22 +
    1.23 +
     2.1 --- a/app/main/member/show.lua	Sat Mar 10 18:15:51 2012 +0100
     2.2 +++ b/app/main/member/show.lua	Sat Mar 10 18:26:50 2012 +0100
     2.3 @@ -21,15 +21,24 @@
     2.4  slot.put_into("title", encode.html(_"Member '#{member}'":gsub("#{member}", member.name)))
     2.5  
     2.6  slot.select("actions", function()
     2.7 +  ui.link{
     2.8 +    content = function()
     2.9 +      ui.image{ static = "icons/16/clock_edit.png" }
    2.10 +      slot.put(encode.html(_"Show member history"))
    2.11 +    end,
    2.12 +    module  = "member",
    2.13 +    view    = "history",
    2.14 +    id      = member.id
    2.15 +  }
    2.16 +  if not member.activated then
    2.17 +    ui.tag{
    2.18 +      tag = "div",
    2.19 +      attr = { class = "interest deactivated_member_info" },
    2.20 +      content = _"This member is deactivated."
    2.21 +    }
    2.22 +    slot.put(" ")
    2.23 +  end
    2.24    if not (member.id == app.session.member.id) then
    2.25 -if not member.activated then
    2.26 -  ui.tag{
    2.27 -    tag = "div",
    2.28 -    attr = { class = "interest deactivated_member_info" },
    2.29 -    content = _"This member is deactivated."
    2.30 -  }
    2.31 -  slot.put(" ")
    2.32 -end
    2.33      --TODO performance
    2.34      local contact = Contact:by_pk(app.session.member.id, member.id)
    2.35      if contact then
    2.36 @@ -72,18 +81,46 @@
    2.37        }
    2.38      end
    2.39    end
    2.40 -end)
    2.41 -
    2.42 -slot.select("actions", function()
    2.43 -  ui.link{
    2.44 -    content = function()
    2.45 -      ui.image{ static = "icons/16/clock_edit.png" }
    2.46 -      slot.put(encode.html(_"Show member history"))
    2.47 -    end,
    2.48 -    module  = "member",
    2.49 -    view    = "history",
    2.50 -    id      = member.id
    2.51 -  }
    2.52 +  local ignored_member = IgnoredMember:by_pk(app.session.member.id, member.id)
    2.53 +  if ignored_member then
    2.54 +    ui.container{
    2.55 +      attr = { class = "interest" },
    2.56 +      content = _"You have ignored this member"
    2.57 +    }
    2.58 +    ui.link{
    2.59 +      text   = _"Stop ignoring member",
    2.60 +      module = "member",
    2.61 +      action = "update_ignore_member",
    2.62 +      id     = member.id,
    2.63 +      params = { delete = true },
    2.64 +      routing = {
    2.65 +        default = {
    2.66 +          mode = "redirect",
    2.67 +          module = request.get_module(),
    2.68 +          view = request.get_view(),
    2.69 +          id = param.get_id_cgi(),
    2.70 +          params = param.get_all_cgi()
    2.71 +        }
    2.72 +      }
    2.73 +    }
    2.74 +  elseif member.activated then
    2.75 +    ui.link{
    2.76 +      attr = { class = "interest" },
    2.77 +      text    = _"Ignore member",
    2.78 +      module  = "member",
    2.79 +      action  = "update_ignore_member",
    2.80 +      id      = member.id,
    2.81 +      routing = {
    2.82 +        default = {
    2.83 +          mode = "redirect",
    2.84 +          module = request.get_module(),
    2.85 +          view = request.get_view(),
    2.86 +          id = param.get_id_cgi(),
    2.87 +          params = param.get_all_cgi()
    2.88 +        }
    2.89 +      }
    2.90 +    }
    2.91 +  end
    2.92  end)
    2.93  
    2.94  util.help("member.show", _"Member page")
     3.1 --- a/locale/translations.de.lua	Sat Mar 10 18:15:51 2012 +0100
     3.2 +++ b/locale/translations.de.lua	Sat Mar 10 18:26:50 2012 +0100
     3.3 @@ -242,6 +242,7 @@
     3.4  ["Identification"] = "Identifikation";
     3.5  ["If this link is not working, please open following url in your web browser:\n\n"] = "Sollte der Link nicht funktionieren, öffne bitte die folgenden URL in Deinem Web-Browser:\n\n";
     3.6  ["Ignore Areas"] = "Ignoriere Bereiche";
     3.7 +["Ignore member"] = "Mitglied ignorieren";
     3.8  ["Images"] = "Bilder";
     3.9  ["Incoming delegations"] = "Eingehende Delegationen";
    3.10  ["Index"] = "Positionsnummer";
    3.11 @@ -526,6 +527,7 @@
    3.12  ["Step 1/3: Invite code"] = "Step 1/3: Einladungs-Code";
    3.13  ["Step 2/3: Personal information"] = "Step 2/3: Persönliche Daten";
    3.14  ["Step 3/3: Terms of use and password"] = "Step 3/3: Nutzungsbedingungen und Kennwort";
    3.15 +["Stop ignoring member"] = "nicht mehr ignorieren";
    3.16  ["Strict direct majority"] = "Strenge direkte Mehrheit";
    3.17  ["Strict indirect majority"] = "Strenge indirekte Mehrheit";
    3.18  ["Stylesheet URL"] = "Stylesheet URL";
    3.19 @@ -647,6 +649,7 @@
    3.20  ["You didn't confirm your email address '#{email}'. You have received an email with an activation link."] = "Du hast die E-Mail-Adresse '#{email}' nicht bestätigt. Du hast hierzu eine E-Mail mit einem Aktivierungslink erhalten.";
    3.21  ["You didn't save any member as contact yet."] = "Du hast noch kein Mitglied als Kontakt gespeichert!";
    3.22  ["You didn't set the level of notifications you like to receive"] = "Du hast noch nicht ausgewählt, ob und welche Benachrichtigungen du erhalten möchtest.";
    3.23 +["You have ignored this member"] = "Du ignorierst dieses Mitglied";
    3.24  ["You have saved this member as contact"] = "Du hast das Mitglied als Kontakt gespeichert";
    3.25  ["You have saved this member as contact."] = "Du hast das Mitglied als Kontakt gespeichert.";
    3.26  ["You have to mark 'Are you sure' to revoke!"] = "Zum Zurückziehen musst Du 'Sicher?' auswählen";

Impressum / About Us