Commit Graph

45 Commits

Author SHA1 Message Date
Javi Martín
d827768c07 Set HTML dir attribute in RTL languages
This way properties flex layouts text direction will work properly.
2021-08-16 17:47:34 +02:00
Javi Martín
a42cb050a7 Add SDG content section 2020-12-02 12:38:03 +01:00
Javi Martín
d501915954 Extract admin menu to a component
This way adding new methods will be easier.
2020-11-26 12:15:07 +01:00
Javi Martín
c362e1190f Simplify main admin header margin rules
Instead of having a header with a bottom margin followed by an element
with a negative margin, it makes more sense to have no margin on either
element.
2020-09-21 15:15:52 +02:00
Javi Martín
fc3a7618b1 Simplify method to render admin menu
The `side_menu` helper method isn't necessary since commit 13b3d9cebc.
2020-09-21 15:14:20 +02:00
Javi Martín
125106f9c0 Simplify code to have an off-canvas menu
While Foundations's off-canvas menu allows us to forget about writing
CSS, it also leads to complicated HTML.

Ideally Foundation would provide an easy way to simplify what we're
doing, but I haven't found anything in the documentation.

We could simplify the HTML a bit more if we used a CSS grid layout
instead of a flex one, but old browsers have better support for the
latter.

Note we're using `breakpoint(medium)` so we can group the CSS for small
screens and follow SCSS-Lint rules at the same time.

Also note behavior of the main area when the menu appears on small
screens is slightly different: it doesn't move the main content to the
right. I've done it this way so we don't have any overflow issues,
unlike the previous version.

There's a small issue using a label and a checkbox to enable/disable the
menu: sighted keyboard users with a small screen might not be able to
enable the menu. So we're adding the `:focus-within` pseudoclass so the
menu can be normally navigated using the keyboard. Even if old browsers
don't support this pseudoclass, we believe the probability of a sighted
user using a small screen, navigating with the keyboard and using an old
browser is really low, particularly in the admin area.

We're also adding the `aria-hidden` attribute on the label, since the
menu is never hidden for screen readers and so having a control to show
it could be confusing. Since the label is not focusable, we're complying
with the fourth ARIA rule:

> Do not use role="presentation" or aria-hidden="true" on a focusable
> element .
>
> Using either of these on a focusable element will result in some users
> focusing on 'nothing'.
2020-09-21 15:14:20 +02:00
decabeza
2363aa4c76 Avoid using a mixin for side menu and content styles 2020-09-21 15:14:20 +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
Javi Martín
42106e6601 Fix double scroll bar in admin content
We were using `overflow: scroll` as a workaround with a problem we had
with the equalizer. But now we never need an extra vertical scroll bar,
and we only need an extra horizontal scroll bar on small screens.

Since the dashboard was using the class `admin-content` as well, we need
to apply to the dashboard the same changes we've done in the admin
section. I've extracted them into a mixin.
2019-12-19 16:02:31 +01:00
Javi Martín
91d4624443 Simplify admin side menu layout
We can move the button to toggle the menu to the main content, and
everything will look the same way while we'll need one div less.
2019-12-19 16:02:31 +01:00
Javi Martín
f2e32b44b1 Fix blank space in admin content
In some situations where JavaScript makes content disappear, the height
of the element calculated by foundation's equalizer isn't recalculated,
leaving blank space at the bottom of the page. I've seen cases where a
blank vertical space of 2000 pixels is on the page.

Using flexbox solves the problem, since CSS takes care of everything.
2019-12-19 16:02:31 +01:00
Javi Martín
025923ac4e Set current locale as HTML language in all layouts
The same way it's done in the application layout. Not doing so causes
accessibility issues affecting screen reader users.
2019-10-25 15:34:40 +02:00
María Checa
d5c7858f6c Removed officer alert in admin section 2019-05-16 14:45:46 +02:00
Juanjo Bazán
5121c9b6d8 removes booth message from admin interface 2019-05-16 13:37:47 +02:00
rgarcia
4761ac91bd Displays officing booth in layout 2019-03-28 15:47:52 +01:00
Javi Martín
3e4e65ead7 Use double quotes inside ERB
We were using single quotes inside ERB code when that code was inside
HTML double quotes.
2019-03-25 14:58:54 +01:00
Julian Herrero
25ed245689 Use double quotes in app/views/layouts 2019-03-19 12:16:50 +01:00
Javier Martín
9198b1af03 Skip jQuery animations in all layouts when testing. 2018-06-24 02:50:25 +02:00
Javier Martín
6e4f697cea Extract partial with common <head> tags. 2018-06-24 02:43:59 +02:00
Javier Martín
6245942196 Don't use jQuery animations in tests.
There's a flaky test creating a group for a budget which takes place
because toggling a form using jQuery sometimes results in the button not
being correctly clicked by Capybara.

