liquid_feedback_frontend
changeset 16:559c6be0e1e9
"Vote later" feature; Refactored interest box
author | bsw |
---|---|
date | Tue Feb 02 00:10:17 2010 +0100 (2010-02-02) |
parents | a3ac899559de |
children | 76a83a88367a |
files | app/main/interest/_action/update_voting_requested.lua app/main/interest/_show_box.lua app/main/issue/_show_head.lua app/main/issue/_show_vote_later_box.lua app/main/issue/show.lua locale/translations.de.lua static/icons/16/clock_play.png static/style.css |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/app/main/interest/_action/update_voting_requested.lua Tue Feb 02 00:10:17 2010 +0100 1.3 @@ -0,0 +1,23 @@ 1.4 +local issue_id = assert(param.get("issue_id", atom.integer), "no issue id given") 1.5 + 1.6 +local interest = Interest:by_pk(issue_id, app.session.member.id) 1.7 + 1.8 +local issue = Issue:new_selector():add_where{ "id = ?", issue_id }:for_share():single_object_mode():exec() 1.9 + 1.10 +if issue.closed then 1.11 + slot.put_into("error", _"This issue is already closed.") 1.12 + return false 1.13 +elseif issue.half_frozen then 1.14 + slot.put_into("error", _"This issue is already frozen.") 1.15 + return false 1.16 +end 1.17 + 1.18 +interest.voting_requested = param.get("voting_requested", atom.boolean) 1.19 + 1.20 +if interest.voting_requested == true then 1.21 + error("not implemented yet") 1.22 +end 1.23 + 1.24 +interest:save() 1.25 + 1.26 +slot.put_into("notice", _"Voting request updated")
2.1 --- a/app/main/interest/_show_box.lua Sun Jan 31 22:34:45 2010 +0100 2.2 +++ b/app/main/interest/_show_box.lua Tue Feb 02 00:10:17 2010 +0100 2.3 @@ -77,4 +77,17 @@ 2.4 end 2.5 } 2.6 end) 2.7 +else 2.8 + if not issue.closed and not issue.fully_frozen then 2.9 + ui.link{ 2.10 + content = function() 2.11 + ui.image{ static = "icons/16/user_add.png" } 2.12 + slot.put(_"Add my interest") 2.13 + end, 2.14 + module = "interest", 2.15 + action = "update", 2.16 + params = { issue_id = issue.id }, 2.17 + routing = { default = { mode = "redirect", module = "issue", view = "show", id = issue.id } } 2.18 + } 2.19 + end 2.20 end 2.21 \ No newline at end of file
3.1 --- a/app/main/issue/_show_head.lua Sun Jan 31 22:34:45 2010 +0100 3.2 +++ b/app/main/issue/_show_head.lua Tue Feb 02 00:10:17 2010 +0100 3.3 @@ -40,22 +40,6 @@ 3.4 view = "_show_box", 3.5 params = { issue = issue } 3.6 } 3.7 - -- TODO performance 3.8 - local interest = Interest:by_pk(issue.id, app.session.member.id) 3.9 - if not issue.closed and not issue.fully_frozen then 3.10 - if not interest then 3.11 - ui.link{ 3.12 - content = function() 3.13 - ui.image{ static = "icons/16/user_add.png" } 3.14 - slot.put(_"Add my interest") 3.15 - end, 3.16 - module = "interest", 3.17 - action = "update", 3.18 - params = { issue_id = issue.id }, 3.19 - routing = { default = { mode = "redirect", module = "issue", view = "show", id = issue.id } } 3.20 - } 3.21 - end 3.22 - end 3.23 3.24 if not issue.closed then 3.25 execute.view{ 3.26 @@ -65,17 +49,11 @@ 3.27 } 3.28 end 3.29 3.30 ---[[ 3.31 - if issue.state == "accepted" then 3.32 - -- TODO 3.33 - ui.link{ 3.34 - content = function() 3.35 - ui.image{ static = "icons/16/time.png" } 3.36 - slot.put(_"Vote now/later") 3.37 - end, 3.38 - } 3.39 - end 3.40 ---]] 3.41 + execute.view{ 3.42 + module = "issue", 3.43 + view = "_show_vote_later_box", 3.44 + params = { issue = issue } 3.45 + } 3.46 3.47 if config.issue_discussion_url_func then 3.48 local url = config.issue_discussion_url_func(issue)
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 4.2 +++ b/app/main/issue/_show_vote_later_box.lua Tue Feb 02 00:10:17 2010 +0100 4.3 @@ -0,0 +1,79 @@ 4.4 +local issue = param.get("issue", "table") 4.5 + 4.6 + 4.7 +if issue.closed and issue.half_frozen then 4.8 + return 4.9 +end 4.10 + 4.11 +local interest = Interest:by_pk(issue.id, app.session.member.id) 4.12 + 4.13 +if not interest then 4.14 + return 4.15 +end 4.16 + 4.17 +if interest.voting_requested ~= nil then 4.18 + slot.select("actions", function() 4.19 + 4.20 + ui.container{ 4.21 + attr = { class = "voting_requested vote_info"}, 4.22 + content = function() 4.23 + ui.container{ 4.24 + attr = { 4.25 + class = "head head_active", 4.26 + onclick = "document.getElementById('voting_requested_content').style.display = 'block';" 4.27 + }, 4.28 + content = function() 4.29 + if interest.voting_requested == false then 4.30 + ui.image{ 4.31 + static = "icons/16/clock_play.png" 4.32 + } 4.33 + slot.put(_"You want to vote later") 4.34 + ui.image{ 4.35 + static = "icons/16/dropdown.png" 4.36 + } 4.37 + end 4.38 + end 4.39 + } 4.40 + ui.container{ 4.41 + attr = { class = "content", id = "voting_requested_content" }, 4.42 + content = function() 4.43 + ui.container{ 4.44 + attr = { 4.45 + class = "close", 4.46 + style = "cursor: pointer;", 4.47 + onclick = "document.getElementById('voting_requested_content').style.display = 'none';" 4.48 + }, 4.49 + content = function() 4.50 + ui.image{ static = "icons/16/cross.png" } 4.51 + end 4.52 + } 4.53 + ui.link{ 4.54 + content = _"Remove my request to vote later", 4.55 + module = "interest", 4.56 + action = "update_voting_requested", 4.57 + params = { issue_id = issue.id, voting_requested = nil }, 4.58 + routing = { default = { mode = "redirect", module = "issue", view = "show", id = issue.id } } 4.59 + } 4.60 + slot.put("<br />") 4.61 + end 4.62 + } 4.63 + end 4.64 + } 4.65 + end) 4.66 +else 4.67 + if not issue.closed and not issue.half_frozen then 4.68 + ui.link{ 4.69 + content = function() 4.70 + ui.image{ static = "icons/16/clock_play.png" } 4.71 + slot.put(_"Vote later") 4.72 + end, 4.73 + module = "interest", 4.74 + action = "update_voting_requested", 4.75 + params = { 4.76 + issue_id = issue.id, 4.77 + voting_requested = false 4.78 + }, 4.79 + routing = { default = { mode = "redirect", module = "issue", view = "show", id = issue.id } } 4.80 + } 4.81 + end 4.82 +end 4.83 \ No newline at end of file
5.1 --- a/app/main/issue/show.lua Sun Jan 31 22:34:45 2010 +0100 5.2 +++ b/app/main/issue/show.lua Tue Feb 02 00:10:17 2010 +0100 5.3 @@ -8,6 +8,12 @@ 5.4 5.5 util.help("issue.show") 5.6 5.7 +local voting_requested_percentage = 0 5.8 +if issue.vote_later and issue.population and issue.population > 0 then 5.9 + voting_requested_percentage = math.ceil(issue.vote_later / issue.population * 100) 5.10 +end 5.11 +local voting_requested_string = "(" .. tostring(voting_requested_percentage) .. "%)" 5.12 + 5.13 ui.tabs{ 5.14 { 5.15 name = "initiatives", 5.16 @@ -36,18 +42,6 @@ 5.17 end 5.18 end 5.19 }, 5.20 ---[[ { 5.21 - name = "voting_requests", 5.22 - label = _"Voting requests", 5.23 - content = function() 5.24 - execute.view{ 5.25 - module = "issue_voting_request", 5.26 - view = "_list", 5.27 - params = { issue = issue } 5.28 - } 5.29 - end 5.30 - }, 5.31 ---]] 5.32 { 5.33 name = "interested_members", 5.34 label = _"Interested members", 5.35 @@ -77,6 +71,22 @@ 5.36 end 5.37 }, 5.38 { 5.39 + name = "voting_requests", 5.40 + label = _"Vote later requests" .. " " .. voting_requested_string, 5.41 + content = function() 5.42 + execute.view{ 5.43 + module = "member", 5.44 + view = "_list", 5.45 + params = { 5.46 + issue = issue, 5.47 + members_selector = issue:get_reference_selector("interested_members_snapshot") 5.48 + :join("issue", nil, "issue.id = direct_interest_snapshot.issue_id") 5.49 + :add_where("direct_interest_snapshot.voting_requested = false") 5.50 + } 5.51 + } 5.52 + end 5.53 + }, 5.54 + { 5.55 name = "details", 5.56 label = _"Details", 5.57 content = function()
6.1 --- a/locale/translations.de.lua Sun Jan 31 22:34:45 2010 +0100 6.2 +++ b/locale/translations.de.lua Tue Feb 02 00:10:17 2010 +0100 6.3 @@ -103,7 +103,6 @@ 6.4 ["Edit initiative"] = "Initiative bearbeiten"; 6.5 ["Edit my page"] = "Meine Seite bearbeiten"; 6.6 ["Edit my profile"] = "Mein Profil bearbeiten"; 6.7 -["Edit timeline filter"] = "Zeitachsen-Filter bearbeiten"; 6.8 ["Email address"] = "E-Mail-Adresse"; 6.9 ["Email address confirmation"] = "Bestätigung der E-Mail-Adresse"; 6.10 ["Email address is confirmed now"] = "E-Mail-Adresse ist jetzt bestätigt"; 6.11 @@ -302,11 +301,9 @@ 6.12 ["Remove initiator from initiative"] = "Initiator von der Initiative entfernen"; 6.13 ["Remove my interest"] = "Interesse abmelden"; 6.14 ["Remove my membership"] = "Mitgliedschaft aufgeben"; 6.15 +["Remove my request to vote later"] = "Meinen Wunsch später abzustimmen zurückziehen"; 6.16 ["Remove my support from this initiative"] = "Meine Unterstützung der Initiative entziehen"; 6.17 -["Rename"] = "Umbenennen"; 6.18 -["Rename filter"] = "Filter umbenennen"; 6.19 ["Repeat new password"] = "Neues Kennwort wiederholen"; 6.20 -["Replace filter"] = "Filter ersetzen"; 6.21 ["Request password reset link"] = "Link zum Rücksetzen des Kennworts anfordern"; 6.22 ["Reset code"] = "Rücksetzcode"; 6.23 ["Reset code is invalid!"] = "Rücksetzcode ist ungültig"; 6.24 @@ -317,7 +314,6 @@ 6.25 ["Revoked at"] = "Zurückgezogen am/um"; 6.26 ["Saturday"] = "Samstag"; 6.27 ["Save"] = "Speichern"; 6.28 -["Save as new filter"] = "Als neuen Filter speichern"; 6.29 ["Save current filter"] = "Aktuellen Filter speichern"; 6.30 ["Save timeline filters"] = "Zeitachsen-Filter speichern"; 6.31 ["Saved as contact"] = "Als Kontakt gespeichert"; 6.32 @@ -326,7 +322,6 @@ 6.33 ["Search issues"] = "Suche Themen"; 6.34 ["Search members"] = "Suche Mitglieder"; 6.35 ["Search results for: '#{search}'"] = "Suchergebnisse für: '#{search}'"; 6.36 -["Select filter to replace"] = "Wähle zu ersetzenden Filter"; 6.37 ["Set URL"] = "URL setzen"; 6.38 ["Set area delegation"] = "Delegation für Themengebiet festlegen"; 6.39 ["Set autoreject"] = "Auto-Ablehnen anschalten"; 6.40 @@ -410,8 +405,8 @@ 6.41 ["Verification time"] = "Zeit für die Überprüfung"; 6.42 ["Version"] = "Version"; 6.43 ["Vote later"] = "Später abstimmen"; 6.44 +["Vote later requests"] = "Später abstimmen"; 6.45 ["Vote now"] = "Jetzt abstimmen"; 6.46 -["Vote now/later"] = "Jetzt/später abstimmen"; 6.47 ["Voted"] = "Abgestimmt"; 6.48 ["Voted no"] = "Mit Nein gestimmt"; 6.49 ["Voted proposal"] = "Abgestimmte Vorlage"; 6.50 @@ -422,7 +417,7 @@ 6.51 ["Voting for this issue is currently running!"] = "Über dieses Thema wird gerade abgestimmt!"; 6.52 ["Voting has not started yet."] = "Die Abstimmung hat noch nicht begonnen."; 6.53 ["Voting proposal"] = "Abstimmungsvorlage"; 6.54 -["Voting requests"] = "Abstimmanträge"; 6.55 +["Voting request updated"] = "Abstimmungswunsch aktualisiert"; 6.56 ["Voting started"] = "Abstimmung begonnen"; 6.57 ["Voting time"] = "Zeit für die Abstimmung"; 6.58 ["Website"] = "Webseite"; 6.59 @@ -447,6 +442,7 @@ 6.60 ["You have to accept the terms of use to complete registration."] = "Du musst die Nutzungsbedingungen akzeptieren um die Registration abzuschliessen."; 6.61 ["You have to mark 'Are you sure' to revoke!"] = "Zum Zurückziehen musst Du 'Sicher?' auswählen"; 6.62 ["You need to be logged in, to use this system."] = "Du musst eingeloggt sein, um das System zu benutzen"; 6.63 +["You want to vote later"] = "Du willst später abstimmen"; 6.64 ["You've successfully registered and you can login now with your login and password!"] = "Du hast Dich erfolgreich registriert und kannst Dich jetzt mit Deinen Benutzernamen und Kennwort anmelden!"; 6.65 ["Your are interested"] = "Du bist interessiert"; 6.66 ["Your are potential supporter"] = "Du bist potentieller Unterstützer";
7.1 Binary file static/icons/16/clock_play.png has changed
8.1 --- a/static/style.css Sun Jan 31 22:34:45 2010 +0100 8.2 +++ b/static/style.css Tue Feb 02 00:10:17 2010 +0100 8.3 @@ -260,14 +260,16 @@ 8.4 8.5 .interest, 8.6 .slot_support, 8.7 -.delegation { 8.8 +.delegation, 8.9 +.voting_requested { 8.10 float: left; 8.11 position: relative; 8.12 } 8.13 8.14 .interest img, 8.15 .slot_support img, 8.16 -.delegation img { 8.17 +.delegation img, 8.18 +.voting_requested img { 8.19 padding-left: 0.2em; 8.20 padding-right: 0.2em; 8.21 } 8.22 @@ -297,6 +299,11 @@ 8.23 border: 1px solid #88b; 8.24 } 8.25 8.26 +.voting_requested .head_active { 8.27 + background-color: #fdd; 8.28 + border: 1px solid #b77; 8.29 +} 8.30 + 8.31 .vote_info .close { 8.32 position: absolute; 8.33 top: 0;