Commit Graph

116 Commits

Author SHA1 Message Date
Javi Martín
2c9c5d9cd4 Extract component to render avatars in comments
This way it'll be easier to add tests for it and refactor it.
2024-04-11 18:48:33 +02:00
taitus
45d82d6e6b Move comments form to component 2024-03-25 07:59:39 +01:00
Javi Martín
517f74a748 Extract component to render an initialjs avatar
This way it'll be easier to change it.
2023-10-10 15:03:35 +02:00
taitus
c96e3b027f Replace Partials with Direct Component Rendering
In this commit, we have performed a refactoring to enhance code organization.
Several partials that were solely responsible for rendering components have been removed.

Instead, we are now directly rendering the components within the views where these
partials were previously used.
2023-10-06 18:13:45 +02:00
Javi Martín
8b13daad95 Add and apply rules for multi-line hashes
For the HashAlignment rule, we're using the default `key` style (keys
are aligned and values aren't) instead of the `table` style (both keys
and values are aligned) because, even if we used both in the
application, we used the `key` style a lot more. Furthermore, the
`table` style looks strange in places where there are both very long and
very short keys and sometimes we weren't even consistent with the
`table` style, aligning some keys without aligning other keys.

Ideally we could align hashes to "either key or table", so developers
can decide whether keeping the symmetry of the code is worth it in a
case-per-case basis, but Rubocop doesn't allow this option.
2023-08-18 14:56:16 +02:00
Javi Martín
7caee9a93c Show comments with hidden authors
In the past, whenever we hid users, we also hid their comments.
However, we've now implemented an action to hide users without hiding
their comments. In this case, we still want to show the comment, but we
weren't doing so.
2021-12-30 15:50:03 +01:00
Javi Martín
41a9d17c76 Add and apply Lint/SymbolConversion rubocop rule
This rule was added in Rubocop 1.9.0.

We're excluding the Setting model in order to keep the settings
consistent.
2021-09-03 11:49:53 +02:00
Senén Rodero Rodríguez
956f002738 Update parent comment responses count when a new reply is created
Extract the needed portion of code to a new partial to be able to update
only the elements needed when a new comment is added keeping UI properly
updated.
2020-05-26 13:20:26 +02:00
Javi Martín
ae41becd3a Use CSS to hide reply forms
We were using inline styles and passing local variables around, while
the rule we were following is very simple: it's only hidden if it's a
form to reply to a comment.
2020-05-12 23:57:57 +02:00
Javi Martín
4627372a62 Use a <ul> tag for a list of comments
We were using a <ul> tag for a single comment, where the first element
of the list was the comment itself and the second element was the list
of replies.

IMHO it makes more sense to have a list of all comments, where every
element is a comment and inside it there's a list of replies.

We're also rendering the list even if it has no children so it's easier
to add comments through JavaScript. Then we use the :empty CSS selector
to hide the list if it's empty. However, since ERB adds whitespace if we
structure our code the usual way and current browsers don't recognize
elements with whitespace as empty, we have to use the `tag` helper so no
whitespace is added.
2020-05-12 23:57:16 +02:00
Javi Martín
bedd879025 Remove redundant show/hide screen reader texts
These texts are redundant since we added the same texts for everyone in
commit 6b85ed87.
2020-05-12 23:23:01 +02:00
Javi Martín
41b9d2ba01 Simplify code to show/collapse comment replies
Tests are also a bit easier to read, even though we need to use the
`text:` option to find links because otherwise the text in the hidden
`<span>` tags will cause `click_link` to miss the link we want to click.

Here's an explanation by one of Capybara's authors:
https://github.com/teamcapybara/capybara/issues/2347#issuecomment-626373440
2020-05-12 23:23:01 +02:00
Javi Martín
06b7c6dbd3 Simplify comment partial variables
We were passing around many variables to condition the way we display
the comment. However, in the end we only had one place where these
variables were used: valuation. So we can make everything depend on the
valuation variable.
2020-05-11 16:09:23 +02:00
Javi Martín
573f861ad1 Don't use comment_flags to cache comments
Flagging a comment automatically updates the comment, so the cache
expires anyway, making the `comment_flags` variable redundant.
2020-05-11 16:09:23 +02:00
decabeza
111e3d3083 Replaces icons of expand/collapse comments 2020-04-16 23:22:14 +02:00
Javi Martín
2aabf79fb4 Rename methods to add auto links to HTML
The name `safe_html_with_links` was confusing and could make you think
it takes care of making the HTML safe. So I've renamed it in a way that
makes it a bit more intuitive that it expects its input to be already
sanitized.

