* 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 |
||
|---|---|---|
| .github | ||
| .vscode | ||
| app | ||
| bin | ||
| config | ||
| db | ||
| docs | ||
| lib | ||
| log | ||
| public | ||
| spec | ||
| vendor/assets | ||
| .babelrc | ||
| .codeclimate.yml | ||
| .dockerignore | ||
| .editorconfig | ||
| .erb-lint.yml | ||
| .eslintignore | ||
| .gitdocs.js | ||
| .gitignore | ||
| .gitpod.dockerfile | ||
| .gitpod.yml | ||
| .nvmrc | ||
| .postcssrc.yml | ||
| .prettierignore | ||
| .rspec | ||
| .rubocop.yml | ||
| .rubocop_todo.yml | ||
| .ruby-version | ||
| .simplecov | ||
| .travis.yml | ||
| .yardopts | ||
| after_deploy.sh | ||
| CODE_OF_CONDUCT.md | ||
| config.ru | ||
| CONTRIBUTING.md | ||
| docker-compose.yml | ||
| docker-entrypoint.sh | ||
| docker-run.sh | ||
| Dockerfile | ||
| dockerhub-readme.md | ||
| empty-module.js | ||
| Envfile | ||
| environment | ||
| Gemfile | ||
| Gemfile.lock | ||
| Guardfile | ||
| jest.config.js | ||
| LICENSE.md | ||
| Makefile | ||
| netlify.toml | ||
| package.json | ||
| Procfile | ||
| Procfile.dev | ||
| Procfile.dev-hot | ||
| Rakefile | ||
| README.md | ||
| yarn.lock | ||
DEV Community 👩💻👨💻
The Human Layer of the StackWelcome to the dev.to codebase. We are so excited to have you. With your help, we can build out DEV to be more stable and better serve our community.
What is dev.to?
dev.to (or just DEV) is a platform where software developers write articles, take part in discussions, and build their professional profiles. We value supportive and constructive dialogue in the pursuit of great code and career growth for all members. The ecosystem spans from beginner to advanced developers, and all are welcome to find their place within our community. ❤️
Table of Contents
Contributing
We encourage you to contribute to dev.to! Please check out the Contributing to dev.to guide for guidelines about how to proceed.
We expect contributors to abide by our underlying code of conduct. All conversations and discussions on GitHub (issues, pull requests) and across dev.to must be respectful and harassment-free.
Where to contribute
All issues labeled with approved are up for grabs. For clarification on how we label issues, check out their definitions here.
When in doubt, ask a core team member! You can mention us in any issues or ask on the DEV Contributor thread. Any issue with the good first issue tag is typically a good place to start for anyone new to the project. For newer developers, try 'entry-level' issues.
Refactoring code, e.g. improving the code without modifying the behavior is an area that can probably be done based on intuition and may not require much communication to be merged.
Fixing bugs may also not require a lot of communication, but the more the better. Please surround bug fixes with ample tests. Bugs are magnets for other bugs. Write tests near bugs!
Building features is the area which will require the most communication and/or negotiation. Every feature is subjective and open for debate. If your feature involves user-facing design changes, please provide a mockup first so we can all get on the same page. As always, when in doubt, ask!
How to contribute
- Fork the project & clone locally. Follow the initial setup here.
- Create a branch, naming it either a feature or bug:
git checkout -b feature/that-new-featureorbug/fixing-that-bug - Code and commit your changes. Bonus points if you write a good commit message:
git commit -m 'Add some feature' - Push to the branch:
git push origin feature/that-new-feature - Create a pull request for your branch 🎉
Note: be sure to keep your fork in sync!
Contribution guideline
Create an issue
Nobody's perfect. Something doesn't work? Or could be done better? Let us know by creating an issue.
PS: a clear and detailed issue gets lots of love, all you have to do is follow the issue template!
Clean code with tests
Some existing code may be poorly written or untested, so we must have more scrutiny going forward. We test with rspec, let us know if you have any questions about this!
Create a pull request
- Try to keep the pull requests small. A pull request should try its very best to address only a single concern.
- Make sure all tests pass and add additional tests for the code you submit. More info here
- Document your reasoning behind the changes. Explain why you wrote the code in the way you did. The code should explain what it does.
- If there's an existing issue related to the pull request, reference to it by adding something like
References/Closes/Fixes/Resolves #305, where 305 is the issue number. More info here - If you follow the pull request template, you can't go wrong.
Please note: all commits in a pull request will be squashed when merged, but when your PR is approved and passes our CI, it will be live on production!
How to get help
Whether you are stuck with feature implementation, first-time setup, or you just want to tell us something could be done better, check out our OSS thread or create an issue. You can also mention any core team member in an issue and we'll respond as soon as possible.
👉 OSS Help/Discussion Thread 👈
The bottom line
We are all humans trying to work together to improve the community. Always be kind and appreciate the need for tradeoffs. ❤️
Codebase
The stack
We run on a Rails backend with mostly vanilla JavaScript on the front end, and some Preact sprinkled in. One of our goals is to move to mostly Preact for our front end.
Additional technologies and services are listed on our docs.
Engineering standards
Style Guide
This project follows thoughtbot's Ruby Style Guide, using Rubocop along with Rubocop-Rspec as the code analyzer. If you have Rubocop installed with your text editor of choice, you should be up and running.
For Javascript, we follow Airbnb's JS Style Guide, using ESLint and prettier. If you have ESLint installed with your text editor of choice, you should be up and running.
Husky hooks
When commits are made, a git precommit hook runs via husky and lint-staged. ESLint, prettier, and Rubocop will run on your code before it's committed. If there are linting errors that can't be automatically fixed, the commit will not happen. You will need to fix the issue manually then attempt to commit again.
Note: if you've already installed the husky package at least once (used for precommit npm script), you will need to run yarn --force or npm install --no-cache. For some reason, the post-install script of husky does not run when the package is pulled from yarn or npm's cache. This is not husky specific, but rather a cached package issue.
Getting Started
This section provides a high-level requirement & quick start guide. For detailed installations, please check out our docs.
Prerequisites
- Ruby: we recommend using rbenv to install the Ruby version listed on the badge.
- Yarn: please refer to their installation guide.
- PostgreSQL 9.4 or higher.
Standard Installation
-
Make sure all the prerequisites are installed.
-
Fork dev.to repository, ie. https://github.com/thepracticaldev/dev.to/fork
-
Clone your forked repository, ie.
git clone https://github.com/<your-username>/dev.to.git -
Set up your environment variables/secrets
- Take a look at
Envfile. This file lists all theENVvariables we use and provides a fake default for any missing keys. You'll need to get your own free Algolia credentials to get your development environment running. - This guide will show you how to get free API keys for additional services that may be required to run certain parts of the app.
- For any key that you wish to enter/replace:
- Create
config/application.ymlby copying from the provided template (ie. with bash:cp config/sample_application.yml config/application.yml). This is a personal file that is ignored in git. - Obtain the development variable and apply the key you wish to enter/replace. ie:
GITHUB_KEY: "SOME_REAL_SECURE_KEY_HERE" GITHUB_SECRET: "ANOTHER_REAL_SECURE_KEY_HERE" - Create
- If you are missing
ENVvariables on bootup,enviedgem will alert you with messages similar to'error_on_missing_variables!': The following environment variables should be set: A_MISSING_KEY.. - You do not need "real" keys for basic development. Some features require certain keys, so you may be able to add them as you go.
- Take a look at
-
Run
bin/setup -
That's it! Run
bin/startupto start the application and head tohttp://localhost:3000/
View Full Installation Documentation
Docker Installation (BETA)
Our docker implementation is incomplete and may not work smoothly. Please kindly report any issues and any contribution is welcomed!
- Install
dockeranddocker-compose git clone git@github.com:thepracticaldev/dev.to.git- Set environment variables above as described in the "Standard Installation"
- run
docker-compose build - run
docker-compose run web rails db:setup - run
docker-compose run web yarn install - run
docker-compose up - That's it! Navigate to
localhost:3000
Gitpod Installation
Simply open dev.to in Gitpod, a free online dev environment for GitHub:
Starting the application
We're mostly a Rails app, with a bit of Webpack sprinkled in. For most cases, simply running bin/rails server will do. If you're working with Webpack though, you'll need to run the following:
- Run
bin/startupto start the server, Webpack, and our job runnerdelayed_job.bin/startuprunsforeman start -f Procfile.devunder the hood. alias start="bin/startup"makes this even faster. 😊- If you're using
pryfor debugging in Rails, note that usingforemanandprytogether works, but it's not as clean asbin/rails server.
Here are some singleton commands you may need, usually in a separate instance/tab of your shell.
- Running the job server (if using
bin/rails server) -- this is mostly for notifications and emails:bin/rails jobs:work - Clearing jobs (in case you don't want to wait for the backlog of jobs):
bin/rails jobs:clear
Current gotchas: potential environment issues with external services need to be worked out.
Suggested Workflow
We use Spring and it is already included in the project.
- Use the provided bin stubs to automatically start Spring, i.e.
bin/rails server,bin/rspec spec/models/,bin/rails db:migrate. - If Spring isn't picking up on new changes, use
spring stop. For example, Spring should always be restarted if there's a change in environment key. - Check Spring's status whenever with
spring status.
Caveat: bin/rspec is not equipped with Spring because it affects Simplecov's result. Instead use bin/spring rspec.
Additional docs
Check out our dedicated docs page for more technical documentation.
Core team
- @benhalpern
- @jessleenyc
- @peterkimfrank
- @maestromac
- @zhao-andy
- @aspittel
- @lightalloy
- @mariocsee
- @rhymes
License
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Please see the LICENSE file in our repository for the full text.
Like many open source projects, we require that contributors provide us with a Contributor License Agreement (CLA). By submitting code to the DEV project, you are granting us a right to use that code under the terms of the CLA.
Our version of the CLA was adapted from the Microsoft Contributor License Agreement, which they generously made available to the public domain under Creative Commons CC0 1.0 Universal.
Any questions, please refer to our license FAQ doc or email yo@dev.to
Happy Coding ❤️