Commit Graph

405 Commits

Author SHA1 Message Date
Javi Martín
bb2e2fa0a3 Move main <h1> tag inside main header
A <header> tag is the natural place to have headings.

Since we already had the logo there, IMHO it makes sense to merge both
the <h1> tag and the logo together. We were already doing so in the
devise layout.

From the sceen reader users' point of view, having a link with the text
"CONSUL logo" is a bit confusing, since it seems to imply the link will
get us to the CONSUL logo. Using the organization name as the text of
the link makes more sense.

One thing changes, though. Before this commit, the first thing on the
page a screen reader user would hear about would be the organization
name. Now the language selector and the top links are announced before
the organization name is read. That's fine, since the actual first thing
these users will hear is the content of the <title> tag, which contains
the organization name as well.
2020-11-23 18:05:43 +01:00
Javi Martín
d4a360c7fb Simplify main layout styles
We were using a "push" div in order to force the footer to the bottom,
and were using a wrapper with a minimum height and negative margins.

The same thing can be accomplished using flex and making the wrapper
fill the empty space, which in my humble opinion simplifies the code and
makes it easier to follow.

We could further simplify the code by removing the wrapper div or the
footer wrapper, although I'm not sure the benefits overcome potential
inconveniences caused to other institutions who might have custom styles
based on the existence of these wrappers.
2020-11-23 18:04:55 +01:00
Javi Martín
d0cb26c086 Use CSS to style footer links
This way additional elements added through the "footer" content block
will also have the same styles.
2020-11-08 14:02:12 +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
a293dc013d Make management layout similar to admin layout
The <main> tag was including the navigation, and now we use the same
flex layout, making it more accessible for mobile phone users.

I'm not sure the <main> tag should actually include the account info and
the flash message. I'm keeping it like this in order to keep the layout
the way it was.
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
4b93437351 Remove unused layout
It isn't used since commit e5f9cf67.
2020-09-18 12:54:02 +02:00
Senén Rodero Rodríguez
761f5f3f93 Fix inconsistent interpolations 2020-09-15 17:53:54 +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
7b96180a76 Upgrade Turbolinks to version 5.2.1
We didn't upgrade Turbolinks when we upgraded to Rails 5 so we didn't
upgrade too many things at the same time, and postponed it... until now
:).

Note upgrading Turbolinks fixes an issue with foundation's sticky when
using the browser's back and forward buttons. We're adding tests for
these scenarios.

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
442baf8384 Remove browser gem direct dependency
While the browser gem is great, we don't need it in this case for such a
simple usage.

There are a few really small differences between this code and the old
one: matching `/MSIE/` will return true for Opera 12 and false for
certain versions of IE11. Since we're only rendering a comment for IE8
and below, we don't care about IE11, and Opera 12 is six years old and
its users won't be affected by the comment.

Note we're still using the browser gem because ahoy_matey depends on it,
but now it's an indirect dependency.
2019-11-18 13:12:35 +01:00
Pierre Mesure
232e6c7f11 Replace old Spanish text with org name 2019-11-09 19:38:13 +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
Javi Martín
89402bdbf6 Use raw instead of html_safe
They do the exact same thing; however `html_safe` might confuse
developers into thinking it will make the HTML safe. Using `raw` makes
it clear that we're inserting the text without escaping it.
2019-10-08 19:10:13 +02:00
Javi Martín
61bf9a5c73 Use sanitize instead of html_safe
The difference is `html_safe` allows every HTML tag, including the
`<script>` tag, while `sanitize` only allows tags which are considered
safe. In this case, we want to allow a `<span>` tag in a translation,
and links inside flash messages.
2019-10-08 18:46:21 +02:00
Javi Martín
928312e218 Use sanitize in translations with links
Sometimes we're interpolating a link inside a translation, and marking
the whole translations as HTML safe.

However, some translations added by admins to the database or through
crowdin are not entirely under our control.

