This is the reason why this feature was implemented in the first place: it's easy to open the editor, make some changes, close it, and continue without realizing the changes have not been saved. In the rest of the forms, this functionality is quite lacking. For starters, some forms warn if there are unsaved changes, while some forms don't, which is highly inconsistent and disorients users. Furthermore, we were having problems with this feature after upgrading Turbolinks, particularly in forms using CKEditor. In these cases, a lot of hacking needs to be done in order to make this feature work properly, since CKEditor adds some formatting automatically, and if this is done after the form is serialized, we'll get some unexpected behavior. On the other hand, comparing the value of a textarea against its `defaultValue` property will work on every edge case, including using the browser's back button or reloading the page. Finally, users are used to the way web forms work, and aren't used to be asked for confirmation when they change their mind and decide to leave the page without saving the changes. Asking them for confirmation will be annoying in most cases. Besides that, if they accidentally leave the page, they can use the browser's back button and they'll recover the unsaved changes. It's true this won't happen it they accidentally close the browser's window, but our WatchFormChanges functionality didn't work in this case either. Using the "beforeunload" event adds more problems than it solves, since it doesn't support custom messages (or, to be more precise, modern browsers ignore custom messages), and it doesn't get along with turbolinks. Co-Authored-By: Senén Rodero Rodríguez <senenrodero@gmail.com>
42 lines
1.3 KiB
Plaintext
42 lines
1.3 KiB
Plaintext
<!DOCTYPE html>
|
|
<html lang="<%= I18n.locale %>">
|
|
|
|
<head>
|
|
<%= render "layouts/common_head", default_title: "Admin" %>
|
|
<%= content_for :head %>
|
|
</head>
|
|
|
|
<body class="admin">
|
|
<div class="off-canvas-wrapper">
|
|
<div class="off-canvas-wrapper-inner" data-off-canvas-wrapper>
|
|
<div class="off-canvas position-left" id="offCanvas" data-off-canvas>
|
|
|
|
<div class="show-for-small-only">
|
|
<%= side_menu %>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="off-canvas-content" data-off-canvas-content>
|
|
<%= render "layouts/admin_header" %>
|
|
|
|
<div class="side-menu-and-admin-content no-margin-top">
|
|
<div id="side_menu" class="hide-for-small-only">
|
|
<%= side_menu %>
|
|
</div>
|
|
|
|
<div class="admin-content">
|
|
<div class="show-for-small-only">
|
|
<button type="button" class="button hollow expanded" data-toggle="offCanvas"><%= t("admin.menu.admin") %></button>
|
|
</div>
|
|
|
|
<%= render "layouts/flash" %>
|
|
<%= render "layouts/officing_booth" if controller.class.parent == Officing && session[:booth_id].present? %>
|
|
<%= yield %>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html>
|