Commit graph

57 commits

Author SHA1 Message Date
Suzanne Aitchison
8358571b29
Get a11y lint script paths from rails helper (#13912)
* retrieve paths from rails helper

* move assets to vendor folder, precompile in assets config

* drop coverage on lines

* remove unneeded line
2021-06-10 09:25:29 +01:00
Suzanne Aitchison
573c78d032
Advise users about potential accessibility failings in their posts - RFC #58 (#13745)
* initial rough version

* link to relevant rules, extract image text, only show if more than 0 errors

* jsdoc and tweaks

* refactors

* add tests

* open info links in new tab

* add new window link icon
2021-06-03 10:27:12 +01:00
Nick Taylor
2b13b9a593
[15 minute fix] Cleanup of post preview E2E tests (#13376) 2021-04-13 10:56:24 -04:00
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
Nick Taylor
db7120ffae
Added E2E tests for #12585. (#12597)
* Added E2E tests for #12585.

* Added a check to ensure no error message when preview works.
2021-02-05 10:30:54 -06:00
Alex
5948c6cfca
Fix bug when trying to preview a blank draft article (#12585)
* Try to fix preview bug

* Now an error is thrown client side if HTTP status isn't 200

* Now the JSON response is thrown instead of the response when preview fails.

* Linter test

Co-authored-by: Nick Taylor <nick@dev.to>
Co-authored-by: Fernando Valverde <fdov88@gmail.com>
2021-02-05 06:56:26 -06: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
Katie Davis
9d4b6c36ea
updates article form to have warning modal (#12430) 2021-01-28 11:32:28 -05:00
Michael Kohl
6afaa25f50
Fix accidental publishing of draft articles (#12288)
* Fix accidental publishing of draft articles

* Add regression spec

* Fix spec
2021-01-22 08:47:16 +07:00
Nick Taylor
bf7780cd2c
Ran prettier on *.js, *.jsx and *.md files. (#11586) 2020-11-23 20:45:50 -05:00
Andrew Bone
c629459ba9
refactor: Use keyboard shortcut hook in article form (#11014)
* Move to new keyboard shortcuts

* No longer required

* Import order

* Import order

* Add trailing comma

* Remove keyboardShortcutsHandler from exports

* Remove pointless arrow function
2020-10-22 12:03:10 -04:00
ludwiczakpawel
ebe398ba23
[deploy] Logo updates (#10840)
* logo updates

* fix

* fix

* drop it like its hot

* no siteconfig

* um...
2020-10-14 16:13:42 -04:00
Nick Taylor
30bfe1adfd
More frontend lint fixes (#8931) 2020-06-29 08:19:13 -04:00
Ben Halpern
e6abadff6c
Generalize editor logo (#8720) 2020-06-17 10:51:50 +02:00
Michael Kohl
60f235d6eb
Use official Asciinema player embed (#8339)
* Use official Asciinema player embed

* Use postscribe to force Asciinema scripts in preview
2020-06-10 12:44:03 +02:00
ludwiczakpawel
39295c0bea
Layout updates (#8107)
* flare tag line height

* .

* init

* widgets

* widgets lists

* new tabs on home

* instantclick

* .

* rethinking css

* .

* .

* empty space

* campaign widget

* .

* merge

* .

* update layout

* fix sidebars on home page

* .

* fix onboarding x

* spec

* test

* test

* better handling ads

* .

* spec

* card styling

* .

* i dont know what have i broken
2020-06-04 16:12:17 +02:00
ludwiczakpawel
a161d3ce31
[deploy] Redesign article editor (#7524) 2020-05-29 11:59:37 -04:00
Dmitry Maksyoma
f63c7f9289
Fix Runkit tags not being activated when comment is added (#6767)
* Fix Runkit tags not being activated when comment is added

* Runkit tag activation was ran once, on page load. I've changed it to
  run on on comment preview and submit.
* It was necessary to add a check to skip already activated Runkit
  tags. The code didn't take into account that a tag could be already
  processed, and would just crash.

* Fix Runkit tags and add tests

* Add test for previewing article with Runkit tag

* "Fix CodeClimate not finding waitForRunkitAndActivateTags()

* Refactor a test for readability

* Make Rubocop happy

* Improve test for previewing article with Runkit tag

* Use one method for determining active Runkit tags

* Defer loading of JS from embed.runkit.com

* Add utility function dynamicallyLoadScript(url)

* Switch to dynamic loading of Runkit

* parsed content code block is also hidden now to avoid displaying <code /> block before runkit iframe loads.

* Fix Runkit test

* Remove Runkit script caching in v2 form

* Use <%== instead of .html_safe in v2 form

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

Co-authored-by: Nick Taylor <nick@iamdeveloper.com>

Co-authored-by: Nick Taylor <nick@iamdeveloper.com>
2020-05-15 14:27:46 +02:00
Mac Siri
9f58b12f67
Make localstorage draft respect newer saved draft (#6343) [deploy] 2020-02-28 15:17:21 -05:00
Bolarinwa Balogun
5fc0a12f26 Resolve TypeError when clearing new changes in articleform (#4963) [deploy]
* Resolve TypeError when clearing new changes in articleform

* Revert cursor change
2019-11-29 14:40:19 -05:00
Ben Halpern
c817ac0192
Fix missing series in article edit form (v2) (#4867) [deploy] 2019-11-22 08:33:55 -05:00
Bolarinwa Balogun
4536d35716 Fix broken layout from "additional config/settings" overlap (#4858) [deploy]
* Fix broken layout from "additional config/settings" overlap

* Resolve bugs by adding important state fields
2019-11-20 14:34:30 -05:00
Nick Taylor
68e94f524b Refactored to use a common <OrganizationPicker /> component (#4470)
* Refactored to use a common <OrganizationPicker /> component.

* Small refactor to organization <option />s.

* Renamed files from OrgSettings* to OrganizationPicker*

* Brought orgsettings inline to article form.

* Brought orgsettings inline to listings form.

* Rename onBlur to onToggle for org picker instances. Ooops.

* Updated <OrganizationPicker /> test.
2019-10-24 17:27:16 -04:00
Hoang
7cd279f3e1 Fix article submission clone bug (#4505) 2019-10-21 15:40:29 -04:00
Tamas Fodor
0d2506f9ef Fix eslint issues in article-form's jsx files (#4217)
* fix eslint issues in article-form's jsx files

* Use e.key instead of deprecated e.keyCode

* Put back whitespace but in html format

* use re-usable SetupImageButton comp, use window.confirm, put back console.log temporarily

* import deep

* fix CoverImage className prop issue

* update jest snap files

* remove no-restricted-globals from eslint-disable-next-line
2019-10-19 17:09:06 -04:00
Ben Halpern
0a60faec8c
Add tag rules to article v2 editor (#4339)
* Add tag rules to article v2 editor

* Add bottom phrase to tag dropdown

* Remove console logs

* Remove empty space in css

* Remove commented code and clean up css

* Add type='button' for a11y
2019-10-10 20:19:12 -04:00
Aswathprabhu
65394cb8cc Refactoring articleForm.jsx removes code duplication (#4159) 2019-10-01 12:05:57 -04:00
Jacob Herrington
7198a72953 Refactor tags components (#3895) [ci skip] 2019-09-20 10:18:44 -04:00
rhymes
61494d2343 Images uploads: fix UI for multiple images (#3958)
* Fix spacing of images button in editor v1

* Fix wording for multiple images in editor

* Update JS tests
2019-09-07 10:57:14 -04:00
Bolarinwa Balogun
41aff162cc Allow upload of multiple images at a time (#3599)
* Allow upload of multiple images at a time

* Update schema.rb
2019-08-18 15:03:14 -04:00
Jacob Eubanks
180935bd37 Delete unused, commented-out code (#3722) 2019-08-15 12:24:48 -04:00
Bolarinwa Balogun
4dd90c5dd1 Fix upload overlap with editor/help page (#3640)
* Fix upload overlap with editor/help page

* Update test snapshot
2019-08-07 15:35:28 -04:00
Ali Spittel
52c60ce37e Feature/refactored onboarding (#3333)
* set up refactored onboarding

* create onboarding page

* add in first slide and change slide functionality

* fix test suite

* profile refactor

* profile refactor

* refactor to api

* add checkbox fields

* add checkbox fields

* remove puts

* add basic css

* add styling

* add redirect

* hide back and next at first and last slides

* test refactored onboarding

* test refactored onboarding

* remove article edits

* Fix schema

* Add deleted file back in

* Add default value for checked_t&c column

* Adjust HTML structure to keep nav buttons in place

* Fix ESLint issues on Onboarding.jsx file

* Handling for undefined or empty followedTags on getUserTags

* Fix codeclimate issues

* Fix codeclimate issues

* Fix more codeclimate issues

* Fix more codeclimate issues

* Update Onboarding snapshots

* Uncheck the CoC and T&C checkboxes on render

* Update snapshots

* Return false instead of raising error

* Update spec to use new onboarding

* Redirect to onboarding if haven't seen it yet

* Prevent redirect to onboarding from /signout_confirm

* Use assign_attributes instead of saving twice

* Move COC and T&C checkbox page to second slide

* Add 'go back to original page' functionality

* Reuse ready prototype logic

* Keep track of the last visited onboarding page

* Fix email subscription bug

* Fix overflow issue for tags page

* Remove height to prevent page container scrolling

* Check for CoC and T&C for displaying onboarding

* Add InstantClick redirect and preserve referrer in client

* Fix async update + check by using localStorage

* Turn off onboarding for tests

* Finalize design for onboarding

* Finalize design for onboarding

* Make bulk follows during onboarding

* Fix bulk follow test
2019-07-26 15:53:32 -04:00
Elecweb
ebf9208877 Add support for hotkey to toggle article preview (#3308) [ci skip] 2019-07-16 14:35:45 -04:00
Mac Siri
90f54773dc
Fix GistTag & RunkitTag preview issue (#3388) 2019-07-09 15:58:08 -04:00
Ben Halpern
119d0f69d6
Finalize multi-org features (#3041)
* Finalize multi-org features

* Fix credits count issues

* Only show org list if multiple orgs on dashboard

* Add check for organizations to JS
2019-06-04 13:56:22 -04:00
Andy Zhao
47d9ec27fb Allow users to belong to multiple orgs (#2583)
* Allow user to have many orgs

* Allow users to handle multi orgs in settings

* Make rounded buttons inline

* Add multi org function to dashboards

* Fix merge conflicts

* Fix mistake in merge conflict fix oops

* Display the correct membership level

* Fix accessibility issues

* Display organizations for article editors

* Handle submitting org id with preact editors

* Make listings work with multiple organizations

* Allow listings to have multiple orgs on create

* Display the correct number of credits for each org

* Move script tag to Webpack

* Allow multi orgs for purchasing and viewing credits

* Use OrganizationMembership as authorization check

* Display multiple organizations for notifications

* Allow dashboard to be viewable under multi-orgs

* Remove unused method

* Add multi-org functionality for article editors

* Show pro dashboard buttons for member+ org levels

* Leave the correct organization

* Allow article API to change org id

* Add left-out authorization method oops

* Make nav buttons a bit more clear

* Fix merge conflict

* Fix adding org id for /api/articles and tests

* Fix tests for org policy

* Use proper logic for displaying org members

* Update org actions with new authorization

* Use correct org when creating a listing

* Remove additional payment charge oops

* Mark org notifications as read with authorization

* Remove deprecated post_as_organization attribute

* Use new org_admin syntax

* Remove deprecated org logic for article create and update

* Default all RSS posts to not belong to any org

* Render org_member page for guest users

* Update org policy spec to work with multi orgs

* Use org_membership for org traits and move identity code

* Use org_member trait

* Update to work with multi-orgs

* Validate article's org_id if param org_id is blank

* Make  a let variable

* Remove unnecessary eager load for credits

* Fix HTML structure and org logic for non-org users

* Update credits spec for multi-org

* Add test for failed payment when purchased by org

* Lint listings_spec

* Test that the listing was created under the user

* Add tests for POST /listings multi-org

* Use double quotes for classes

* Fix /manage and a few other multi-org bugs

* Fix test for multi org

* Use correct method SQL exists? not Rails exist?

* Fix reads spec for multi-org

* Fix org_controller actions to work with multi org

* Test only multi org and not old usage and fix leave_org

* Fix org showing user profile img test for multi-org

* Fix org logic for users with no orgs

* Remove switch org functionality

* Update tests and add hidden param for org id

* Redirect to the specific organization

* Test other org button actions

* Use settings_notice instead of legacy notice and refactor

* Fix weird extra end issue prob from merge conflicts

* Test for with new flash key

* Fix user_views_org tests for multi-org

* Test for new flash message

* Update snapshot with new a11y html

* Move styling to stylesheet

* Add site admins functionality

* Move org_member? method in user model and refactor

* Use unspent_credits_count for organizations

* Add tests for /listings/new and minor bug fixes

* Use .present? in case of empty array

* Fix a lingering deprecated method

* Use greater than 1 for random numbers

* Add tests for counting spent and unspent credits
2019-06-04 09:30:52 -04:00
briwa
b301bf8def fix(article): scroll to top when inserting image (#2998) 2019-05-31 10:29:42 -04:00
Ben Halpern
fb6904f86d
Fix up articles controller (#2855)
* Fix up articles controller

* Update request specs

* Add proper post_under_org tests

* Remove create_job_opportunity

* Add user profile back in
2019-05-16 13:56:26 -04:00
Ben Halpern
dd20e70f12
Simplify article show page reactions (#2827)
* Simplify article show page reactions

* Clean up styling and adjust zen mode logic

* Remove unused variables

* Update app/views/articles/_actions.html.erb

Co-Authored-By: Nick Taylor <nick@iamdeveloper.com>

* Small style mods

* Slight padding change

* Finalize new show page button design
2019-05-15 10:32:36 -04:00
Ben Halpern
3f7ef59d23
Fix text that says publishing for v1 (#2831)
* Fix text that says publishing for v1

* Remove currently in beta text in settings
2019-05-14 14:08:32 -04:00
Ben Halpern
ab344801db
Fix localstorage key (#2815) 2019-05-13 15:27:42 -04:00
Ben Halpern
c7d7d55460
[WIP] Move both v1 and v2 editor to v2 preact-driven editor (#2797)
* Initial work on v2

* Initial changes merger

* Work to finalize v1/v2 editor adjustments

* Clean up styling

* Fiddle with form margins

* Fix some tests

* Change video

* skip a couple tests

* Modify tests to work with new code
2019-05-13 12:27:36 -04:00
rhymes
e626002260 Add alternative texts to images (#2771) [ci skip] 2019-05-09 11:16:03 -04:00
Glenn Carremans
281330fe16 Fix linting issues in app/views/articles (#1848) 2019-02-28 17:23:06 -05:00
Ali Spittel
704b7bce9c Feature/autosave editor (#1633)
* Add myself to core contributors

* add myself to the core contributors

* implement autosave in sessionStorage

* clear sessionstorage on save

* add new changes flag

* add clear  button and css for it

* add clear button functionality

* make clear session storage only run if save is successful

* update jest snapshot for autosave

* add a few tests

* add a few tests

* add test for clear button

* make autosave work for title, tags, and cover image

* remove console.log

* make clear button into a message instead

* move to button with no styling instead of span

* remove warning on refresh

* remove warning on refresh

* move to localstorage so that persists across tabs

* fix blip on change from HTML to JSX

* make confirm work properly

* fix css jump for v2 editor

* fix v2 editor height jump

* remove unused onKeyUp prop

* indent _v2_form.html.erb file

* indent v2 editor erb

* Update package.json with missing package
2019-02-28 07:00:58 -08:00
Ben Halpern
d7665fcc3f
Add comment template to post (#1692)
* add myself to the core contributors

* add comment template

* merge upstream

* make sure the template re-appears for top level comments after submission

* make interface admin only

* Adjust comment template form

* Fix merge conflicts

* Remove unnecessary comment template from json
2019-01-30 13:32:34 -05:00
Ali Spittel
cfd84d73f8 Bug/v2 editor tag typing (#1614)
* Add myself to core contributors

* add myself to the core contributors

* fix to issue 1574 with the V2 editor

* fix tag bug in v2 editor

* fix v2 editor bug

* remove unused code
2019-01-21 18:23:20 -05:00
Ben Halpern
359cc71b64
Add ability for users to publish series (#1034) 2018-10-29 13:04:42 -04:00
Ben Halpern
90861366df
Add additional config to v2 editor (#980)
* Add additional config to v2 editor

* Fix typo
2018-10-23 12:41:19 -04:00