From 3436c1320e59c7f983a560267fa19a347645db7e Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Wed, 21 Jan 2015 22:24:02 +0100 Subject: [PATCH] Add dynamic input fields for email notifications in the new config menu --- lib/Vroom/I18N/en.pm | 3 +-- lib/Vroom/I18N/fr.pm | 2 +- public/js/vroom.js | 17 +++++++++++++++++ templates/default/configure_modal.html.ep | 16 ++++++++++++++++ 4 files changed, 35 insertions(+), 3 deletions(-) diff --git a/lib/Vroom/I18N/en.pm b/lib/Vroom/I18N/en.pm index 69a259e..2ce8a6c 100644 --- a/lib/Vroom/I18N/en.pm +++ b/lib/Vroom/I18N/en.pm @@ -139,8 +139,7 @@ our %Lexicon = ( "ADD_NOTIFICATION" => "Add a notification", "ADD_THIS_ADDRESS" => "Add this address", "REMOVE_THIS_ADDRESS" => "Remove this address", - "NOTIFICATION_ON_JOIN" => "You can set a list of email address which will receive a notification each time " . - "someone joins this room", + "NOTIFICATION_ON_JOIN" => "Email addresses to notify when someone joins this room", "s_WILL_BE_NOTIFIED" => "%s will receive a notification each time someone joins this room", "s_WONT_BE_NOTIFIED_ANYMORE" => "%s won't be notified anymore", "s_JOINED_ROOM_s" => "%s joined room %s", diff --git a/lib/Vroom/I18N/fr.pm b/lib/Vroom/I18N/fr.pm index 682beed..c729cc7 100644 --- a/lib/Vroom/I18N/fr.pm +++ b/lib/Vroom/I18N/fr.pm @@ -146,7 +146,7 @@ our %Lexicon = ( "ADD_NOTIFICATION" => "Ajouter une notification", "ADD_THIS_ADDRESS" => "Ajouter cette adresse", "REMOVE_THIS_ADDRESS" => "Supprimer cette adresse", - "NOTIFICATION_ON_JOIN" => "Ajouter des adresses email qui recevront une notification dès que quelqu'un rejoint ce salon", + "NOTIFICATION_ON_JOIN" => "Email à notifier lorsque quelqu'un rejoint ce salon", "s_WILL_BE_NOTIFIED" => "%s recevra une notification à chaque fois qu'une personne rejoint ce salon", "s_WONT_BE_NOTIFIED_ANYMORE" => "%s ne recevra plus les notifications pour ce salon", "s_JOINED_ROOM_s" => "%s a rejoint le salon %s", diff --git a/public/js/vroom.js b/public/js/vroom.js index 607bd9e..c566ff2 100644 --- a/public/js/vroom.js +++ b/public/js/vroom.js @@ -2028,6 +2028,23 @@ function initVroom(room) { $('#ownerPassFields').hide(200); } }); + // Add emails input fields + $(document).on('click','button.btn-add-email',function(e){ + e.preventDefault(); + var parentEl = $('.email-list'), + currentEntry = $(this).parents('.email-entry:first'), + newEntry = $(currentEntry.clone()).appendTo(parentEl); + // Clear the value of the new input field + newEntry.find('input').val(''); + parentEl.find('.email-entry:not(:last) .btn-add-email') + .removeClass('btn-primary').removeClass('btn-add-email') + .addClass('btn-danger').addClass('btn-remove-email') + .html(''); + }); + $(document).on('click','button.btn-remove-email',function(e){ + e.preventDefault(); + $(this).parents('.email-entry:first').remove(); + }); $('#ownerPassButton').change(function(){ var action = ($(this).is(':checked')) ? 'set':'unset'; diff --git a/templates/default/configure_modal.html.ep b/templates/default/configure_modal.html.ep index 1a67dcc..f8f7bf7 100644 --- a/templates/default/configure_modal.html.ep +++ b/templates/default/configure_modal.html.ep @@ -72,6 +72,22 @@
+ + +
+