livebook/lib/livebook_web
Lee Jarvis 4bacba6b1d
Remove delete prompt for empty sections (#829)
* Remove delete prompt for empty sections

If a section has no cell views or only empty cell views, avoid
prompting the user to delete the section and just go ahead and delete
it.

Closes #800

* Move delete prompt logic to SessionLive

This avoids creating two separate paths in the view for displaying
delete buttons (triggering either a prompt, or deleting the empty
section).

Instead, the `delete_section` callback is always triggered, and the
"display prompt" logic is kept here.

Couple of things I'm unsure about so will discuss on the PR.

See https://github.com/livebook-dev/livebook/pull/829#discussion_r775560671

* Check only against empty cell list in `delete_section`

* Fix indentation

* Handle section not existing on deletion

* Match empty cell list in case expression

Also explicitly set the section and then re-use it. I think this is a
bit nicer than just matching against the empty list since it matches
the following match too
2021-12-27 18:42:27 +01:00
..
controllers Add support for JS output widgets (#818) 2021-12-24 14:18:34 +01:00
helpers
live Remove delete prompt for empty sections (#829) 2021-12-27 18:42:27 +01:00
plugs Make it possible to configure custom plug for all requests (#576) 2021-10-05 00:44:27 +02:00
templates Make app.html consistent with live.html 2021-12-16 20:21:49 +01:00
views
endpoint.ex Fix typos (#654) 2021-10-31 07:14:35 +01:00
helpers.ex Fix docs after refactoring live_modal to modal (#794) 2021-12-12 00:08:54 +01:00
router.ex Disable Ecto stats in Phoenix Live Dashboard (#824) 2021-12-24 19:05:19 +01:00
telemetry.ex