From f64cd7323feac716bfa5baee4e61f7d104004f26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ana=20Mar=C3=ADa=20Mart=C3=ADnez=20G=C3=B3mez?= Date: Thu, 30 May 2019 13:13:24 +0200 Subject: [PATCH 1/2] Do not use readonly checkboxes to render information Just render `Yes` or `No` instead of a disabled checkbox with these two options in the recent users section of conference#index. --- app/views/admin/conferences/_recent_users.html.haml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/app/views/admin/conferences/_recent_users.html.haml b/app/views/admin/conferences/_recent_users.html.haml index 83234afa..790e386b 100644 --- a/app/views/admin/conferences/_recent_users.html.haml +++ b/app/views/admin/conferences/_recent_users.html.haml @@ -14,10 +14,7 @@ %td= link_to user.email, admin_user_path(user.id) %td= user.created_at.strftime('%m/%d/%Y') %td - = check_box_tag user.id, user.id, user.confirmed?, - url: "/admin/users/#{user.id}/toggle_confirmation?user[to_confirm]=", - class: 'switch-checkbox', - readonly: true + = user.confirmed? ? 'Yes' : 'No' - else %h5.text-warning.text-center No sign ups! From b590bc4145907ef204b2b80bdccda0661fb4958c Mon Sep 17 00:00:00 2001 From: Stella Rouzi Date: Sat, 30 Mar 2019 21:57:45 +0200 Subject: [PATCH 2/2] Use helpers instead of URLs in switch checkboxes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Absolute URLs may be potentially breaking functionality, eg in case of sub-directory installation. Fixes https://github.com/openSUSE/osem/issues/2472 Co-authored-by: Ana María Martínez Gómez --- app/views/admin/events/registrations.html.haml | 2 +- app/views/admin/users/_form.html.haml | 4 ++-- app/views/admin/users/show.html.haml | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/views/admin/events/registrations.html.haml b/app/views/admin/events/registrations.html.haml index 227c0138..e9fba68e 100644 --- a/app/views/admin/events/registrations.html.haml +++ b/app/views/admin/events/registrations.html.haml @@ -32,7 +32,7 @@ %td= event_registration.email %td= event_registration.created_at %td - = check_box_tag @conference.short_title, @event.id, event_registration.attended, class: 'switch-checkbox', url: "/admin/conferences/#{@conference.short_title}/program/events/#{@event.id}/toggle_attendance?events_registration_id=#{event_registration.id}&&event_registration[attended]=" + = check_box_tag @conference.short_title, @event.id, event_registration.attended, class: 'switch-checkbox', url: "#{toggle_attendance_admin_conference_program_event_path(@conference, @event, events_registration_id: event_registration)}&&event_registration[attended]=" %td - if event_registration.registration.attended %i.fa.fa-check.text-success diff --git a/app/views/admin/users/_form.html.haml b/app/views/admin/users/_form.html.haml index 9de061d4..40ec8a7a 100644 --- a/app/views/admin/users/_form.html.haml +++ b/app/views/admin/users/_form.html.haml @@ -6,12 +6,12 @@ Confirmed? - if can? :toggle_confirmation, @user = check_box_tag @user.id, @user.id, @user.confirmed?, - url: "/admin/users/#{@user.id}/toggle_confirmation?user[to_confirm]=", + url: "#{toggle_confirmation_admin_user_path(@user.id)}?user[to_confirm]=", class: 'switch-checkbox', readonly: false - else = check_box_tag @user.id, @user.id, @user.confirmed?, - url: "/admin/users/#{@user.id}/toggle_confirmation?user[to_confirm]=", + url: "#{toggle_confirmation_admin_user_path(@user.id)}?user[to_confirm]=", class: 'switch-checkbox', readonly: true = f.input :is_admin, hint: 'An admin can create a new conference, manage users and make other users admins.' diff --git a/app/views/admin/users/show.html.haml b/app/views/admin/users/show.html.haml index 11933454..c9048be4 100644 --- a/app/views/admin/users/show.html.haml +++ b/app/views/admin/users/show.html.haml @@ -36,12 +36,12 @@ %td - if can? :toggle_confirmation, @user = check_box_tag @user.id, @user.id, @user.confirmed?, - url: "/admin/users/#{@user.id}/toggle_confirmation?user[to_confirm]=", + url: "#{toggle_confirmation_admin_user_path(@user)}?user[to_confirm]=", class: 'switch-checkbox', readonly: false - else = check_box_tag @user.id, @user.id, @user.confirmed?, - url: "/admin/users/#{@user.id}/toggle_confirmation?user[to_confirm]=", + url: "#{toggle_confirmation_admin_user_path(@user)}?user[to_confirm]=", class: 'switch-checkbox', readonly: true - else