From e95f5a0881559961a2b2b5fd5e70bf980f98a449 Mon Sep 17 00:00:00 2001 From: Benjamin Kellermann Date: Tue, 23 Feb 2010 16:26:59 +0100 Subject: redesign of invite participants --- poll.rb | 105 ++++++++++++++++++++++++++++++++-------------------------------- 1 file changed, 53 insertions(+), 52 deletions(-) (limited to 'poll.rb') diff --git a/poll.rb b/poll.rb index 5f288ca..8cb509f 100644 --- a/poll.rb +++ b/poll.rb @@ -63,7 +63,13 @@ class Poll end end - # showparticipation \in {true, false, "invite"} + def userstring(participant,link) + ret = "" + ret += "" if link + ret += participant + ret += " #{EDIT}" if link + ret + end def to_html(edituser = "", showparticipation = true) ret = "\n" @@ -75,9 +81,7 @@ class Poll else ret += "\n" ret += "\n" @head.columns.each{|column| klasse = poll[column] @@ -143,56 +147,63 @@ class Poll ret end - def invite_to_html + def invite_to_html(edituser) invitestr = _("Invite") namestr = _("Name") - deletestr = ("Delete") ret = < +
" - ret += "" if showparticipation - ret += participant - ret += " #{EDIT}" if showparticipation + ret += userstring(participant,showparticipation) ret += "
- HEAD @data.keys.sort.each{|participant| - ret += < - -ROW has_voted = false @head.columns.each{|column| has_voted = true unless @data[participant][column].nil? } - unless has_voted - ret += < -
-
- - -
- - -ROW + + ret += "
" + if edituser == participant + ret += add_participant_input(edituser) + ret += save_input(edituser,invitestr) + else + ret += "" end ret += "" - } - ret += < - - -
#{namestr}
#{participant}
" + ret += userstring(participant,!has_voted) + ret += "
-
-
- - -
-
-
-INVITE + } + unless @data.keys.include?(edituser) + ret += "" + ret += add_participant_input(edituser) + ret += save_input(edituser,invitestr) + ret += "" + end + ret += "" ret end + def add_participant_input(edituser) + return < + + + +END + end + def save_input(edituser, savestring) + ret = "" + if @data.include?(edituser) + ret += "" + ret += "
" + else + ret += "" + end + ret += "\n" + end def participate_to_html(edituser) checked = {} @@ -203,14 +214,11 @@ INVITE @head.columns.each{|k| checked[k] = NOVAL} end ret = "\n" + ret += "\n" - ret += " - - " - ret += "\n" + + ret += add_participant_input(edituser) + @head.columns.each{|column| ret += "" [[YES, YESVAL],[NO, NOVAL],[MAYBE, MAYBEVAL]].each{|valhuman, valbinary| @@ -231,14 +239,7 @@ TR } ret += "
" } - ret += "" - if @data.include?(edituser) - ret += "" - ret += "
" - else - ret += "" - end - ret += "\n" + ret += save_input(edituser, _("Save")) ret += "\n" ret += "\n" -- cgit v1.2.3