This is an automated email from the ASF dual-hosted git repository. curcuru pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/whimsy.git
commit f9b09ab67906f96642a4913cb50fe4aa21f2cabb Author: Shane Curcuru <[email protected]> AuthorDate: Thu May 2 08:56:15 2019 -0400 Revert "Select multiple attr must be either present or not at all" This reverts commit 77bbd9e77c5a833cf304591689c954d43e8ca591. --- lib/whimsy/asf/forms.rb | 8 +------ www/members/mentor-format.rb | 53 ------------------------------------------- www/members/mentor-update.cgi | 25 +++++--------------- 3 files changed, 7 insertions(+), 79 deletions(-) diff --git a/lib/whimsy/asf/forms.rb b/lib/whimsy/asf/forms.rb index e5f8a8d..5e54c3b 100644 --- a/lib/whimsy/asf/forms.rb +++ b/lib/whimsy/asf/forms.rb @@ -87,13 +87,7 @@ class Wunderbar::HtmlMarkup _label.control_label.col_sm_3 label, for: "#{name}" _div.col_sm_9 do _div.input_group do - args = { - name: "#{name}", id: "#{name}", aria_describedby: "#{aria_describedby}", required: required, readonly: readonly - } - if multiple - args['multiple'] = 'true' - end - _select.form_control args do + _select.form_control name: "#{name}", id: "#{name}", aria_describedby: "#{aria_describedby}", required: required, readonly: readonly do if ''.eql?(value) if ''.eql?(placeholder) _option '', value: '', selected: 'selected' diff --git a/www/members/mentor-format.rb b/www/members/mentor-format.rb index 924a8ec..29eee37 100644 --- a/www/members/mentor-format.rb +++ b/www/members/mentor-format.rb @@ -11,59 +11,6 @@ class MentorFormat ERRORS = 'errors' TIMEZONE = 'timezone' TZ = TZInfo::Timezone.all_country_zone_identifiers - PREFERS_TYPES = [ - 'email', - 'phone', - 'Slack', - 'irc', - 'Hangouts', - 'Facebook', - 'Skype', - 'other (text chat)', - 'other (video chat)' - ] - LANGUAGES = [ # Wikipedia top list by total speakers, plus EU - 'Arabic', - 'Bengali', - 'Bulgarian', - 'Chinese', - 'Croatian', - 'Czech', - 'Danish', - 'Dutch', - 'English', - 'Estonian', - 'Finnish', - 'French', - 'German', - 'Greek', - 'Hindi', - 'Hungarian', - 'Indonesean', - 'Irish', - 'Italian', - 'Japanese', - 'Korean', - 'Latvian', - 'Lithuanian', - 'Maltese', - 'Marathi', - 'Polish', - 'Portugese', - 'Punjabi', - 'Romanian', - 'Russian', - 'Slovak', - 'Slovene', - 'Spanish', - 'Swahili', - 'Swedish', - 'Tamil', - 'Telugu', - 'Thai', - 'Turkish', - 'Vietnamese' - ] # Read mapping of labels to fields def self.get_uimap(path) diff --git a/www/members/mentor-update.cgi b/www/members/mentor-update.cgi index 51b76c2..af80e33 100755 --- a/www/members/mentor-update.cgi +++ b/www/members/mentor-update.cgi @@ -45,20 +45,8 @@ def emit_form(apacheid, mdata, button_help, uimap) helptext: uimap[field][1] ) emit_mentor_input('availability', mdata, uimap, 'glyphicon-hourglass') - field = 'prefers' - _whimsy_forms_select(label: uimap[field][0], name: field, multiple: true, - value: (mdata[field] ? mdata[field] : ''), - options: MentorFormat::PREFERS_TYPES, - icon: 'glyphicon-ok-sign', iconlabel: 'ok-sign', - helptext: uimap[field][1] - ) - field = 'languages' - _whimsy_forms_select(label: uimap[field][0], name: field, multiple: true, - value: (mdata[field] ? mdata[field] : ''), - options: MentorFormat::LANGUAGES, - icon: 'glyphicon-globe', iconlabel: 'globe', - helptext: uimap[field][1] - ) + emit_mentor_input('prefers', mdata, uimap, 'glyphicon-ok-sign') + emit_mentor_input('languages', mdata, uimap, 'glyphicon-globe') _div.form_group do _label.col_sm_offset_3.col_sm_9.strong.text_left 'What You Could Help Mentees With' @@ -213,19 +201,18 @@ _html do # Display data to the user, depending if we're GET (existing mentor record or just blank data) or POST (show SVN checkin results) if _.post? - submission = { + submission = { # TODO make this a loop over uimap.keys; TODO check if we want any other fields "timezone" => "#{@timezone}", "availability" => "#{@availability}", "contact" => "#{@contact}", + "prefers" => "#{@prefers}", "available" => "#{@available}", "mentoring" => "#{@mentoring}", "experience" => "#{@experience}", + "languages" => "#{@languages}", "pronouns" => "#{@pronouns}", "aboutme" => "#{@aboutme}", - "homepage" => "#{@homepage}", - # Multiple select fields - "prefers" => _.params['prefers'], - "languages" => _.params['languages'] + "homepage" => "#{@homepage}" } if @notavailable submission['notavailable'] = "#{@notavailable}"
