Commit Graph

15 Commits

Author SHA1 Message Date
Javi Martín
251a5fb6e9 Default to delete method for the destroy action
This is consistent with what Rails does.
2024-04-17 23:38:41 +02:00
Javi Martín
5876738369 Ask confirmation to delete drafts and questions
This is similar to what we do in almost every other page of the admin
section.
2024-04-17 16:44:10 +02:00
Javi Martín
ecad046a99 Use buttons to destroy drafts and questions
As mentioned in commits 5311daadf and bb958daf0, using links combined
with JavaScript to generate POST (or, in this case, DELETE) requests to
the server has a few issues.
2024-04-17 16:44:09 +02:00
Javi Martín
0270c4c962 Hide unsaved changes warning after undoing them
This way showing the warning is consistent with warning users when
they're leaving the page.
2020-08-05 14:10:22 +02:00
Javi Martín
cfc60b5de4 Warn for changes just in markdown editor
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>
2020-08-05 14:10:22 +02:00
Julian Herrero
7b4b4b716c Use double quotes in app/views/admin/legislation 2019-03-19 12:16:50 +01:00
decabeza
f8707a73cd Unifies styles and views for admin legislation processes 2018-07-31 12:50:48 +02:00
decabeza
0b235d69d4 adds consistency for back links 2017-07-26 18:18:30 +02:00
decabeza
5364ec106a fixes headings structure on legislation admin 2017-05-24 13:04:19 +02:00
Amaia Castro
39633dce67 Fix back links in admin 2017-01-04 12:39:09 +01:00
Amaia Castro
ab12ffe98f Titles for legislation admin pages 2016-12-30 12:03:11 +01:00
Amaia Castro
4c309b5243 Refactor css classes 2016-12-30 11:22:28 +01:00
Amaia Castro
0cd2b62e2c Integrate admin html and css from sandbox 2016-12-30 11:00:34 +01:00
Amaia Castro
d25d6c178c Legislation Questions model and basic admin 2016-12-20 18:52:43 +01:00
Amaia Castro
e4fe499e66 DraftVersion base model and very basic admin pages 2016-12-06 12:10:20 +01:00