Commit graph

27 commits

Author SHA1 Message Date
Suzanne Aitchison
5bed8f56d4
improve keyboard accessibility of modals 12427 10610 (#12511)
* adds focusTrap wrapper to preact Modal component

* add view specific code for focus trap in admin add nav link

* add script to return a focustrap toggle, use in add nav link modal partial

* add trap to edit nav link modal

* add handlers for sign up modal

* update modal controller for admin section, update nav link modals to use

* update other admin modals with new data values for trap

* remove unneeded erb script file

* remove unneeded target

* refactor to remove extra unneeded param

* remove duplicate code, store getFocusTrapToggle in window

* trap focus in comment and bookmark showModal instances for not logged in user

* remove need for activator id

* clean up id refs no longer needed

* remove custom code and re-use focsu-trap lib

* update storybook docs

* update default export in focusTrap

* prevent close button click triggering a modal toggle twice

* ensure if user navigates from a modal the trap is deactivated

* add jsdoc comments and add dynamic import

* ensure admin controller modal traps are cleaned up on disconnect

* update sign up modal to use crayons

* update modal controller and admin nav links modals to use preact modal

* update profile fields modals for new controller

* tweak styling of sign up and admin modals to match previous

* update listings modal to use crayons modal, adapt focus trap to work with click outside

* memoize deactivate callback to ensure modal can be presented on first page load

* add missed focustrap changes

* fix focus trap issues in onboarding flow

* refactor onboarding focus trap, remove getFocusTrapToggle

* tweaks for styling and article modal toggle

* add click outside tests to modal

* add cypress tests for the login modal

* update liquid tag tests affected by change

* refactors to address review comments

* fix issue with login modal presented twice on comment add

* change ids to selectors in admin modals

* small pr comment refactors

* add listings e2e tests

* add nav link modal tests

* fix issue with help modal

* tweak to fix ui bug from merge

* remove context from showLoginModal

* rename toggleModal

* rename state property for clarity

Co-authored-by: Nick Taylor <nick@dev.to>
2021-02-24 16:01:10 +00:00
João Gabriel Quaresma
b1e0dbcfa9
Add icon uploader in admin navigation links (#12388)
* Added svg image picker to navigation link form

* Added svg image picker to navigation link form

* removed unnecessary attribute at _form.html.erb

* Added targets into SvgIconUploadController

* Fixed accept file type in .erb and stimulus controller

* Fixed UI form elements
2021-02-04 13:54:59 +00:00
Ridhwana
d67a259d91
feat: update the messages on the page to use the filename instead of the id. (#12568) 2021-02-04 15:50:02 +02:00
Ridhwana
def4b95616
chore: counter should be 20 not 0 :/ (#12555) 2021-02-03 14:31:41 +02:00
Nick Taylor
4a67d66ec5
Stimulus controllers needed to be default exports. (#12543) 2021-02-02 13:35:28 -05:00
Ridhwana
530e927060
Add ability to re-run a data script from the the data update script page (#12424)
* feat: add an error column to the data update script

* feat: save the error to the error field

* feat: save the error when the script fails

* feat: show the script error on the data update script page

* chore: pass the error to mark_as_failed instead of having its own function

* refactor: use presence

* test: ensure that we test an error case of a data update script

* chore: rename errorneous to failing

* test: update some specs, working on the others

* chore: update tests now that there are two files

* chore: change error from a string to a text to allow for more char

* feat: order the data update scripts by the latest script that ran

* feat: when the script has succeeded reset error to nil

* feat: create a model function that will allow the script to be force run

* chore: oops remove the functions form the worker to the model so it can be re-used

* feat: create an endpoint that will call the model method force run when we hit the api by clicking the button

* feat: ensure that the we add an ajax call that calls the controller endpoint

* chore: remove newline

* refactor: change to a more Restful route

* refactor: use Stimulus

* fix: move the code from the model back into the worker so that we can reuse it in the controller

* feat:call the worker in the force_run action and create a show route

* feat: very first draft of using a polling mechanism on the show method after we kickoff the sidekiq job (still need to error handle)

* chore: some syntax changes and unused variables

* fix: call the method correctly with the paramters

* feat: do some error handling

* feat: error handing on the frontend

* chore: use e instead of err

* refactor: just pass the id instead of the whole script

* chore: remove the button

* fix: allow the id to be passed

* feat: handle errors better

* feat: limit the filename column width

* refactor: use a common function to set the banner error

* test: add a test fro rerun button

* test: v1 of the data update script request

* test: write some specs for the js controller

* Update app/controllers/admin/data_update_scripts_controller.rb

Co-authored-by: Michael Kohl <me@citizen428.net>

* tests: update the data worker spec

* chore: clean up the js controller and its tests

* chore: remove whitespaces

* chore: swap the functions based on the controller

* chore: updates to the UI

* chore: remove the standard error catch

* chore: update the alert and error messages

* chore: remove test for error handling for sidekiq run

Co-authored-by: Michael Kohl <me@citizen428.net>
2021-02-02 17:24:39 +02:00
Katie Davis
76453b41fb
Updates ESLint rules to error on default imports (#12512)
* add rule

* add named imports

* more missed files

* so many files
2021-02-02 10:24:03 -05:00
Arit Amana
3a984c8ee7
[2020 EOY Issue] Modal alert when enabling Auth Provider without keys (#12135)
* Start hooking things up

* further generalize adminModal, hook up relevant code

* Complete implementation

* remove comments

* Address QA suggestions

* Address QA suggestions

* Use object parameter for adminModal

* starting the admin cypress tests

* Code review suggestions

* remove incomplete test

* rename data attributes to make more sense

* complete the work

* use destructuring

* edit warning modal text
2021-01-13 13:54:39 -05:00
rhymes
202053cf96
Admin: Change label of toggle buttons in Configuration panel (#12183) 2021-01-11 16:38:16 +01:00
Julianna Tetreault
ca6ba1af7d
Replace collective_noun with community_name (#11846) [deploy]
* Removes collective_noun and collective_noun_disabled from app

* Config Generalization: replaces community_qualified_name with community_name
  - Generalizes SiteConfig after the removal of collective_noun field
  - Updates copy where necessary to be readable with community_name
  - Makes the community_name SiteConfig description more explicit
  - Adds flexibility for Admins by removing appended "community"

* Adds a data_update script to remove collective_noun and collective_noun_disabled

* Removes appended community from stories_controller.rb

* Removes unnecessary quotation marks around SiteConfig.community_name.to_s

* Makes SiteConfig community_name description more explicit

* Removes topic from #email_from and replaces arg with _

* Removes argument from #email_from (facepalm)

* Reverts changes to application_mailer and notify_mailer_spec

* Removes default "Community" topic from application_mailer and makes topic optional

* Refactors #prepopulate_new_form to resolve Code Climate failures

* Refactors #email_from even further by use of a ternary operator per review suggestion

* Simplifies the data_update script used to remove collective_noun per review request

* Adds a data_update script to append community to community_name

* Updates data_update script to correctly append Community to community_name

* Removes RemoveCollectiveNounFromConfig and updates other script

* Removes superfluous false from data_update script

* Updates data_update script to be more idiomatic
2020-12-28 09:34:17 -07:00
rhymes
7eb7cef1b9
Upgrade Admin to Stimulus 2.0 (#11776)
* Upgrade Stimulus to 2.0

* Convert ArticleController to use Stimulus 2

* Convert ModalController to Stimulus 2

* Convert BufferController to Stimulus 2

* Convert ConfigController to use Stimuus 2

* Convert ImageUploadController to Stimulus 2

* Convert Reaction controller to Stimulus 2
2020-12-08 10:43:56 +01:00
Arit Amana
42e10e7b42
[EOY2020 Issue] Default new forems to Email Authentication only (#11696)
* Set default Auth Providers to empty array

* complete implementation; tests remain

* tests

* fix failing specs authenticator_spec.rb

* Fix failing specs

* fix more failing specs

* fix more failing specs 2

* update failing spec

* Update app/views/admin/configs/_auth_provider_settings.html.erb

Co-authored-by: Vaidehi Joshi <vaidehi.sj@gmail.com>

* Update app/assets/stylesheets/admin.scss

Co-authored-by: Vaidehi Joshi <vaidehi.sj@gmail.com>

Co-authored-by: Vaidehi Joshi <vaidehi.sj@gmail.com>
2020-12-02 16:49:07 -05:00
Ben Halpern
f3a69bbd84
Allow Forems to specify which domains are allowed for registration (#11442)
* Allow authors to restrict which emails can sign up

* Add form and tests

* Check for email presence in allowed email flow

* Fix test domains

* Fix codeclimate issue
2020-11-17 08:43:46 -05:00
rhymes
f9506affb5
Use faster JS selection methods (#11409)
* Add JS tips section to frontend documentation

* Replace document.getElementsByTagName('body') with document.body

* Replace querySelectorAll with faster selecting methods where appropriate

* Replace querySelector with faster selecting methods where appropriate

* Fix typo

* Fix forEach and getElementsByClassName

* Change querySelector* to faster methods in erb files

* Change querySelector* to faster methods in ruby files

* Fix runkit tag

* Various fixes

* Update app/assets/javascripts/initializers/initializeEllipsisMenu.js

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

* Update app/assets/javascripts/utilities/slideSidebar.js

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

* Commenting out flaky spec

Co-authored-by: Ridhwana <Ridhwana.Khan16@gmail.com>
2020-11-16 17:35:50 +01:00
Josh Puetz
2223e5468b
Email login always on (#11307)
* Starting out

* Building away...

* Hooking buttons up

* Hook Auth Provider buttons to Array Field

* trying to fix NoNameError

* Remains InviteOnlyMode disable and tests

* Smashing remaining tasks

* Last of tasks

* add tests

* Complete specs and tests 😅

* Fix bug

* Additional guard

* pass event to functions

* Position Email Auth first

* Fix bug in Email Auth Modal

* Fix spacing issue

* Update docs for adminModal.js

* Show/hide Enabled Indicator with Enable/Undo buttons

* Complete Auth Providers functionality

* Only update `allow_email_password_registration` from admin

* Remove duplicated methods

* Some refactoring around fact that Email Login is now always on (#11382)

* Fix merge (again!)

Co-authored-by: Arit Amana <msarit@gmail.com>
Co-authored-by: Arit Amana <32520970+msarit@users.noreply.github.com>
2020-11-12 09:32:58 -06:00
Jacob Herrington
9f62711123
Convert inline JS to Stimulus (#11364)
* Convert inline JS to Stimulus

* Use Stimulus targets over element IDs
2020-11-11 21:25:04 -06:00
Arit Amana
4d93112084
Make final Auth Provider Refactor code changes (#11303) 2020-11-07 07:49:16 -05:00
Arit Amana
08796b5cee
[Team Email Login] Refactor Authentication Provider Enable/Disable (#11185)
* Starting out

* Building away...

* Hooking buttons up

* Hook Auth Provider buttons to Array Field

* trying to fix NoNameError

* Remains InviteOnlyMode disable and tests

* Smashing remaining tasks

* Last of tasks

* add tests

* Complete specs and tests 😅

* Fix bug

* Additional guard

* pass event to functions

* Position Email Auth first

* Fix bug in Email Auth Modal

* Fix spacing issue

* Update docs for adminModal.js

* Show/hide Enabled Indicator with Enable/Undo buttons

* Complete Auth Providers functionality

* Update app/javascript/admin/controllers/config_controller.js

Co-authored-by: Vaidehi Joshi <vaidehi.sj@gmail.com>

* Update app/javascript/admin/controllers/config_controller.js

Co-authored-by: Vaidehi Joshi <vaidehi.sj@gmail.com>

* Update app/controllers/admin/configs_controller.rb

Co-authored-by: Vaidehi Joshi <vaidehi.sj@gmail.com>

* Update helper names

* better implementation of EnabledIndicator show/hide

* Small copy changes

* Update spec/helpers/authentication_helper_spec.rb

Co-authored-by: Vaidehi Joshi <vaidehi.sj@gmail.com>

* Update app/views/admin/configs/show.html.erb

Co-authored-by: Vaidehi Joshi <vaidehi.sj@gmail.com>

* Update app/helpers/authentication_helper.rb

Co-authored-by: Vaidehi Joshi <vaidehi.sj@gmail.com>

Co-authored-by: Vaidehi Joshi <vaidehi.sj@gmail.com>
2020-11-06 18:19:34 -05:00
Lisa Sy
8d08191e9a
[Front-End Q/A] Config Authentication view (#11169)
* Update spacing and add Crayons classes

* Update modal interaction and style

* WIP Hide collapsed container

* Refactor invite only mode UX using tooltip

* Fix recaptcha toggle

* Implement button-text change and enabled-indicator hide

* Remove small icon alignment

* Update app/views/admin/configs/show.html.erb

* Fix icon and row alignment

* Fix enabled-indicator bug

Co-authored-by: Arit Amana <msarit@gmail.com>
2020-11-03 20:12:19 -08:00
Arit Amana
e00cb5df17
[Team Email Login] Genericize AdminConfig Modal (#11145)
* Genericize AdminConfig Modal

* Rename function, add JSDoc documentation

* Tests for modal-building function

* Still trying to get jest test to pass

* Fix failing jest test
2020-10-29 15:01:37 -04:00
Arit Amana
1912ffdc46
[Team Email Login] Refactor the Email Authentication flow (#11090)
* Hooked "Enable" button to hidden checkbox

* Hooked "Close" button to close email settings and show "Enable/Edit" button

* Additional hookups

* Start building generalized Modal blocks

* Everything hooked up except styling and a few Qs

* last of the hookups; ensure logic flow

* clean up

* specs to cover email auth refactor

* Fix bug surfaced by Vaidehi

* Incorporate PR feedback

* prevent email auth disable if invite-only-mode

* adjust emailAuthModal body text

* Sundry improvements

* Last-mile tweaks

* Trying to get 3rd party auth deselect to work

* delete unnecssary function

* remove superfluous comment

* Move inline styling into CSS file

* Incorporate PR feedback

* Incorporate more PR feedback

* Make Confirm btn intent clearer

* Add TODO comment
2020-10-28 13:37:11 -04:00
Jacob Herrington
c91c07920f
Add config option for Forem collective noun (#11107)
Not everyone will want to use "Community" to describe their Forem, so
now they have some flexibility there.
2020-10-27 12:45:52 -04:00
Jacob Herrington
f52aaa3610
[deploy] Add a simple image uploader partial (#10884)
* Add a simple image uploader partial

* Trigger Travis CI

Co-authored-by: rhymes <rhymes@hey.com>
2020-10-21 16:41:50 +02:00
Arit Amana
8e57cf17ad
[Team Email Login] Admin enable/disable recaptcha during email signup (#10846)
* Initial Implementation

* Complete hookup of recaptcha guard

* Write tests for recaptcha during email signup

* Addressing PR changes 1

* Create helper method and write specs

* fix bug
2020-10-19 16:20:18 -04:00
Jacob Herrington
c37b283865
Allow Forem admins to enable an invite only mode. (#10758)
* Add invite only mode field to SiteConfig

* Add UI elements for invite only mode
2020-10-12 11:27:22 -04:00
Julianna Tetreault
09c3c25bf8
Add Options to "Invalidate" and "Mark as Valid" Vomit Reactions (#9769) [deploy]
* Adds valid status to the feedback_message model and a spec to validate the status

* Adds an unresolve button to resolved vomits in _abuse_reports.html.erb

* Adds functions to update valid status in reaction_controller.js

* Use invalidate in place of unresolve for unconfirming vomit button

* Add option to reopen vomit reactions marked as invalid and invalidate resolved vomits
  - Adds a Reopen button under the invalid tab
  - Adds confirmedStatus JS to reaction_controller.js
  - Adds conditional to _abuse_reports.html.erb
2020-08-18 11:48:23 -06:00
Josh Puetz
1c566e0ec4
[deploy] Move /internal to `/admin (#9639)
* First draft - all the big changes

* Changing some more references to 'internal'

* Relocate internal request tests to admin

* Relocate internal system tests to admin

* Fix trailing space

* Test fix

* Move queries from internal to admin

* Docs updates

* Rename internal stimuls controllers to admin (plus docs)

* Rename admin layout

* Fix routing after rebase

* Fixes for latest added admin interfaces

* Serviceworker ignore paths
2020-08-07 10:36:26 -04:00