Commit graph

19 commits

Author SHA1 Message Date
Fabien Basmaison
b92ff9752d [assets] Remove UI and behaviours for interactions:
This commit addresses https://github.com/mouse-reeve/bookwyrm/pull/883#discussion_r609739553.
2021-04-08 17:37:29 +02:00
Fabien Basmaison
2f90b4ce66 [assets] Fix broken actions for focus and checkbox:
This commit should address the following two comments:

- https://github.com/mouse-reeve/bookwyrm/pull/883#discussion_r609172258
- https://github.com/mouse-reeve/bookwyrm/pull/883#discussion_r609174513
2021-04-08 11:37:14 +02:00
Fabien Basmaison
83bd417878 [assets] Update interactions code:
This commit should address https://github.com/mouse-reeve/bookwyrm/pull/883#discussion_r609381969.

- Disable the button being used to submit the form.
- Rename variables based on @mouse-reeve’s explanations. Thanks! 
2021-04-08 11:08:13 +02:00
Fabien Basmaison
f77088b964 [assets] Remove redundant class already provided by bulma:
Replace all classes `hidden` with `is-hidden` in templates, CSS and JS.
2021-04-07 17:31:00 +02:00
Fabien Basmaison
54805afb51 [assets] Tweak JSDoc. 2021-04-07 10:37:11 +02:00
Fabien Basmaison
5d569e8926 [assets] Only update status if the promise is successful:
- Use promises in `ajaxPost` and `interact`.
- Add some animations in CSS.
2021-04-07 09:24:34 +02:00
Fabien Basmaison
1c05107f2b [assets] Tweak comments. 2021-04-07 07:53:30 +02:00
Fabien Basmaison
44040201f9 [assets] Move interact function. 2021-04-06 17:57:39 +02:00
Fabien Basmaison
9d95f54aa2 [assets] Refactor toggleAction and toggleMenu a bit. 2021-04-06 17:48:56 +02:00
Fabien Basmaison
52d2f0e331 [assets] Document functions and variables:
- Use expressive names for variables.
- Add docblocks for each function.
- Add ESLint rules for comments.
2021-04-06 16:17:20 +02:00
Fabien Basmaison
5d3d00f694 [assets] Use dataset + use expressive names for some variables. 2021-04-06 15:36:34 +02:00
Fabien Basmaison
62fe2ef600 [assets] Replace inline events with addEventListener; this breaks sliding menu. 2021-04-06 11:37:23 +02:00
Fabien Basmaison
7e49b3cb26 [assets] Simplify addRemoveClass function. 2021-04-06 11:19:44 +02:00
Fabien Basmaison
70c652d565 [assets] Add rules to ESLint:
- Fix long line.
- Enforce a few stylistic habits:

    - Avoid some potential dangerous constructs.
    - `arrow-spacing`: Use at least one space around arrows.
    - `keyword-spacing`: Use at least one space around keywords (if, else, for…).
    - `no-multiple-empty-lines`: Only use one empty line between code.
	- `no-var`: Use `let` or `const` instead of `var`:
    - `padded-blocks`: Do not pad blocks.
    - `padding-line-between-statements`: Use empty lines between some statements.
    - `space-before-blocks`: Use at least one space before the opening brace of a block.
2021-04-06 10:42:52 +02:00
Fabien Basmaison
991d897ac7 [assets] Listen to events as soon as possible. 2021-04-06 09:57:52 +02:00
Fabien Basmaison
2f2f7db086 [assets] Use classes for JS files:
- Classes strictly parse code implicitly.
- Fix previously updated code.
2021-04-06 09:44:59 +02:00
Fabien Basmaison
f6c3e581b9 [assets] Replace Array.from(document.getElementsByClassName(…)) by querySelectorAll(…). 2021-04-06 09:11:27 +02:00
Fabien Basmaison
6b0a3ce4b1 [assets] Move localStorage chunks of code to their own file:
This should prevent a sync issue with updateDisplay not always being loaded on time.
2021-04-06 09:06:51 +02:00
Fabien Basmaison
5aea7343b4 [assets] Rename some files for consistency. 2021-04-05 16:16:48 +02:00
Renamed from bookwyrm/static/js/shared.js (Browse further)