Commit graph

1211 commits

Author SHA1 Message Date
Ridhwana
1c46207f91
Tests for the Multi Input Crayons Component (#18186)
* feat: add the labels

* feat: tests

* update specs following validation merge

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
2022-07-27 12:25:13 -06:00
Suzanne Aitchison
caec27c300
Dynamically change number of formatter buttons in md toolbar overflow menu (#18224)
* dynamically change number of formatter buttons in the overflow menu

* add specs
2022-07-27 17:40:48 +01:00
Arit Developer
3fa350c7f2
Revert "Relocate and Refactor "Flag User" Action (#18182)" (#18232)
This reverts commit 8f544ab6ed.
2022-07-27 12:10:22 -04:00
Arit Developer
8f544ab6ed
Relocate and Refactor "Flag User" Action (#18182)
* building again

* still building

* still building

* stuck

* Suzanne Holmes on the case

* make report content a button not a link

* revert to link

* add tests

* revert changes made trying to get ModCenter to work

* hide nonworking actions_panel btns in Mod Center

* nudge Travis

* incorporate PR comments

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
2022-07-27 10:47:17 -04:00
Ridhwana
4101e8fdd6
Remove Member Index View Feature Flags (#18191)
* feat: remove feature flags

* separate forms for the duplicating layouts

* tweak controls and filters

* remove partial no longer used

* retain layout when pagination appears or disappears

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
2022-07-27 08:57:07 +01:00
Ridhwana
da72926428
Multi Input Crayons Component Documentation (Storybook) (#18188)
Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
2022-07-26 17:07:34 -04:00
Suzanne Aitchison
75d5ff9e23
minor style fix to editor toolbar (#18211) 2022-07-25 16:49:25 +01:00
Suzanne Aitchison
dab96a77f5
add clear all functionality to filters modal (#18210) 2022-07-25 16:47:41 +01:00
Ridhwana
ffa5e023bb
Implementing validation for the Multi Input Crayons Component (#18185)
* WIP: add the validation

* feat/WIP: set the color of the button to red

* feat: change color temporarily

* feat: add accessibility for validation

* feat: add the styling changes for the multi input

* feat: add focus visible styling as well

* fix: add comma to scss file to separate attributes

* chore: rename regex to inputRegex

* refactor: move out validation into a function

* chore: rename regex to inputRegex

* feat: add a validation Regex as a prop

* feat: update the text description

* chore: update spelling oops

* feat: remove comment

* remove comments

* rename error

* feat: add showLabel and labelText to the stories component

* cater for when we don't pass in a validationRegex

* some small tweaks

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
2022-07-22 12:51:06 +01:00
Josh Puetz
fc1031f52a
Add Google Analytics 4 Support (#18124) 2022-07-21 09:26:13 -05:00
Anna Buianova
656d698da1
Modify datetime picker for scheduling articles (#18153)
* Accept separate date and time for published_at

* Separate date and time inputs for published_at in post options (scheduling)

* Removed the commented line

* Removed unused htmlFor publishedAt

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>

* Added aria-label for published at date

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>

* Added aria-label for published at time

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>

* Added htmlFor for schedule label

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
2022-07-21 13:53:54 +03:00
Jhonatan Hidalgo
66c3217c12
Add copy/paste images in comment editor (#18149)
* Add copy/paste images in comment editor

* Use hook instead of oneChange
2022-07-20 17:02:18 +01:00
dependabot[bot]
bf029dc731
Bump preact from 10.9.0 to 10.10.0 (#18143)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
2022-07-19 16:33:03 -05:00
Suzanne Aitchison
817db3e6f8
keyboard shortcuts in comment text area (#18117) 2022-07-18 12:01:48 -04:00
Suzanne Aitchison
76c7932b09
Member index: Filter by joining date (#17975)
* add the date picker into view

* allow date picker to overflow modal

* allow aria labels to be passed to inputs

* filter records

* add missing comment

* set earliest date

* specs and a small fix

* cypress spec

* fix typo

* tidying up

* fetch date_format

* commit code review suggestion to params

* Revert "commit code review suggestion to params"

This reverts commit 84fb0e0d3acc13257a362eb41c17b2bb8089606a.

* show added filter pill

* add cypress specs for applied filters

* woops! fix unintended change to filter code
2022-07-14 14:52:42 +01:00
Suzanne Aitchison
d9e79d6e70
try to make DRP spec more robust (#18115) 2022-07-14 07:05:25 -06:00
Suzanne Aitchison
5166581a34
remove filter by last activity, fix close modal bug (#18081) 2022-07-13 13:58:14 +01:00
Suzanne Aitchison
02bba1c943
skip flaky date range picker spec (#18076) 2022-07-12 10:06:52 -06:00
Suzanne Aitchison
2f436731a7
Add markdown toolbar to comments (#18062)
* show the toolbar (WIP - includes some hacks and todos)

* allow calling component to pass additional toolbar elements

* add templates behaviour

* get templates working

* tweaks following mention autocomplete refactor

* remove image upload handler no longer needed

* rename method

* some small refactors

* only comment text area controls visibility of templates area

* fix error in role name

* fix mobile view

* update specs
2022-07-12 09:02:53 +01:00
Suzanne Aitchison
75d6e60a95
✂️ Remove reach combobox ✂️ (#17728)
* WIP: new autocomplete, search executed, dropdown positioned

* WIP: most features working in Editor

* handle textarea blur

* fix bug with id not attached to textarea

* updates to textAreaUtils tests

* aria live, fix border style

* replace comment text area

* fix some height and style issues

* update preact tests

* clean up styles, rename files, use portal for popover

* clean up styles, rename files, use portal for popover

* scroll popover items into view if necessary

* refactor cypress specs

* actually remove the package

* add some more specs

* remove storybook stories for now

* remove relative class causing issues

* small fixes for cypress specs

* make live region assertive to ensure change to combobox is known

* some comments

* add a storybook story

* replace % font size, add explainer to story
2022-07-11 12:50:52 +01:00
Anna Buianova
ff76cdd3c5
Scheduling articles (#17939)
* Article query spec for scheduled articles

* Added scheduled article badge on the user dashboard

* Added published_at field to editor options

* Accept and validate published_at from editor

* Refactor published_at validation

* Allow 1-minute difference in published_at

* Notice on an unpublished article page

* Added specs for 'Click to edit' link on scheduled article preview page

* ContextNotification model

* Articles::Publish worker

* Added specs for articles publish worker

* Schedule publish articles worker

* Added tests to check for scheduled posts in feeds

* Don't allow managing scheduled articles

* Don't send notifications for scheduled articles

* Set published_at in Articles::Updater when publishing

* Published_at value in post options

* Pass timezone and set published_at accordingly

* Limit setting published_at to the future

* Readonly published_at for articles that were already published

* Chagning published_at format in editor v1 (start)

* Changed published_at format in frontmatter, specs

* Added specs for updating published_at from frontmatter

* Fixed accepting past published_at for articles published_from_feed

* Enabled published_at validation: don't allow updating published_at for already published articles

* Validate published_at on create

* Added a spec for updating published_at for exported articles

* Fixed specs related to creating articles with past published_at

* Fixed specs related to past published_at for articles

* Added a hack so that admins would be able to update published_at

* Switch button text schedule/publish when changin publishedAt

* Fixed saving published_at with timezone

* Added a feature flag for scheduling articles

* Default text in markdown editor depends on feature flag

* Enable article editor cache again

* Fixed the default value in the markdown editor

* Fix sitemaps spec

* Removed tooltip

* Fixed articles update specs

* Added missing locales

* Fixed article create specs

* Fixed spec

* Removed commented code

* Returned enabling extensions in the schema

* Returned accidentally deleted constraint

* Make articles query spec more stable

Co-authored-by: Jeremy Friesen <jeremy.n.friesen@gmail.com>

* Removed commented code

* Removed unused code

* A clearer policy

Co-authored-by: Jeremy Friesen <jeremy.n.friesen@gmail.com>

* Use StringInquirer for article current state

* Added a note and todo to articles factory past trait

* Remove duplicated PropType

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>

* Refactor query in the Articles::PublishWorker

Co-authored-by: Mac Siri <krairit.siri@gmail.com>

* Refactor articleForm.jsx

Co-authored-by: Mac Siri <krairit.siri@gmail.com>

* Removed specs that are no longer relevant

* Removed useless onKeyUp on a hidden input

* Refactored articleForm

* Hide scheduling from post options when published_at is readonly

* Run sends notifications worker every 5 minutes instead of every minute

Co-authored-by: Jeremy Friesen <jeremy.n.friesen@gmail.com>
Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
Co-authored-by: Mac Siri <krairit.siri@gmail.com>
2022-07-07 17:32:49 +03:00
Rajat Talesra
5966960c04
Create Preview Loading screen (#17914)
* Minor changes

* Basic implementation with some bugs

* Removed files

* Correct tab selection

* Added tests

* Disabled bottom bar buttons on preview loading

* Applied other changes

* Added tests for PageTitle

* Added tests for LoadingPreview

* Added test for Options.jsx

* Removed comments

* Fixed CSS

* Removed unused code

* Fixed test failure

* Added aria-live

* Nit fixe

* Fixed tests

* Applied suggested changes
2022-07-07 19:21:50 +05:30
Rajat Talesra
bc0e5ced6c
Used PreactModal for unpublish-post feature (#18019)
* Used preact modal

* Minor fix

* UI fix

* Appplied minor suggestions
2022-07-06 16:29:08 +05:30
Suzanne Aitchison
d806393642
Validate date format and min/max in date range picker component (#18006)
* add validation behaviour

* add specs

* refactor into a hook
2022-06-30 10:08:06 +01:00
Dwight Scott
50e2131079
mod panel update unpublish all posts action 17709 (#17923) 2022-06-27 16:50:31 -04:00
Arit Amana
750d379807
Allow ModRole & Admin to Suspend & Unsuspend User (#17946)
* gotta commit at some point

* out of gas

* IT'S WORKING NOW! 💥

* Cypress tests

* fix Travis failures

* incorporate PR review suggestions

* fix one failing Cypress test

* update API call

* add Unsuspend flow; fix Travis failures

* add tests for unsuspend flow

* remove unnecessary atrribute

* add article_policy spec

* fix failing Travis

* nudge Travis

* fix apparent typo  o o 🤷

* refactor a bunch of duplication

* nudge Travis

* fix Cypress failure related to authorizing moderator for user_status action

* rename modal partial

* remove unnecessary button-exists check

* address PR review suggestions

* hide suspend user btn after action

* toggle btn based on author suspension status

* add data-testids

* use data-testids

* controller refactor
2022-06-27 12:45:35 -04:00
Fernando Valverde
8c836430ca
API V1 transition (#17835)
* API Articles v0-v1 restructure

* Remove unused helper

* Bulk move API controllers into concerns + add V1 controllers

* Extract API routes + some fixes

* Fix v1 api_controller authenticate! + add more article_controller specs

* Completed spec/requests/api/v1/articles_spec.rb

* specs up to listings

* All v1 specs except for 9 skips

* mime_types cleanup + authenticate! relocation

Co-authored-by: Fernando Valverde <fernando@visualcosita.com>
2022-06-23 14:26:00 -06:00
Ridhwana
abeff25ec0
BETA version 2 of the Storybook Multi Input (Editing and Accessibility) (#17894)
* refactor: use the DefaultSelectionTemplate to list out the items

* refactor: rename function so that we map it to the deselect item event

* feat: first pass of adding edit functionality

* feat: update the name of the function from clearSelection to clearInput

* feat: setup the edit state by ensuring that we set the editValue and the inputPosition and then use useEffect to monitor changes

* chore: remove the old method in favour of a shared component

* feat: set the order of the items

* refactor: rename handleBlur function name to handleInputBlur

* feat: ensure that the edit field gets resized according to its current input

* feat: oops add inputSizerRef

* feat: when an item is being edited we need to ensure that it gets set back into the correct position and that we clear the previous state

* feat: handle the actual resizing fo the field on an input edit

* feat: use a shared DefaultSelectionTemplate for both the multiautocomplete and the multiinput component

* feat: make the defaultSelectionTemplate customizable based on the variant adn the classname

* feat: pressing backspace will start editing a previous selection if there is one

* feat: read out the selected items as its removed or edited

* feat: pass the regex through as a prop

* feat: move the functions around

* feat: add screen-reader only class

* Update app/javascript/crayons/MultiInput/__stories__/MultiInput.stories.jsx

Co-authored-by: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com>

* Update app/javascript/crayons/MultiInput/MultiInput.jsx

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>

* feat: add the props to JSDoc

Co-authored-by: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com>
Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
2022-06-23 15:41:45 +02:00
Suzanne Aitchison
8bd7e4eba9
Member index: Show applied roles filters (#17954)
* show the pills

* clicking pills removes filter

* add some more spacing

* another alignment tweak

* add cypress spec

* put it behind the feature flag

* make the clear all link a button for consistency

* tweak to comment for clarity
2022-06-21 16:27:26 +01:00
Josh Puetz
bb4f8fa2b5
Track clicks and views in comments on article page (#17886)
Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
2022-06-21 09:19:55 -05:00
Suzanne Aitchison
1eefc3d3cd
remove storybook addon-links (#17935) 2022-06-16 15:03:47 -04:00
Suzanne Aitchison
b94c5deea6
Admin member index: filter by member roles (#17884)
* prevent ID conflicts in filters modal by caching content

* show roles with expandable section

* minor tweak

* don't use the hidden field

* send array of role

* role -> roles. small refactor

* set initial checked status

* show an indicator when a filter is applied

* add JS to toggle filter clear buttons and indicators

* update some comments, make sure users only appear once in list

* add some cypress specs, fix some bugs
2022-06-16 15:06:35 +01:00
Joshua Wehner
07e1364f54
Trusted users can view & use moderator response templates (#17867)
* Trusted users can use moderator response templates

* Iron out container reveal logic

* Explanatory comment on controller endpoint confusion
2022-06-16 14:05:49 +02:00
Fernando Valverde
6b073d078b
Enable clickOutsideDeactivates on Onboarding FocusTrap (#17885) 2022-06-13 08:23:46 -06:00
Julianna Tetreault
8e4b6581e2
Member Index View Actions: "Assign Role" (#17866)
* Adds the Assign Role modal to the Member Index View

* Adds e2e tests for the Assign role modal

* WIP: Conditionally redirects to the correct view upon assigning a role

* Conditionally renders the redirect in the correct method :|

* Adjusts the conditional redirect to account for ID

* Adds an even more explicit check for the correct refferer
2022-06-10 07:22:03 -06:00
Rajat Talesra
27c6f07686
Feature/add embed icon to editor toolbar (#17781)
* Finished task 1 and task 3

* Task 2:  If the user already has text selected inside syntax

* Added comments

* Tests added

* Nit fixes

* Code optimisation

* Nit fixes

* Fix typo

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>

* Removed console log statements

* Minor fix

* Simplified code

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
2022-06-10 17:33:23 +05:30
Suzanne Aitchison
6c9a09c344
Add quick select ranges to date range picker (#17850)
* Add utils for preset date ranges

* show the preset options in the calendar

* allow ranges to be selected in storybook

* add some more docs

* add missing prop type

* add tests

* move story out of beta

* fix last time periods

* small refactors
2022-06-08 15:48:06 +01:00
Joshua Wehner
8be41307cf
Unpin article should behave more like Pin article (#17798)
* Unpin article should behave more like Pin article
* Don't repeat pinned article on index
2022-06-07 14:18:43 +02:00
Viviane Dias
938a726381
[listing-dashboard] Refactor class components to be functional component (#17764)
* refactor(listings-dashboard): migrates comp to pure comp

* refactor(listing-dashboard): organizes data setup for tests

* refactor(listing-dashboard): uses func to setup tests and starts using screen

* test(listing-dashboard): refactors tests using role query and expects

* test(listing-dashboard): separate first listing tests into another description block

* test(listing-dashboard): separate second listing tests into another description block

* test(listing-dashboard): separate third listing tests into another description block
2022-06-07 11:50:47 +01:00
Ridhwana
fe447694ed
BETA version of the Storybook Multi Input (#17828)
* feat: create a crayons component called MultiInput that appears under App Components/MultiInput

* feat: add the doc describing the components to storybook

* feat: create the component ina  different file and reference its usage from the stories

* feat: add a random class to hook up a stylesheet to the component

* lets just copy soem HTML

* chore: remove arias that will not be used for the multiinput

* feat: update the classnames and remove unneeded html

* feat: multi input css updates

* feat: add the ability to set the list of emails using state

* feat: add the ability to clear the input selection

* feat: remove item

* feat: handle key events like space, comma and enter in the input

* refactor: clean up code a bit

* refactor: rename email to item

* fix: remove space keydown as its causing weird behaviour

* refactor: remove unused css now that we using pills

* feat: ensure that we do not add blank pills

* feat: add the component to BETA

* feat: rename addToList to addItemToList to be more verbose

* feat: add the first component prop i.e. placeholder

* feat: add a more descriptive text

* feat: add a padding to the field

* remove unused arial labels, and erword soem descriptions

* feat: add imports to scss

* Update app/javascript/crayons/MultiInput/MultiInput.jsx

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>

* Update app/javascript/crayons/MultiInput/MultiInput.jsx

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>

* Update app/javascript/crayons/MultiInput/__stories__/MultiInput.mdx

Co-authored-by: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com>

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
Co-authored-by: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com>
2022-06-07 12:22:33 +02:00
Arit Amana
1679fbf47d
Allow Moderator Role to Unpublish Single Post (#17795)
* relocate btn; build functionality for admin only

* remove commented code

* add explanatory comment

* refactor

* build unpublish and feature-post policies

* mod role in policies fails specs 😓

* fix failing specs

* add end-to-end tests

* fix hardcoded name in modal  😓
2022-06-03 12:48:20 -04:00
Andy Zhao
103394d5ad
Add tooltip to cover image button describing optimal image ratio (#17779)
* Add tooltip for cover image button

* Add cover img tooltip to v1 editor

* Use a slightly different message

* Fix tests

* Use proper comment syntax for front matter

* Fix Cypress test

* Use regex to find matching label
2022-06-02 17:44:34 -04:00
Suzanne Aitchison
c119b64b74
Reusable user admin modals (#17763)
* target modal content by a classname to avoid duplicate IDs

* woops - fix missed selector

* use showWindowModal in editUser

* move add org to a partial

* move add role into a partial

* move adjust credits to a partial

* move profile modals to be re-used

* generalise approach to add organisation modal

* generalise add role modal form

* generalise adjust credits modal

* rework unpublish modal

* refactor banish user modal

* refactors

* prevent issues with duplicate ids

* fix banish form action

* make sure role management specs covered in cypress

* let hidden modal content use IDs

* rename file for clarity

* add some JSDoc notes

* cleanup some redundant changes

* one more

* woops - fixed id that contained a classname
2022-06-02 09:52:26 -06:00
Ikko Ashimine
127fe37e19
Fix typo in runtime.js (#17783)
succesful -> successful
2022-05-31 14:30:04 -04:00
Suzanne Aitchison
02cdaed8e6
layout tweaks for mobile (#17771) 2022-05-31 10:55:19 +02:00
Viviane Dias
94c431afb0
[single-article] Refactor class components to be functional component (#17681)
* refactor(single-article): migrates class to use pure components

* test(single-article): removes repeated test from file
2022-05-26 12:59:06 +01:00
Viviane Dias
0960b36d92
[categories] Refactor class components to be functional component (#17682)
* feat(categories): migrate Categories to pure component

* test(categories): adds tests to Categories comp
2022-05-26 12:53:25 +01:00
Suzanne Aitchison
f545b4b73f
localize display of US and non-US date format (#17758) 2022-05-25 17:08:00 +01:00
Suzanne Aitchison
c93794f987
Initial BETA storybook version of DateRangePicker (#17742)
* WIP initial component/story

* examples of customisation

* populate the month year pickers

* change the calendar view when the month or year is chosen

* fix which dates should be disabled

* style left right nav buttons

* add calendar icon, fix some date range styles

* extract some color variables

* some minor changes to styles and comments

* add phrases, allow all dates to be toggled in story

* consolidate styles

* conditional navigation given max and min dates

* labels on selects, tweaks to story

* undo unrelated changes from merge

* undo unrelated changes from merge

* undo unrelated changes from merge

* undo unrelated changes from merge

* retry adding dependencies, not feeling hopeful XD

* is this a preact issue?

* Revert "is this a preact issue?"

This reverts commit 5f3f720f8e739cc3dcca7fd54f8d97e08d8bb88c.

* without css import

* import styles via sass file, not component

* Apply suggestions from code review

Co-authored-by: Ridhwana <Ridhwana.Khan16@gmail.com>

Co-authored-by: Ridhwana <Ridhwana.Khan16@gmail.com>
2022-05-24 17:43:58 +01:00
Suzanne Aitchison
e62684342f
Member index view - collapse other filter sections when one is clicked (#17740)
* collapse any filter sections when a new one is clicked

* add a cypress test
2022-05-24 14:51:18 +01:00