We were linking to the document url itself, which does not have a route
associated and so the specs fails
With this commit we are using the correct path to the destroy action of
the DocumentsController.
We are also using the referrer instead of a params[:from] attribute, as
it avoids having to pass an extra parameter, making the code prettier
and it works the same way
Note we require extra <span> tags because the <progress> tag is an empty
tag (like <img>), and so it can't have ::before or ::after
pseudo-elements. There's a workaround for that, but currently it only
works on Chrome.
For some reason, the text seems to be slightly misaligned vertically in
all implementations I've tried. So the `top: -0.1rem` rule is a hack to
align it properly.
The condition `params[:page_id] != 0` didn't work properly when editing
the homepage because in that case the parameter was `nil`, and the line
`SiteCustomization::Page.find(@card.site_customization_page_id)` raised
an exception because it couldn't find a page with a `nil` ID.
Fixing the issue while maintaining the check against `0` lead to complex
code, and so allowing `nil` in the database and assuming cards with no
`site_customization_page_id` belonged in the homepage seemed to be the
easiest solution.
The selector `nth-child(even)` didn't need specific rules, and it's
easier to understand the code for the selector `nth-child(odd)` if all
breakpoints are grouped together.
According to the HTML specification:
> The default value is the minimum plus half the difference between the
> minimum and the maximum, unless the maximum is less than the minimum,
> in which case the default value is the minimum.
So for new progress bars, we had a numeric value of `nil` and a range
value of `50`, meaning the input fields weren't in sync.
Manually triggering the event on the progress, while not an ideal
solution (ideally we would be able to define `0` as default), sets the
value of the numeric field.