From 99eaa3839d50321447e3b8a820f8c010bacfc9c8 Mon Sep 17 00:00:00 2001 From: eladeyal-intel Date: Fri, 13 Nov 2020 23:12:06 +0200 Subject: [PATCH 1/2] simplify CoffeeScript These changes are prevent Capybara reporting JS errors --- app/views/conferences/_form.html.haml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/views/conferences/_form.html.haml b/app/views/conferences/_form.html.haml index 6f9928700..feccebcc0 100644 --- a/app/views/conferences/_form.html.haml +++ b/app/views/conferences/_form.html.haml @@ -53,7 +53,11 @@ :coffeescript duration_to_time = (minutes) -> two_digits = (n) -> - (n).toString().padStart(2, '0') + if n < 10 + return "0" + n + else + return "" + n + two_digits(minutes // 60) + ':' + two_digits(minutes % 60) render_duration_checkboxes = () -> @@ -65,7 +69,7 @@ ul.empty() for slots in [1..max_timeslots] minutes = slots * minutes_per_slot - is_checked = checked_items.includes(minutes.toString()) || minutes == default_submission_in_minutes + is_checked = minutes.toString() in checked_items || minutes == default_submission_in_minutes is_disabled = minutes==default_submission_in_minutes item = $('', { class: 'accepted-duration-checkbox', type: 'checkbox', value: minutes, checked: is_checked, disabled: is_disabled}) ul.append(item).append(duration_to_time(minutes)).append('
') From d4c974305cc97609f710b471453685af9a3b7527 Mon Sep 17 00:00:00 2001 From: eladeyal-intel Date: Fri, 13 Nov 2020 22:23:13 +0200 Subject: [PATCH 2/2] fix exception when submitting empty update Closes frab#516 --- app/controllers/conferences_controller.rb | 4 +++- config/locales/de.yml | 1 + config/locales/en.yml | 1 + config/locales/es.yml | 1 + config/locales/fr.yml | 1 + config/locales/it.yml | 1 + config/locales/pt-BR.yml | 1 + config/locales/ru.yml | 1 + config/locales/zh.yml | 1 + test/features/editing_conference_test.rb | 13 +++++++++++++ 10 files changed, 24 insertions(+), 1 deletion(-) diff --git a/app/controllers/conferences_controller.rb b/app/controllers/conferences_controller.rb index bbd075095..1bed4880d 100644 --- a/app/controllers/conferences_controller.rb +++ b/app/controllers/conferences_controller.rb @@ -135,7 +135,9 @@ def create def update authorize @conference, :orga? respond_to do |format| - if @conference.update_attributes(existing_conference_params) + if not params[:conference] + format.html { redirect_to(edit_conference_path(conference_acronym: @conference.acronym), notice: t('conferences_module.notice_conference_not_updated')) } + elsif @conference.update_attributes(existing_conference_params) format.html { redirect_to(edit_conference_path(conference_acronym: @conference.acronym), notice: t('conferences_module.notice_conference_updated')) } else flash_model_errors(@conference) diff --git a/config/locales/de.yml b/config/locales/de.yml index 6d4ac2f75..6347d2843 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -535,6 +535,7 @@ de: Fügen Sie mit der Schaltfläche rechts eine Konferenz hinzu. notice_bulk_notification_queued: Alle Benachrichtigungen für die Einreichungen in %{notification} an den Ticket-Server übergeben. notice_conference_created: Die Konferenz wurde erfolgreich erstellt. + notice_conference_not_updated: Konferenz wurde nicht aktualisiert. notice_conference_updated: Die Konferenz wurde erfolgreich aktualisiert. past_conferences: Frühere Konferenzen recent_changes: Letzte Änderungen diff --git a/config/locales/en.yml b/config/locales/en.yml index 8c77a1c7b..b2e096895 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -514,6 +514,7 @@ en: button on the right. notice_bulk_notification_queued: Bulk notifications for events in %{notification} enqueued. notice_conference_created: Conference was successfully created. + notice_conference_not_updated: Conference was not updated. notice_conference_updated: Conference was successfully updated. past_conferences: Past Conferences recent_changes: Recent changes diff --git a/config/locales/es.yml b/config/locales/es.yml index b1fd84ce1..82f729536 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -559,6 +559,7 @@ es: botón a la derecha. notice_bulk_notification_queued: Notificaciones masivas para eventos en %{notification} en cola. notice_conference_created: La conferencia fue creada con éxito. + notice_conference_not_updated: La conferencia no se actualizó. notice_conference_updated: La conferencia fue actualizada con éxito. past_conferences: Conferencias pasadas recent_changes: Cambios recientes diff --git a/config/locales/fr.yml b/config/locales/fr.yml index e7a55ede5..93e28f530 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -523,6 +523,7 @@ fr: en cliquant sur le bouton de droite. notice_bulk_notification_queued: Groupe de notifications pour les évènements dans %{notification} mises en file d’attente.. notice_conference_created: Conférence créée avec succès. + notice_conference_not_updated: La conférence n'a pas été mise à jour. notice_conference_updated: Conférence mise à jour avec succès. past_conferences: Conférences passées recent_changes: Changements récents diff --git a/config/locales/it.yml b/config/locales/it.yml index c559579e4..e837cd4a8 100644 --- a/config/locales/it.yml +++ b/config/locales/it.yml @@ -523,6 +523,7 @@ it: cliccando sul tasto destro. notice_bulk_notification_queued: Gruppo di notifica per eventi in %{notification} in coda. notice_conference_created: Conferenza creata con successo. + notice_conference_not_updated: La conferenza non è stata aggiornata. notice_conference_updated: Conferenza aggiornata con successo. past_conferences: Conferenze passate recent_changes: Cambiamenti recenti diff --git a/config/locales/pt-BR.yml b/config/locales/pt-BR.yml index 246a782c5..25314cbd8 100644 --- a/config/locales/pt-BR.yml +++ b/config/locales/pt-BR.yml @@ -536,6 +536,7 @@ pt-BR: botão à direita. notice_bulk_notification_queued: Notificações em massa para eventos em %{notification} enfileirados. notice_conference_created: Conferência foi criada com sucesso. + notice_conference_not_updated: A conferência não foi atualizada. notice_conference_updated: Conferência foi atualizada com sucesso. past_conferences: Conferências passadas recent_changes: Mudanças recentes diff --git a/config/locales/ru.yml b/config/locales/ru.yml index 6c407d674..2f168d416 100644 --- a/config/locales/ru.yml +++ b/config/locales/ru.yml @@ -514,6 +514,7 @@ ru: справа. notice_bulk_notification_queued: Массовые уведомления для событий в %{notification} в очереди. notice_conference_created: Конференция была успешно создана. + notice_conference_not_updated: Конференция не обновлялась. notice_conference_updated: Конференция была успешно обновлена. past_conferences: Прошедшие конференции recent_changes: Недавние изменения diff --git a/config/locales/zh.yml b/config/locales/zh.yml index c652e2b8a..04aaef983 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -514,6 +514,7 @@ zh: 按钮在右边。 notice_bulk_notification_queued: 批量通知%{notification}中的事件入队。 notice_conference_created: 会议成功创建。 + notice_conference_not_updated: 会议未更新。 notice_conference_updated: 会议已成功更新。 past_conferences: 过去的会议 recent_changes: 近期变动 diff --git a/test/features/editing_conference_test.rb b/test/features/editing_conference_test.rb index 877729c44..c352067a0 100644 --- a/test/features/editing_conference_test.rb +++ b/test/features/editing_conference_test.rb @@ -26,4 +26,17 @@ class EditingConferenceTest < FeatureTest assert_content page, 'Events' assert_content page, Event.last.title end + + it 'edit classifiers', js: true do + sign_in_user(@admin) + visit "/#{@conference.acronym}/conference/edit_classifiers" + assert_content page, 'Here you can create and edit the classifiers' + click_on 'Update conference' + assert_content page, 'Conference was not updated.' + click_on 'Classifiers' + click_on 'Add classifier' + fill_in 'Name', with: 'classifier1' + click_on 'Update conference' + assert_content page, 'Conference was successfully updated.' + end end