Commit Graph

15920 Commits

Author SHA1 Message Date
Javi Martín
abc81b30be Simplify styles for SSB icons
By using the same selector used by the social-share-button gem, we can
remove all the !important rules.
2021-02-08 16:31:26 +01:00
Javi Martín
68260360ef Remove unused styles
As far as I can see, the `.jumbo-budget` never had social share button
elements inside it.
2021-02-08 16:31:26 +01:00
Javi Martín
780660afc7 Use the icon-width variable to set SSB icon size
The same way we use it for SDG icons.
2021-02-08 16:31:26 +01:00
Javi Martín
86cac524b2 Remove unnecessary <div> tag
The `proposal-show` HTML class was only used in this context to style
the whatsapp icon, which is now styled the same way as other social
share icons. The `proposal-show` class should be reserved for the actual
proposal show action.
2021-02-08 16:31:26 +01:00
Javi Martín
0d8119a1e3 Use social-share-button whatsapp icon
We were using a custom icon because in the past social-share-button
didn't have support for whatsapp. But now that it does, we can remove
our custom icon.

Note we're using the `_app` suffix because that's the name of the icon
meant for mobile devices.
2021-02-08 16:31:26 +01:00
Javi Martín
ae8afc9b75 Remove duplication in social share button styles
All buttons were using the same styles, so we might as well style them
together.
2021-02-08 16:31:26 +01:00
Javi Martín
c5a56214c6 Remove redundant social share button styles
These styles were defined twice in our layout stylesheet.
2021-02-08 16:31:25 +01:00
dependabot-preview[bot]
4a61fd2d8c Bump social-share-button from 1.1.0 to 1.2.3
Bumps [social-share-button](https://github.com/huacnlee/social-share-button) from 1.1.0 to 1.2.3.
- [Release notes](https://github.com/huacnlee/social-share-button/releases)
- [Changelog](https://github.com/huacnlee/social-share-button/blob/master/CHANGELOG.md)
- [Commits](https://github.com/huacnlee/social-share-button/compare/v1.1.0...v1.2.3)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-02-08 16:31:23 +01:00
Javi Martín
ef0494f09c Fix missing expectation in budget polls spec
We've had a failure in one of our test suite runs [1]. A possible cause
could be an HTTP request taking place at the same time as an AJAX
request, with both trying to access the database at the same time.

We've had several similar issues in the past which have been fixed by
checking the AJAX request has finished before requesting another page,
so we're applying the same principle here.

[1] https://github.com/consul/consul/runs/1855207922
2021-02-08 15:45:25 +01:00
Javi Martín
63820fb59f Merge pull request #4102 from consul/dependabot/bundler/erb_lint-0.0.35
Apply Rubocop rules in ERB files
2021-02-08 15:39:27 +01:00
Javi Martín
00656e2e10 Fix SpaceAroundErbTag offense 2021-02-08 15:18:56 +01:00
Javi Martín
b214205d8f Use Capybara to disable animations in tests
We were doing it manually, but Capybara offers an option which does the
exact same thing.

This way we also apply the NoJavascriptTagHelper ERB rule, which
reported one error in the `disable_animations_in_tests` partial.
2021-02-05 17:46:23 +01:00
Javi Martín
1c2886debb Remove redundant condition
The association `organization.user` returns `nil` when the user is
hidden.

This was discovered thanks to the `Style/AndOr` rule. We were using
`and` and `||` on the same line, which is confusing.
2021-02-05 17:46:23 +01:00
Javi Martín
e7ca01fad7 Apply Rails/Presence rule in ERB files 2021-02-05 17:46:23 +01:00
Javi Martín
82200c5d0b Apply ParenthesesAsGroupedExpression rule in ERB 2021-02-05 17:46:23 +01:00
Javi Martín
c1cf9f0c34 Apply Style/SymbolProc rule in ERB files 2021-02-05 17:46:23 +01:00
Javi Martín
cc2aa6de6e Apply Style/TrailingCommaInHashLiteral rule in ERB 2021-02-05 17:46:23 +01:00
Javi Martín
2eb255e85a Apply Rails/SafeNavigation rule in ERB files 2021-02-05 17:46:23 +01:00
Javi Martín
0911b89d16 Add name attribute to heading content blocks
This way we can simplify the code and don't have to rely on `.try`
statements which are confusing and so we don't allow them in the
`Rails/SafeNavigation` Rubocop rule.
2021-02-05 17:46:23 +01:00
Javi Martín
2d37a0396b Apply Layout/ExtraSpacing rule in ERB files
Note that in Ruby files this rule allows vertical alignment, but doesn't
seem to do the same in ERB. Since we only used vertical alignment in one
place, and that place also had an unneeded extra space on every aligned
line, I've decided to change the code in that place and follow the rule.
2021-02-05 17:46:23 +01:00
Javi Martín
4809a87a78 Apply Style/HashSyntax rule in ERB files 2021-02-05 17:46:23 +01:00
Javi Martín
67c6515405 Apply Style/CollectionMethods rule to ERB files 2021-02-05 17:46:23 +01:00
Javi Martín
32ef8ff301 Unify Ruby and ERB Rubocop rules
So now we remove duplication between .rubocop.yml and the rubocop rules
defined for erblint. Having the rules in two places led to some
mistakes, like renaming Layout/Tab to Layout/IndentationStyle in
`.rubocop.yml` but forgetting to do so in `.erb-lint.yml`.

This also means we can use the EnforcedStyle options for
Layout/SpaceInsideHashLiteralBraces in views as well.

We couldn't implement this feature earlier because it required Ruby 2.4
and due to incompatibilities between versions of erb_lint and versions
of rubocop.

There are some rules which do not apply to ERB files and so we're
disabling them.

* Layout/LineLength, Layout/TrailingEmptyLines and Lint/UselssAssignment
  generate false positives
* Rails/OutputSafety is redundant since its functionality is already
  covered by ERB Lint ErbSafety linter
2021-02-05 17:45:50 +01:00
Javi Martín
f864156b21 Add and apply ClosingErbTagIndent ERB Lint rule
Note this rule does still allow us to add new lines after opening tags;
it just makes sure that if we do, we also add it in closing tags.
Likewise, if we don't add it in the opening tag, it forces us not to add
it in the closing tag either.

I don't have a strong preference about either style; in these cases I've
chosen the latter because it seemed more common in our code.
2021-02-05 17:39:42 +01:00
Javi Martín
9b0026061e Specify erb_lint version in Gemfile
Just like we do for the rest of the gems.
2021-02-05 16:24:55 +01:00
dependabot-preview[bot]
12fa241027 Bump erb_lint from 0.0.28 to 0.0.35
Bumps [erb_lint](https://github.com/Shopify/erb-lint) from 0.0.28 to 0.0.35.
- [Release notes](https://github.com/Shopify/erb-lint/releases)
- [Commits](https://github.com/Shopify/erb-lint/compare/v0.0.28...v0.0.35)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-02-05 16:24:55 +01:00
Javi Martín
fe1ef43f76 Merge pull request #4345 from consul/sdg_list_refactor
Refactor tags and SDG "tags" rendering
2021-02-04 12:46:35 +01:00
Javi Martín
92a09f74b0 Remove obsolete tag list rule
This rule was added so the tag list wouldn't have an extra bottom
margin. However, the rule is already applied by the `.tags` selector
inside `.budget-investment` and it was conflicting with other lists
(goals and tags) we've added to thi investments index.
2021-02-04 12:32:03 +01:00
Javi Martín
2712cc15e3 Merge pull request #4343 from consul/taggables_fix
Fix tags and SDG "tags" on legislation proposals
2021-02-03 19:24:00 +01:00
Javi Martín
7d4e49a090 Reorganize SDG tag list components
So now we've got a component receiving records (goals or targets) and a
related model (Debate, Proposal, ...), with optionally a link to see
more tags.

This way we simplify some logic since the `TagList` classes were dealing
with too many cases (a record is passed, a class name is passed, a limit
is passed), ... Now `TagList` only deal with the natural `TagList` case,
which is listing the tags for a record. The case where a class name is
passed is used in the `TagCloud` class.
2021-02-02 22:22:40 +01:00
Javi Martín
a78663120a Extract component to render a goal/target tag 2021-02-02 22:22:40 +01:00
Javi Martín
999d1a2cfd Rename goals FilterLinks component to TagCloud
This is more consistent with the "tag_cloud" partial name.
2021-02-02 22:22:39 +01:00
Javi Martín
ad56b01a9a Extract component to render "see more" link 2021-02-02 22:22:37 +01:00
Javi Martín
6112016773 Extract component to render a list of tags 2021-02-02 21:56:45 +01:00
Javi Martín
7c4515d6ce Simplify code to generate "See more" link
We can skip the `link_to(*options) if options` part if we accept anchor
tags in the `link_list` helper.
2021-02-02 20:05:40 +01:00
Senén Rodero Rodríguez
fb611d91ca Fix legislation proposal crash with SDG enabled
Now we check the given record or name is a relatable instance or class
to avoid trying to render goals for records which don't have a goals
association.

Note for now we are ignoring the case where we pass a controller_path
for an unsupported class (for example, `legislation/proposals` or
`budgets/headings`) because we never use it. We might need to revisit
this case in the future.

Co-Authored-By: Javi Martín <javim@elretirao.net>
2021-01-31 14:44:53 +01:00
Javi Martín
7318112e90 Merge pull request #4341 from consul/sdg_widget_tags
Add SDG tags to most active feeds
2021-01-31 14:10:35 +01:00
Senén Rodero Rodríguez
046e2273c7 Add tests for SDG::ProcessEnabled model
We were testing it through other models, but unit tests help when
changing the code of this class.

Co-Authored-By: Javi Martín <javim@elretirao.net>
2021-01-31 13:56:05 +01:00
Senén Rodero Rodríguez
450b157a5e Fix tag links on legislation proposals
On commit 1a902a96 we removed this helper to make use of polymorphic
routes but when it's called for Legislation::Proposal fails as the
namespace does not match the model namespace.

Now we recover the removed helper but only the parts that do not work
with polymorphic_url helper.

Co-Authored-By: Javi Martín <javim@elretirao.net>
2021-01-31 13:56:05 +01:00
taitus
35db41827c Add tag list component to process feed
Remember that this component (widget/feeds/process) is displayed both in
the home page and in the target index.
2021-01-31 13:53:57 +01:00
taitus
ca36dd56f0 Add tag list component to proposal feed 2021-01-31 13:53:57 +01:00
taitus
edbef4fd88 Add tag list component to debate feed 2021-01-31 13:53:57 +01:00
Javi Martín
60f3cc8cf9 Merge pull request #4329 from consul/sdg_polls_processes
Display related SDG and targets on polls and processes
2021-01-31 13:44:51 +01:00
Senén Rodero Rodríguez
2f9caa502a Darken goal icons on link hover
As they not seem to be interactive elements.
2021-01-31 13:33:28 +01:00
Javi Martín
a877449936 Add related SDG and targets tags to processes
I'm not sure why we were using squares to style these lists see commit
bbacd4546b) but I don't think it's very important and it breaks
displaying the list of related SDGs.
2021-01-31 13:33:27 +01:00
Javi Martín
19bab5a9dc Add related SDG and targets tags to polls 2021-01-31 13:33:27 +01:00
Senén Rodero Rodríguez
bb1315def1 Prepare SDG tag list component to render list with or without links
Now the tag list can render tags with or without links, so we need
to adapt the styles slightly.

We want to use the same text color for tags without links.

The hover style is only needed when using tags with links.
2021-01-31 13:33:26 +01:00
Senén Rodero Rodríguez
cc2ce38d13 Create SDG target component to render plain tags 2021-01-31 13:33:25 +01:00
Senén Rodero Rodríguez
54843c1e53 Create SDG goal component to render plain tags 2021-01-31 13:33:25 +01:00
Javi Martín
0f52d22b70 Merge pull request #4342 from consul/sdg_sort_performance
Improve performance sorting SDG records
2021-01-30 17:42:27 +01:00