# HG changeset patch # User bsw # Date 1331400410 -3600 # Node ID 87dd4f128206574152c71571bad2699758b02173 # Parent 0a49a526817111cc1924c641ead392383771acad Add support to ignore member for events diff -r 0a49a5268171 -r 87dd4f128206 app/main/member/_action/update_ignore_member.lua --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/main/member/_action/update_ignore_member.lua Sat Mar 10 18:26:50 2012 +0100 @@ -0,0 +1,20 @@ +local member = app.session.member +local other_member = Member:by_id(param.get_id()) + +local ignore_member = IgnoredMember:by_pk(member.id, other_member.id) + +if param.get("delete", atom.boolean) then + if ignore_member then + ignore_member:destroy() + end + return +end + +if not ignore_member then + ignore_member = IgnoredMember:new() + ignore_member.member_id = member.id + ignore_member.other_member_id = other_member.id + ignore_member:save() +end + + diff -r 0a49a5268171 -r 87dd4f128206 app/main/member/show.lua --- a/app/main/member/show.lua Sat Mar 10 18:15:51 2012 +0100 +++ b/app/main/member/show.lua Sat Mar 10 18:26:50 2012 +0100 @@ -21,15 +21,24 @@ slot.put_into("title", encode.html(_"Member '#{member}'":gsub("#{member}", member.name))) slot.select("actions", function() + ui.link{ + content = function() + ui.image{ static = "icons/16/clock_edit.png" } + slot.put(encode.html(_"Show member history")) + end, + module = "member", + view = "history", + id = member.id + } + if not member.activated then + ui.tag{ + tag = "div", + attr = { class = "interest deactivated_member_info" }, + content = _"This member is deactivated." + } + slot.put(" ") + end if not (member.id == app.session.member.id) then -if not member.activated then - ui.tag{ - tag = "div", - attr = { class = "interest deactivated_member_info" }, - content = _"This member is deactivated." - } - slot.put(" ") -end --TODO performance local contact = Contact:by_pk(app.session.member.id, member.id) if contact then @@ -72,18 +81,46 @@ } end end -end) - -slot.select("actions", function() - ui.link{ - content = function() - ui.image{ static = "icons/16/clock_edit.png" } - slot.put(encode.html(_"Show member history")) - end, - module = "member", - view = "history", - id = member.id - } + local ignored_member = IgnoredMember:by_pk(app.session.member.id, member.id) + if ignored_member then + ui.container{ + attr = { class = "interest" }, + content = _"You have ignored this member" + } + ui.link{ + text = _"Stop ignoring member", + module = "member", + action = "update_ignore_member", + id = member.id, + params = { delete = true }, + routing = { + default = { + mode = "redirect", + module = request.get_module(), + view = request.get_view(), + id = param.get_id_cgi(), + params = param.get_all_cgi() + } + } + } + elseif member.activated then + ui.link{ + attr = { class = "interest" }, + text = _"Ignore member", + module = "member", + action = "update_ignore_member", + id = member.id, + routing = { + default = { + mode = "redirect", + module = request.get_module(), + view = request.get_view(), + id = param.get_id_cgi(), + params = param.get_all_cgi() + } + } + } + end end) util.help("member.show", _"Member page") diff -r 0a49a5268171 -r 87dd4f128206 locale/translations.de.lua --- a/locale/translations.de.lua Sat Mar 10 18:15:51 2012 +0100 +++ b/locale/translations.de.lua Sat Mar 10 18:26:50 2012 +0100 @@ -242,6 +242,7 @@ ["Identification"] = "Identifikation"; ["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"; ["Ignore Areas"] = "Ignoriere Bereiche"; +["Ignore member"] = "Mitglied ignorieren"; ["Images"] = "Bilder"; ["Incoming delegations"] = "Eingehende Delegationen"; ["Index"] = "Positionsnummer"; @@ -526,6 +527,7 @@ ["Step 1/3: Invite code"] = "Step 1/3: Einladungs-Code"; ["Step 2/3: Personal information"] = "Step 2/3: Persönliche Daten"; ["Step 3/3: Terms of use and password"] = "Step 3/3: Nutzungsbedingungen und Kennwort"; +["Stop ignoring member"] = "nicht mehr ignorieren"; ["Strict direct majority"] = "Strenge direkte Mehrheit"; ["Strict indirect majority"] = "Strenge indirekte Mehrheit"; ["Stylesheet URL"] = "Stylesheet URL"; @@ -647,6 +649,7 @@ ["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."; ["You didn't save any member as contact yet."] = "Du hast noch kein Mitglied als Kontakt gespeichert!"; ["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."; +["You have ignored this member"] = "Du ignorierst dieses Mitglied"; ["You have saved this member as contact"] = "Du hast das Mitglied als Kontakt gespeichert"; ["You have saved this member as contact."] = "Du hast das Mitglied als Kontakt gespeichert."; ["You have to mark 'Are you sure' to revoke!"] = "Zum Zurückziehen musst Du 'Sicher?' auswählen";