Checking the page with `expect(page).to have_button 'Create group'`
before clicking the button doesn't solve the problem; it looks like in
those cases Capybara waits for AJAX requests but not for JavaScript
animations.

See also issue #2573.
2018-06-23 19:58:20 +02:00
decabeza
92dbb4fb73 removes unnecessary close button for admin menu 2017-10-16 19:39:29 +02:00
decabeza
b291547bae replaces unnecessary css class 2017-09-20 19:07:08 +02:00
rgarcia
1a46b4d4cb fixes conflicts with master 2017-05-31 10:36:38 +02:00
Bertocq
41fb640f92 Add missing data-equalizer-watch attribute
Why:

* There is a data-equalizer attribute on the parent div, and a data-equalizer-watch on a sibiling div, and that breakes both the purpose of those values (Resize child elements of data-equalizer to have the same height. Ref: http://foundation.zurb.com/sites/docs/equalizer.html)

* That lack of attribute was breaking many specs consistently on localhost with phantomjs 2.1.1 on macos sierra (and ubuntu as reported by @amaia)

How:

* Just adding the missing 'data-equalizer-watch' attribute on the div child of the one using 'data-equalizer'
2017-05-29 09:58:37 +02:00
decabeza
5e0d5fc8c3 Merge branch 'legislation-module-stable' of https://github.com/medialab-prado/consul into medialab-legislation 2017-05-22 18:43:49 +02:00
Fernando Blat
6560e77554 Ask for confirmation when changing the page and
the forms watched do have changes
2017-01-18 13:37:11 +01:00
Alberto Garcia Cabeza
e7327860e4 improves headings and html structure 2016-12-14 13:51:39 +01:00
Alberto Garcia Cabeza
7056487f3d improves styles for admin menu 2016-11-30 18:46:35 +01:00
Juanjo Bazán
824a969c0e fixes admin menu spec 2016-06-02 12:21:13 +02:00
Alberto Garcia Cabeza
d147cce459 Fixes localization specs 2016-06-02 11:26:40 +02:00
Alberto Garcia Cabeza
31cb29d8c5 Fixes specs 2016-06-01 21:46:17 +02:00
Alberto Garcia Cabeza
fb6dbdf2f9 Improves all pages for admin section 2016-06-01 13:23:57 +02:00
Alberto Garcia Cabeza
56bb06b168 Improves general layout for admin 2016-05-31 17:10:08 +02:00
kikito
8bcbe86064 Refactor layout flash usage and move to a partial 2016-04-28 12:46:27 +02:00
Alberto Garcia Cabeza
e181206054 Adds main tag on layouts 2016-03-14 19:32:49 +01:00
Alberto Garcia Cabeza
3752f3a53b Adds foundation 6 🎉 2016-02-26 19:33:33 +01:00
Alberto Garcia Cabeza
8d12f61a45 Adds meta tags for IE 2015-10-14 16:14:07 +02:00
Alberto Garcia Cabeza
bf08cb582f Adds title on close alerts link 2015-09-28 13:46:54 +02:00
Juanjo Bazán
8c99c6a5f0 refactors stats and optimizes js
JS libraries for stats (d3, c3, etc.) only load now when needed (stats/show)
2015-09-23 19:37:24 +02:00
Álvaro Durán Tovar
92ae988251 adds close button to alert boxes, also adds
data-alert attribute to enable javascript
on them
2015-09-06 19:54:12 +02:00
rgarcia
137ca75055 adds favicon to other layouts 2015-09-02 22:34:16 +02:00
Alberto Garcia Cabeza
0c2901c3fb Adds styles for admin 2015-08-17 21:30:22 +02:00
Juanjo Bazán
94879fbccb adds admin_header partial 2015-08-17 15:18:51 +02:00
rgarcia
101477c7da refactors admin layout 2015-08-14 13:33:30 +02:00
rgarcia
88defaa455 adds admin layout and access links [#163] 2015-08-14 12:37:44 +02:00