8000 fix exception on empty update; simplify coffeescript by elad-eyal · Pull Request #749 · frab/frab · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix exception on empty update; simplify coffeescript #749

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion app/controllers/conferences_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 6 additions & 2 deletions app/views/conferences/_form.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = () ->
Expand All @@ -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 = $('<input />', { class: 'accepted-duration-checkbox', type: 'checkbox', value: minutes, checked: is_checked, disabled: is_disabled})
ul.append(item).append(duration_to_time(minutes)).append('<br/>')
Expand Down
1 change: 1 addition & 0 deletions config/locales/de.yml
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,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
Expand Down
1 change: 1 addition & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,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
Expand Down
1 change: 1 addition & 0 deletions config/locales/es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,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
Expand Down
1 change: 1 addition & 0 deletions config/locales/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,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
Expand Down
1 change: 1 addition & 0 deletions config/locales/it.yml
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,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
Expand Down
1 change: 1 addition & 0 deletions config/locales/pt-BR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,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
Expand Down
1 change: 1 addition & 0 deletions config/locales/ru.yml
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,7 @@ ru:
справа.
notice_bulk_notification_queued: Массовые уведомления для событий в %{notification} в очереди.
notice_conference_created: Конференция была успешно создана.
notice_conference_not_updated: Конференция не обновлялась.
notice_conference_updated: Конференция была успешно обновлена.
past_conferences: Прошедшие конференции
recent_changes: Недавние изменения
Expand Down
1 change: 1 addition & 0 deletions config/locales/zh.yml
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,7 @@ zh:
按钮在右边。
notice_bulk_notification_queued: 批量通知%{notification}中的事件入队。
notice_conference_created: 会议成功创建。
notice_conference_not_updated: 会议未更新。
notice_conference_updated: 会议已成功更新。
past_conferences: 过去的会议
recent_changes: 近期变动
Expand Down
13 changes: 13 additions & 0 deletions test/features/editing_conference_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
0