# HG changeset patch # User bsw # Date 1265065817 -3600 # Node ID 559c6be0e1e956dff05cb2933e42aabb671a101b # Parent a3ac899559dec57becf3b3ecb804b1a98013833b "Vote later" feature; Refactored interest box diff -r a3ac899559de -r 559c6be0e1e9 app/main/interest/_action/update_voting_requested.lua --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/main/interest/_action/update_voting_requested.lua Tue Feb 02 00:10:17 2010 +0100 @@ -0,0 +1,23 @@ +local issue_id = assert(param.get("issue_id", atom.integer), "no issue id given") + +local interest = Interest:by_pk(issue_id, app.session.member.id) + +local issue = Issue:new_selector():add_where{ "id = ?", issue_id }:for_share():single_object_mode():exec() + +if issue.closed then + slot.put_into("error", _"This issue is already closed.") + return false +elseif issue.half_frozen then + slot.put_into("error", _"This issue is already frozen.") + return false +end + +interest.voting_requested = param.get("voting_requested", atom.boolean) + +if interest.voting_requested == true then + error("not implemented yet") +end + +interest:save() + +slot.put_into("notice", _"Voting request updated") diff -r a3ac899559de -r 559c6be0e1e9 app/main/interest/_show_box.lua --- a/app/main/interest/_show_box.lua Sun Jan 31 22:34:45 2010 +0100 +++ b/app/main/interest/_show_box.lua Tue Feb 02 00:10:17 2010 +0100 @@ -77,4 +77,17 @@ end } end) +else + if not issue.closed and not issue.fully_frozen then + ui.link{ + content = function() + ui.image{ static = "icons/16/user_add.png" } + slot.put(_"Add my interest") + end, + module = "interest", + action = "update", + params = { issue_id = issue.id }, + routing = { default = { mode = "redirect", module = "issue", view = "show", id = issue.id } } + } + end end \ No newline at end of file diff -r a3ac899559de -r 559c6be0e1e9 app/main/issue/_show_head.lua --- a/app/main/issue/_show_head.lua Sun Jan 31 22:34:45 2010 +0100 +++ b/app/main/issue/_show_head.lua Tue Feb 02 00:10:17 2010 +0100 @@ -40,22 +40,6 @@ view = "_show_box", params = { issue = issue } } - -- TODO performance - local interest = Interest:by_pk(issue.id, app.session.member.id) - if not issue.closed and not issue.fully_frozen then - if not interest then - ui.link{ - content = function() - ui.image{ static = "icons/16/user_add.png" } - slot.put(_"Add my interest") - end, - module = "interest", - action = "update", - params = { issue_id = issue.id }, - routing = { default = { mode = "redirect", module = "issue", view = "show", id = issue.id } } - } - end - end if not issue.closed then execute.view{ @@ -65,17 +49,11 @@ } end ---[[ - if issue.state == "accepted" then - -- TODO - ui.link{ - content = function() - ui.image{ static = "icons/16/time.png" } - slot.put(_"Vote now/later") - end, - } - end ---]] + execute.view{ + module = "issue", + view = "_show_vote_later_box", + params = { issue = issue } + } if config.issue_discussion_url_func then local url = config.issue_discussion_url_func(issue) diff -r a3ac899559de -r 559c6be0e1e9 app/main/issue/_show_vote_later_box.lua --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/main/issue/_show_vote_later_box.lua Tue Feb 02 00:10:17 2010 +0100 @@ -0,0 +1,79 @@ +local issue = param.get("issue", "table") + + +if issue.closed and issue.half_frozen then + return +end + +local interest = Interest:by_pk(issue.id, app.session.member.id) + +if not interest then + return +end + +if interest.voting_requested ~= nil then + slot.select("actions", function() + + ui.container{ + attr = { class = "voting_requested vote_info"}, + content = function() + ui.container{ + attr = { + class = "head head_active", + onclick = "document.getElementById('voting_requested_content').style.display = 'block';" + }, + content = function() + if interest.voting_requested == false then + ui.image{ + static = "icons/16/clock_play.png" + } + slot.put(_"You want to vote later") + ui.image{ + static = "icons/16/dropdown.png" + } + end + end + } + ui.container{ + attr = { class = "content", id = "voting_requested_content" }, + content = function() + ui.container{ + attr = { + class = "close", + style = "cursor: pointer;", + onclick = "document.getElementById('voting_requested_content').style.display = 'none';" + }, + content = function() + ui.image{ static = "icons/16/cross.png" } + end + } + ui.link{ + content = _"Remove my request to vote later", + module = "interest", + action = "update_voting_requested", + params = { issue_id = issue.id, voting_requested = nil }, + routing = { default = { mode = "redirect", module = "issue", view = "show", id = issue.id } } + } + slot.put("
") + end + } + end + } + end) +else + if not issue.closed and not issue.half_frozen then + ui.link{ + content = function() + ui.image{ static = "icons/16/clock_play.png" } + slot.put(_"Vote later") + end, + module = "interest", + action = "update_voting_requested", + params = { + issue_id = issue.id, + voting_requested = false + }, + routing = { default = { mode = "redirect", module = "issue", view = "show", id = issue.id } } + } + end +end \ No newline at end of file diff -r a3ac899559de -r 559c6be0e1e9 app/main/issue/show.lua --- a/app/main/issue/show.lua Sun Jan 31 22:34:45 2010 +0100 +++ b/app/main/issue/show.lua Tue Feb 02 00:10:17 2010 +0100 @@ -8,6 +8,12 @@ util.help("issue.show") +local voting_requested_percentage = 0 +if issue.vote_later and issue.population and issue.population > 0 then + voting_requested_percentage = math.ceil(issue.vote_later / issue.population * 100) +end +local voting_requested_string = "(" .. tostring(voting_requested_percentage) .. "%)" + ui.tabs{ { name = "initiatives", @@ -36,18 +42,6 @@ end end }, ---[[ { - name = "voting_requests", - label = _"Voting requests", - content = function() - execute.view{ - module = "issue_voting_request", - view = "_list", - params = { issue = issue } - } - end - }, ---]] { name = "interested_members", label = _"Interested members", @@ -77,6 +71,22 @@ end }, { + name = "voting_requests", + label = _"Vote later requests" .. " " .. voting_requested_string, + content = function() + execute.view{ + module = "member", + view = "_list", + params = { + issue = issue, + members_selector = issue:get_reference_selector("interested_members_snapshot") + :join("issue", nil, "issue.id = direct_interest_snapshot.issue_id") + :add_where("direct_interest_snapshot.voting_requested = false") + } + } + end + }, + { name = "details", label = _"Details", content = function() diff -r a3ac899559de -r 559c6be0e1e9 locale/translations.de.lua --- a/locale/translations.de.lua Sun Jan 31 22:34:45 2010 +0100 +++ b/locale/translations.de.lua Tue Feb 02 00:10:17 2010 +0100 @@ -103,7 +103,6 @@ ["Edit initiative"] = "Initiative bearbeiten"; ["Edit my page"] = "Meine Seite bearbeiten"; ["Edit my profile"] = "Mein Profil bearbeiten"; -["Edit timeline filter"] = "Zeitachsen-Filter bearbeiten"; ["Email address"] = "E-Mail-Adresse"; ["Email address confirmation"] = "Bestätigung der E-Mail-Adresse"; ["Email address is confirmed now"] = "E-Mail-Adresse ist jetzt bestätigt"; @@ -302,11 +301,9 @@ ["Remove initiator from initiative"] = "Initiator von der Initiative entfernen"; ["Remove my interest"] = "Interesse abmelden"; ["Remove my membership"] = "Mitgliedschaft aufgeben"; +["Remove my request to vote later"] = "Meinen Wunsch später abzustimmen zurückziehen"; ["Remove my support from this initiative"] = "Meine Unterstützung der Initiative entziehen"; -["Rename"] = "Umbenennen"; -["Rename filter"] = "Filter umbenennen"; ["Repeat new password"] = "Neues Kennwort wiederholen"; -["Replace filter"] = "Filter ersetzen"; ["Request password reset link"] = "Link zum Rücksetzen des Kennworts anfordern"; ["Reset code"] = "Rücksetzcode"; ["Reset code is invalid!"] = "Rücksetzcode ist ungültig"; @@ -317,7 +314,6 @@ ["Revoked at"] = "Zurückgezogen am/um"; ["Saturday"] = "Samstag"; ["Save"] = "Speichern"; -["Save as new filter"] = "Als neuen Filter speichern"; ["Save current filter"] = "Aktuellen Filter speichern"; ["Save timeline filters"] = "Zeitachsen-Filter speichern"; ["Saved as contact"] = "Als Kontakt gespeichert"; @@ -326,7 +322,6 @@ ["Search issues"] = "Suche Themen"; ["Search members"] = "Suche Mitglieder"; ["Search results for: '#{search}'"] = "Suchergebnisse für: '#{search}'"; -["Select filter to replace"] = "Wähle zu ersetzenden Filter"; ["Set URL"] = "URL setzen"; ["Set area delegation"] = "Delegation für Themengebiet festlegen"; ["Set autoreject"] = "Auto-Ablehnen anschalten"; @@ -410,8 +405,8 @@ ["Verification time"] = "Zeit für die Überprüfung"; ["Version"] = "Version"; ["Vote later"] = "Später abstimmen"; +["Vote later requests"] = "Später abstimmen"; ["Vote now"] = "Jetzt abstimmen"; -["Vote now/later"] = "Jetzt/später abstimmen"; ["Voted"] = "Abgestimmt"; ["Voted no"] = "Mit Nein gestimmt"; ["Voted proposal"] = "Abgestimmte Vorlage"; @@ -422,7 +417,7 @@ ["Voting for this issue is currently running!"] = "Über dieses Thema wird gerade abgestimmt!"; ["Voting has not started yet."] = "Die Abstimmung hat noch nicht begonnen."; ["Voting proposal"] = "Abstimmungsvorlage"; -["Voting requests"] = "Abstimmanträge"; +["Voting request updated"] = "Abstimmungswunsch aktualisiert"; ["Voting started"] = "Abstimmung begonnen"; ["Voting time"] = "Zeit für die Abstimmung"; ["Website"] = "Webseite"; @@ -447,6 +442,7 @@ ["You have to accept the terms of use to complete registration."] = "Du musst die Nutzungsbedingungen akzeptieren um die Registration abzuschliessen."; ["You have to mark 'Are you sure' to revoke!"] = "Zum Zurückziehen musst Du 'Sicher?' auswählen"; ["You need to be logged in, to use this system."] = "Du musst eingeloggt sein, um das System zu benutzen"; +["You want to vote later"] = "Du willst später abstimmen"; ["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!"; ["Your are interested"] = "Du bist interessiert"; ["Your are potential supporter"] = "Du bist potentieller Unterstützer"; diff -r a3ac899559de -r 559c6be0e1e9 static/icons/16/clock_play.png Binary file static/icons/16/clock_play.png has changed diff -r a3ac899559de -r 559c6be0e1e9 static/style.css --- a/static/style.css Sun Jan 31 22:34:45 2010 +0100 +++ b/static/style.css Tue Feb 02 00:10:17 2010 +0100 @@ -260,14 +260,16 @@ .interest, .slot_support, -.delegation { +.delegation, +.voting_requested { float: left; position: relative; } .interest img, .slot_support img, -.delegation img { +.delegation img, +.voting_requested img { padding-left: 0.2em; padding-right: 0.2em; } @@ -297,6 +299,11 @@ border: 1px solid #88b; } +.voting_requested .head_active { + background-color: #fdd; + border: 1px solid #b77; +} + .vote_info .close { position: absolute; top: 0;