* 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
* Add Stack Exchange Liquid tag
* Add Stack Exchange/Overflow tag
* Convert to integers
* Add better error handling
* Make all links open in new tab
* Adjust names and refactor a bit
* Use key for every API call
* Add new lines to end of svg files
* Add better error handling
* Fix edge case where input is not numeric
* Finalize Stackexhange tag design and functionality
* Fix css typo
* Update snapshots
* Fix snapshot back
* 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
* 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
* Add system test to create article from the editor
* Move article creation from API to app controller
* Fix system test to edit posts
* Move article update from API to app controller
* Rewrite create article API using API key
* Add main_image and canonical_url to allowed creation params
* Rewrite update article API using API key
* Fix tests and have Comments API inherit from API
* 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
* 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
* 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
* 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
* 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
* Run prettier on articleForm.jsx and tags.jsx
The only thing this commit does is run prettier on files
we'll be modifying to update the <Tags /> component.
* Add basic snapshot test for ArticleForm
I had to move algoliasearch setup to the constructor.
Otherwise, the setup happens when you import ArticleForm.
Feel free to let me know if there's a better way.
* Add a snapshot test to exercise algoliasearch
This test adds a mock for algoliasearch. We trigger handleTagKeyUp
to test that tagList and tagOptions are updated once the mock
search returns.
* Add test for selecting tags
There are two tests so far.
1. You can click on a tag to add it to the list.
2. You can type a comma which will also add the tag to the list.
* Add constants for key codes
* Change onKeyUp to onInput when typing tags
I believe <Tags> is meant to be a controlled component. Using onKeyUp
sort've acts as both uncontrolled and controlled. The value of the
textarea has already been changed in the DOM, then we try to change
it again using setState. This leads to some weird issues where what
you type gets mangled. For example, you may type "javascript", but end
up with something like "jvascrit".
Switching this to onInput lets us control everything and gets rid of
the weird issue of missing characters as you type.
* Refactor the way we add tags to the input
We add tags when you click on a search result or hit enter on
a search result. I'm doing this because I think it will help insert
tags at any location in the textarea. Currently, it only supports
adding tags to the end of the list.
* Allow editing of tag based on cursor position
If you use the arrow keys or the mouse to go back to edit a tag
you've typed, it'd be nice if the search results could replace
that tag. Before this, if you click or hit enter on a search result,
the tag gets added to the end of the list.
This commit will replace the tag you're editing.
* Move __mocks__ outside of __tests__
This was causing anything inside __mocks__ to be considered as a test.
* Add 2 tests around editing tags
1. That we query for the correct tags based on what we're editing
2. That we replace the correct tag when we choose a new one
* Enforce max tags limit
* Refactor article form tests
Extracts building of <ArticleForm /> component since we're using
it in a number of places for test setup.
* Add a space after inserting a tag
There appears to be an issue with the input losing the cursor position
when it rerenders. I'm not sure if this is an issue with the code
or an issue with preact. I'm leaning toward an issue with the code,
but I'm not really sure.
* Refactor <Tags /> to class
This is to prep for moving any tags related behavior from
<ArticleForm /> to <Tags />.
* Move tags behavior to <Tags /> component
The <Tags /> component seems like the right place to perform
searching and managing of selected tags. We can pass a function
to <Tags /> so the tag list can be updated when needed.
* Move <Tags /> selected state to a getter
We already have `props.defaultValue` which is already a kind of "state"
for selected tags. Keeping track of an array of selected tags
seems like overkill here. We can transform the defaultValue string
to a list of selected tags when needed.
* Use linkState to manage tagList
We're already using linkState elsewhere so I think it makes sense
to use it here as well.
* Extract key handling behavior to methods
We were performing quite a bit of logic when handling key down events.
This commit extracts this logic to small methods.
For example, we need to check if we're at the top or bottom of the
search results. We also need to clear search results and reset the
selected search result. My hope is to make this logic a little bit
clearer with methods named by what they do.
* Move clearing of search results into search method
If the query is blank, it seems to make sense that we'd clear
search results inside the search method. That's an empty query
and the search method is simply returning no search results in
that case.
However, if we don't wrap the resetting of search results with a
Promise, we end up with a double render where the cursor moves to the
end of the textarea. The Promise feels a little hacky to me, but
I couldn't come up with something better.
* Refactor naming of logic to insert a space following a comma
This would've been hard to understand in the future. I named
the conditionals a little bit better and extracted logic to
insert a space at a given position.
* Fix issue with duplicates appearing in search results
This now uses the getter for selected tags as a filter.
* Create alternate editor
* Install linkstate (?)
Not sure how it disappear in the first place
* Run yarn install
* Modulize ArticleForm component
* Refactor
* Isolating css WIP
* Implement simplified frontmatter-less editor
* Modulize individual form element
* Ajust props names
* Transform json params to snakecase
* Remove codes
* Update /new, almost there for release
* Fix editor resize issues
* Change defaultvalue to value in article form tag element
* Modify html buttons in article form