Although AFAIK crowdin checks for potential cross-site scripting
attacks, it's a good practice to sanitize parts of a string potentially
out of our control before marking the string as HTML safe.
2019-10-08 18:46:21 +02:00
Javi Martín
6b12da7654 Fix ERB being used in an HTML comment
This was causing erb-lint to issue a warning.
2019-10-08 18:46:20 +02:00
Javi Martín
55a190f44a Remove unneeded _html suffix in I18n keys
This suffix does the same thing as calling `.html_safe` on them. So we
don't need to use it in texts that don't use HTML.
2019-10-08 13:20:22 +02:00
Javi Martín
20ca6beb30 Remove unneeded html_safe and raw calls
There's no HTML in these texts, or it has already been escaped by Rails
`link_to` helper method.
2019-10-08 13:20:22 +02:00
Javi Martín
738e9ebc8b Remove code specific to Internet Explorer 8
Internet Explorer 9 was released eight years ago. Besides that, we don't
really support IE8 anyway, since we show a popup to IE8 users saying
we don't support it, we haven't maintained the IE8-specific CSS file for
years, and we don't test our JavaScript against IE8.
2019-09-10 22:43:37 +02:00
Javi Martín
f9ed186909 Add rubocop spacing rules
We were following these rules in most places; we just didn't define them
anywhere.
2019-09-10 21:04:56 +02:00
Javi Martín
f74971060b Apply SpaceInHtmlTag ERB Lint rule 2019-09-10 20:02:15 +02:00
Javi Martín
c62da726b8 Apply SpaceAroundErbTag ERB Lint rule 2019-09-10 20:02:15 +02:00
Javi Martín
71d9ddd849 Apply rule to end files with a newline character 2019-09-10 20:02:15 +02:00
Javi Martín
cf9e36c767 Replace single quotes with double quotes
Most of these quotes were in the dashboard branch before we added the
rule for double quotes.
2019-09-10 19:21:03 +02:00
Javi Martín
911fe4e481 Simplify calls to render partial
We're also adding a bit of consistency, since most of our calls to
partial rendering omit the `partial` and `locals` keys.
2019-09-04 15:00:36 +02:00
Javi Martín
29da91a082 Fix untranslated texts
I've also renamed the key for the settings title so the `<h1>` gets the
`title` key, as done in other sections in the admin.
2019-08-27 17:22:22 +02:00
taitus
72d1893703 Manage the remote translation button display
- Add remote_translation_button partial to layout
- Only display button when we have remote_translations and if current
  locale is include on available locales from remote translations service.
- Recover available locales from remote translations service.
  Use daily_cache to detect every day if remote translation service has
  added new available locale.

Co-Authored-By: alessandro <agileontheweb@gmail.com>
2019-06-27 09:21:18 +02:00
Alberto
1c10c22b08 Merge pull request #3509 from consul/menu-users
Users menu
2019-05-21 12:54:42 +02:00
decabeza
43dd3d2169 Include mailer header logo on custom images list 2019-05-21 11:22:04 +02:00
decabeza
aee62b9d33 Change header title link on officing namespace 2019-05-17 17:48:54 +02:00
decabeza
2c9d9b5de8 Remove admin shortcuts links to stats and settings
These links are already on sidebar and isn't necessary have them on header.
2019-05-17 17:48:49 +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
decabeza
94b8caffca Merge branch 'master' into proposal-dashboard 2019-04-04 14:08:30 +02:00
rgarcia
9329e4b6ea hot fix current booth 2019-03-28 15:50:34 +01:00
rgarcia
4761ac91bd Displays officing booth in layout 2019-03-28 15:47:52 +01:00
decabeza
2af154d539 Merge branch 'master' into proposal-dashboard 2019-03-28 01:26:04 +01:00
decabeza
eda6ea7f12 Merge branch 'master' into dashboard 2019-03-26 16:45:48 +01:00
Alberto
29a87e2746 Merge branch 'dashboard' into dashboard-polish 2019-03-26 12:19:20 +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
Javi Martín
4c35df4812 Use double quotes inside string interpolation 2019-03-25 14:58:54 +01:00
taitus
6342d598f7 Update active resources count for proposal
Fix: Sum default resources (mail, poster, poll) to actives resources for a proposal.
2019-03-21 12:29:31 +01:00
Julian Herrero
4df9a1a1b4 Move HTML settings to content blocks settings page
- Rename html settings keys
- Show html settings next to content blocks page
- Hide html settings from configuration tab
2019-03-19 19:45:34 +01:00
decabeza
e949d4d163 Refactor proposal total counter value 2019-03-19 16:59:57 +01:00