I've changed `text_with_links` as well so now the two method names
complement each other.
2019-10-08 18:46:20 +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
lalo
d721920b97 Display commenter as admin description or name 2019-06-05 16:19:31 +02:00
decabeza
6b85ed8747 Add show and collapse text on comments tree 2019-05-31 11:40:57 +02:00
decabeza
0154bc556d Add link to comment path on comment date 2019-05-31 11:40:53 +02:00
Julian Herrero
f6489bc604 Use double quotes in app/views 2019-03-19 12:33:07 +01:00
Bertocq
5420cd36bf Disallow comment actions on valuation comments 2018-01-31 17:46:36 +01:00
Bertocq
9cb4b03276 Disallow valuation comment creation on finished budget 2018-01-31 17:07:56 +01:00
Bertocq
033c197580 Disallow comment flagging when showing valuations 2018-01-31 02:05:35 +01:00
Bertocq
1c3924b527 Hide comment voting at valuation comment threads 2018-01-31 02:04:16 +01:00
Bertocq
149c81371b Allow valuation internal comments to be created
How:

Using a local variable at partials to set a hidden true/false value for
`valuation` parameter on the comment creation form.

Allowing that new param at the comment controller and using it when
building a new Comment.
2018-01-31 02:03:02 +01:00
decabeza
73b61e8596 adds and removes spaces :neckbeard: 2017-09-19 20:38:08 +02:00
decabeza
1f58dd7545 removes hash comment id on comment replies link 2017-09-19 20:36:57 +02:00
iagirre
fb5fb866b5 Added space after <% and before %> in order to maintain consistency in the ERB code. Review of PR. 2017-09-13 17:44:11 +02:00
iagirre
1356ea217b Erased extra empty HTML for comments without replies. Added .gitignore rules for Netbeans projects
Cambios para hacer commit:
	modificado:    .gitignore
	modificado:    app/assets/javascripts/comments.js.coffee
	modificado:    app/views/comments/_comment.html.erb
	modificado:    spec/features/comments/debates_spec.rb
2017-09-13 13:30:37 +02:00
decabeza
3bcfaeb61a replaces sr-only class to show-for-sr 2017-06-13 17:51:57 +02:00
Amaia Castro
3009706b0d Don’t allow comments on questions for unverified users and when the phase is closed 2017-02-08 18:19:10 +01:00
kikito
68d598a43d Merge branch 'master' into budgets 2017-01-02 12:10:23 +01:00
Alberto Garcia Cabeza
3b28b56c5c improves html structure for comments 2016-12-28 14:36:06 +01:00
Alberto Garcia Cabeza
5bf09ec569 replaces span tag to div on comments votes 2016-12-27 16:33:06 +01:00
Alberto Garcia Cabeza
b8f60b48fe changes time tags to span 2016-12-27 16:30:56 +01:00
Alberto Garcia Cabeza
a95edee7c7 improves styles for reply and deleted comments 2016-12-27 16:29:32 +01:00
Alberto Garcia Cabeza
f0258fb3ee improves html structure for comments 2016-12-27 14:26:20 +01:00
kikito
9d97421b0e Merge branch 'master' into budgets 2016-12-27 14:02:12 +01:00
Alberto Garcia Cabeza
76a3c61020 improves html structure for comments on debates and proposals 2016-12-19 13:43:09 +01:00
kikito
2e8650c324 merge with master 2016-12-12 16:09:05 +01:00
Alberto Garcia Cabeza
ae12848e23 adds text for screen readers on toggle comments 2016-12-05 14:26:54 +01:00
kikito
84eb6fcfc1 Adds _comment_tree view 2016-12-02 19:20:33 +01:00
Alberto Garcia Cabeza
c3d70f6e95 Adds text for show comment children 2016-07-14 18:02:27 +02:00
rgarcia
9e910a834b Displays badge for official positions 2016-06-20 21:37:25 +02:00
Alberto Garcia Cabeza
08a17f3b0e Makes generic logos and avatars, and removes unused images 2016-04-21 14:05:30 +02:00
Alberto Garcia Cabeza
e3878ff437 Fixes icon animation on reply comments 2016-04-20 17:27:58 +02:00
Alberto Garcia Cabeza
cb6503d9a5 Fixes tag 2016-03-14 19:32:50 +01:00
Alberto Garcia Cabeza
3ec0971b37 Replaces icons i tags for span 2016-03-14 19:32:48 +01:00
Alberto Garcia Cabeza
3752f3a53b Adds foundation 6 🎉 2016-02-26 19:33:33 +01:00