Commit graph

71 commits

Author SHA1 Message Date
Ben Halpern
b763ba8544
Allow pages to have subdirectories (#20549)
* Allow pages to have subdirectories

* Add locale text
2024-01-24 16:09:29 -05:00
Ben Halpern
d86689f63d
Allow pages to render .txt requests (#20547)
* Allow pages to render .txt requests

* Adjust routes
2024-01-22 11:12:22 -05:00
Philip How
33fd9836be
Add CSS as pages template option (#20512)
* add css as pages option

* don't forget schema

* fix test

* add api support
2024-01-12 15:35:38 +00:00
Anna Buianova
8cc6f37a2d
Rename Admin::DisplayAds controller to Billboards (#19687) 2023-07-07 08:11:35 -04:00
Lawrence
e4e1f4d96d
report abuse dropdown link (#19247)
* report abuse dropdown link

* Update app/controllers/pages_controller.rb

* Update app/views/shared/_display_ad.html.erb

* remove billboard url check

---------
2023-03-28 14:02:31 -05:00
Anna Buianova
f7a93aabbb
Remove html variants tracking (#18594)
* Removed code related to tracking html_variants

* Remove code related to HtmlVariant#find_for_test

* Remove spec for HtmlVariant#success_rate
2022-10-21 14:57:20 +03:00
yheuhtozr
c4778d832e
app/controllers & decorators i18n (#16126)
* app/controllers (& decorators) i18n etc

* tidy key names

* update keys

* delete ja.yml

* delete an involved ja.yml

* fix for PR review

* fix for spec

* delete ja.yml
2022-02-03 13:35:56 -05:00
Julianna Tetreault
b12ebfa0e5
RFC #74, Pt. 2: Private Forem Landing Page (#13819)
* Adds landing_page checkbox for Landing Page

* Adds landing_page to page_params in Admin::Pages::Controller

* Adds landing_page to admin_manages_pages and admin_creates_pages specs

* Adjusts copy for Landing Page in pages/_form.html.erb

* Places #post_a_job before #privacy in Pages::Controller
  - Ensures that all page-related methods are properly
 alphabetized

* Alphabetizes remaining out-of-order page-related methods
  - Ensures that all page-related methods within the
 Pages::Controller are in alphabetical order, following
 the order of the other methods

* Adds landing_page check to ApplicationController#verify_private_forem

* Adds a single_landing_page validation to the Page model

* Adds a lock.svg to /images and uses it in the pages index

* Adjusts buttons and checkboxes to use crayons class in pages partial

* Ensures that pages/_form.html.erb destroy button uses crayons

* Adds a landing_page validation-related test to page_spec.rb

* Updates #single_landing_page validation and error message

* WIP: Adds JS modal upon landing_page error in pages/_form.html.erb

* Adds a working modal upon error in pages/_form.html.erb
- Removes redundant #single_landing_page validation from Page
- Adds #has_a_landing_page? in place of #single_landing_page
- Conditionally renders the landing_page checkbox in _form.html.erb
- Adds styles to locked screen/landing page modal
- Adds copy to locked screen/landing page modal
- Beings adding buttons to overwrite current landing_page

* Updates the data-modal-selectors and ids in pages/_form.html.erb

* Uses #landing_page_path within pages/_form.html.erb modal
- Adds a link_to to link to the current landing page in the modal
- Adds styles to buttons and link_to in modal

* Adds back single_landing_page validation to Page.rb

* Reverts changes and updates methods within Page.rb
 - Reverts changes to #single_landing_page
 - Refactors #has_a_landing_page? and #landing_page_path
 - Updates div id in pages/_form.html.erb

* Adjusts #single_landing_page error message slightly

* Adds a test for landing_pages in stories_index_spec.rb

* Adds an overwrite attribute to Pages for the modal in _form
  - Fixes anonymous spelling

* Refactors pages/_form.html.erb and cleans up spelling

* Adds a safe operator to landing_page.path in Page
  - Adjusts the placement of the hidden value in pages/_form.html.erb

* Updates styling for Current Locked Screen link

* Adds the ability to overwrite an active landing page on click
  - Adds Admin::PagesController#update_and_overwrite and refactors
AdminPages::Controller#udpate to work with new method
  - Adds a remote attribute, overwrite, to Admin::PagesController
via a hidden_field in pages/_form.html.erb and an attr_accessor in
the Page model
  - Adds a toggleOverwrite() function to pages/_form.html.erb to
toggle the (soon to be hidden) overwrite checkbox in the form --
the checkbox is toggled on button click

* Adds a guard clause to #landing_page_path in Page.rb

* Adds a safe naviagtor to Admin::PagesController#update_and_overwrite_landing_page

* Adds a type and return to Overwrite button to prevent submit

* Adds a hidden class to the overwrite checkbox field in _form.html.erb
  - Hides the overwrite checkbox since it is only used to overwrite
the landing_page boolean on click of the "Overwrite current locked
screen" button

* Adds Admin::PagesController#create_and_overwrite and removes hidden class

* Adds landing page-related tests to admin_manages_pages_spec.rb

* Remove messy commented out code and place it in GH comment instead

* PR Review Feedback: Renames remote attr, defines class methods, updates views
  - Renames remote attribute to overwrite_landing_page
  - Updates all necessary views, methods, etc. w/ new attr
  - Defines two class methods to make code more extensible
  - Updates all necessary views, methods, etc. w/ new methods

* Remove unnecessary comments and revert changes to ternary in _form.html.erb

* Adjustments for accessibility within _form and index
  - Adds a descriptive id to <p> in _form.html.erb
  - Adds an ariadescribedby field to _form.html.erb
  - Adjusts title within index.html.erb

* Refactors landing_page-related code per PR review requests
  - Adds a landing_page_modal_controller.js that handles
and further customizes the dismiss and overwrite button, and
handles opening the modal
  - Adds a _landing_page_modal partial to extract modal-specific
html outside of the _form.html.erb partial
  - Refactors _form.html.erb to account for the _landing_page_modal
partial and the landing_page_modal_controller.js
  - Refactors the overwrite checkbox to be a hidden_field rather than
a hidden checkbox and removes existing hidden_field to accomodate it
  - Loads the @landing_page within Admin::PagesController#edit for
use by the _landing_page_modal.html.erb partial
  - Refactors Page#single_landing_page to be more readable
  - Removes useless JS from _form.html.erb

* Removes #landing_page_exists? class method since it isnt used now

* Uses the #landing_page class method within ApplicationController

* Removes pending status from test in admin_manages_pages_spec.rb

* Adds an e2e test for landing pages and adds to seeds_e2e
  - Adds a landingPage.spec.js to test landing pages
  - Adds a Page to seeds_e2e.rb for landingPage.spec.js

* Removes references to articles from e2e test and adds clickable link

* Adds another Page to seeds_e2e.rb and updates link names in test

* Adds the Current Locked Screen title to modal and opens in new link

* Renames Dismiss to Cancel and updates all necessary code

* Adjusts landingPage.spec.js

* check for existing landing page before showing modal

* Update Cypress tests and fix bug in LandingPageModalController

* Apply suggestions from code review

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

* Orders Pages by created_at desc in /admin/pages/index.html.erb for consistency

* Targets specific edit button in landingPage.spec.js

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
Co-authored-by: rhymes <github@rhymes.dev>
2021-06-10 11:46:24 -06:00
Jacob Herrington
5afb4d9a24
[15-Minute Fix] Refactor code smells (#13347)
* Remove duplicate method calls

* DRY up duplicated code

* Address code smells in concerns

* Update based on PR feedback
2021-04-21 14:52:32 -05:00
Nick Taylor
7c1343be9e
Revert "Revert "Removed service worker (#12974)" (#13014)" (#13015)
This reverts commit 2416387fb4.
2021-03-17 10:57:56 -04:00
Molly Struve
2416387fb4
Revert "Removed service worker (#12974)" (#13014)
This reverts commit 4fb6230606.
2021-03-16 18:10:01 -05:00
Nick Taylor
4fb6230606
Removed service worker (#12974) 2021-03-16 15:55:31 -04:00
ludwiczakpawel
3b2480ed0a
CSS size reduce + cleanups. (#12625)
* tooltips 1.0.1

* tooltips 1.0.1

* fixes and cleanups

* whoops

* aria

* revert
2021-02-16 13:44:26 +01:00
Ridhwana
f87ff8e2ae
feat: allow the contact page to be overridden by pages (#10924) 2020-10-19 16:16:56 -04:00
Ridhwana
6a7b78e4a0
Allow admins to turn "some" hardcoded pages into a "Page" (#10877)
* feat: allow a page to override the code_of_conduct, terms and privacy page

* feat: let privacy policy also use a partial for its contents like coc and terms

* feat: show the defaults or the pages

* specs: add tests for the overrides

* feat: update some styles and make use crayons buttons

* fix: update order of test items

* spec: fix

* reactor: move this whole section in the if

* feat: updates

* fix: code climate + travis

* more codeeclimate
2020-10-16 12:37:06 -04:00
Diogo Osório
4b8a725681
Fixes brakeman open redirect warnings at pages_controller (#10095)
When redirecting to the welcome, challenge and checkin articles,
breakman was complaining about a potential open redirect vulnerability
due to the fact that the redirect URL comes from a string stored in the
database.

This commit silences breakman by explicitly parsing the database article
path (via `URI.parse`) and explicitly stating that only the `path`
portion of the URI is to be used (== in an unlikely event of an absolute
URI pops up from the db record, the user-agent will still be instructed
to be redirected to a page under the app's domain).
2020-08-31 13:39:04 -04:00
rhymes
f1ec04a0c9
Rubocop: move dot in multi-line calls to leading position (#9262) 2020-07-16 15:51:11 +02:00
Ben Halpern
7bb194b305
[deploy] Remove /rly code (#9192) 2020-07-08 07:55:33 -04:00
Alberto Pérez de Rada Fiol
2660c76fca
Fix erblint errors on the app/views/pages folder (#8401) 2020-06-11 15:46:50 +02:00
Josh Puetz
71fba61ae2
Properly return json (#8395) [deploy] 2020-06-10 17:38:50 -05:00
Josh Puetz
d33322f8e4
Add json template to Pages (#8357)
* Add json template to pages

* Add jsonb field, tweak form
2020-06-10 09:42:15 -05:00
Josh Puetz
f165c47b34
Add feature flag support to Pages (#8149)
* Add 'feature_flag' field to pages table, form

* Add 'exist?' to FeatureFlag

* Test for feature flag when loading custom pages

* Refactor FeatureFlag.enabled? to check both boolean and user gates

* Ugly test fixes

* PR feedback and refactoring

* PR refactor: don't require database table!
2020-06-01 09:23:19 -05:00
Ridhwana
8140e46ceb
Add some placeholder pages (#7441)
* feat: add placeholders for some routes

* about_listings_url

* feat: tag-moderation

* chore: about_listings_url test

* chore: use post a job url

* chore: add pages methods

* chore: just reordered stuff

* oops forgot to save - oh man

* chore: change to single quotes

* chore: hopefully retrigger cc

* chore: update tests

* feat: PR suggestions:)

* chore: spec
2020-04-28 15:55:59 +02:00
Michael Kohl
0d59f92670
Add CodeNewbie staff redirect (#7272) 2020-04-14 20:54:42 -04:00
Anna Buianova
d8539fd8c0
Remove hardcoded now page (#7174) 2020-04-09 16:41:16 +03:00
Michael Kohl
eeed7f6c54
Introduce URL.sanitized_referer helper (#7122) [deploy]
* Introduce URL.sanitized_referer helper

* Make service worker path a constant

* Simplify redirect logic

* Actually use helper

* Remove random file
2020-04-07 17:57:13 +02:00
Anna Buianova
b2a2f4bee5
Remove dynamic /live page (#7130)
* Removed dynamic /live page
2020-04-07 17:36:21 +03:00
Anna Buianova
ad26176828
Removed unused pages code (#6908) 2020-03-27 13:22:40 -04:00
Mac Siri
84e84af8d7
Create Article#admin_published_with scope (#6794) 2020-03-24 18:15:43 -04:00
ludwiczakpawel
cad93674ff
New colors (#6650)
* add tons of colors

* add tons of colors

* moving cheese around and prepping for new theming system

* documenting

* .

* moving theme code to own files

* whitespaces
2020-03-19 15:34:09 -04:00
Mac Siri
d0c1467ab0
Extract Onboarding into its own controller (#6620)
* Extract onboarding into it's own controller

* Pluralize controller

* Create Onboarding spec
2020-03-16 15:49:28 +01:00
Nick Taylor
7bd99ad2da
Nickytonline/add crayons to storybook (#6578)
Added crayons (design system) to Storybook
2020-03-12 15:00:32 -04:00
ludwiczakpawel
ca97c21e16
CSS Components, Variables + Utility classes (#6334)
* move kbd where it should be

* initial cleanup

* do we even need that?

* sponsorships

* cleanups on articles.scss mostly

* initial cleanups to scaffolds

* moving cheese around

* color variables, variables cleanups

* adding spacing units

* variables cleanup

* adding topbar height variable

* a bit of top-bar refactor

* a bit of top-bar refactor

* a bit of top-bar refactor

* simpler animation

* top bar search and responsivness

* loggged out version

* remove unnecessary comment

* fixing svg icons

* search cleanup

* top bar cleanups

* .

* dropdown in header

* removing fill from svgs to make them work in other themes

* remove test element

* topbar icons recreated

* introducing variables & buttons component

* more variables

* Whoops

* init modal component

* init modal component

* init form component

* form component

* .

* variables naming

* .

* tiny cleanups

* formatting

* whoops

* Test

* component avatars

* components page + fixes

* indicators

* init boxes

* boxes

* im an idiot

* radios, checkboxes

* maybe im smart

* whoops. i am dumb and blind

* checkboxes and radios

* better documentation, code examples, avatars rewritten

* notices, modals, dropdowns

* .

* oh damn you

* checkboxes & radios

* forms

* generating tailwind classes

* i broke things

* spacing units

* typography, spacing

* positioning

* overflow

* .

* getting rid of cards for now

* formatting

* adding reset to global styles to avoid jumping layout

* change url for crayons test page to not be top-level

* additional style for indicators, colors, navigation, grid

* tabs

* backgrounds

* flexbox

* .

* .

* im not sure why schema change was here...

* same about this one...

* this file shouldnt be in my commit either

* adding comments and mentally dropping IE10 support :D

* .

* referencing boxes.scss file

* new line

* get rid of font-size from body

Co-authored-by: rhymes <rhymesete@gmail.com>
2020-03-12 11:21:20 +01:00
Ridhwana
dee8d39fe7
Ridhwana/Remove shecoded (Please do NOT merge as yet) (#6357) [deploy]
* chore: remove she coded route

* chore: remove the shecoded page

* chore: remove some assets

* chore: remove shecoded pages controller action
2020-03-02 10:20:42 -05:00
Mac Siri
6d4925a17d
Ignore referer on /report-abuse if it's SW.js (#6295) [deploy] 2020-02-26 10:18:22 -05:00
Ben Halpern
82f2281b1c
Create dynamic robots.txt page (#5794) [deploy]
* Create dynamic robots.txt page

* Add tests and remove cachebust
2020-01-28 16:49:34 -05:00
Michael Kohl
728a05c476 Move from env variables to SiteConfig (#5385) [deploy]
* Move from env variables to SiteConfig

Related to #5384

This PR only deals with the first remaining part outlined in the issue, starting to use existing SiteConfig keys instead of the env variables.

* Restore Envfile to original version for now
2020-01-07 16:36:24 -05:00
rhymes
8f5706fcc1 Remove all old membership code, see 97040ab6 (#3575) 2019-07-30 12:33:50 -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
Andy Zhao
b4e493ec30 Redirect to actual latest published thread for /welcome (#3488) 2019-07-15 17:03:47 -04:00
Andy Zhao
04ce7738ab Add /challenge redirect (#3368) 2019-07-02 16:27:39 -04:00
rhymes
c42c28ae59 Performance: save some queries when pluck is not needed (#3160) 2019-06-14 14:56:33 -04:00
Ben Halpern
f0871346f7
Add security and faq pages as generatable via the Page model (#2792) 2019-05-10 16:20:40 -04:00
Andy Zhao
97040ab603 Remove membership and stripe subscription routes (#2741) 2019-05-07 11:37:21 -04:00
Ben Halpern
5891b2ea58
Add application "page" model (#2657)
* Generate page model

* Add page model

* Conditionally modify html rendering
2019-05-02 18:24:06 -04:00
rhymes
5782ffd7e0 Use published scope for articles (#2374)
* Use published scope for articles

* Fix variable name

* The sequencing in the union query matters

* Fix spec

* Restore a published: true condition

* This test is actually misleading due to the union

* Revert this change, not sure why it's not a relation

* Fix useless diff
2019-04-11 13:18:26 -04:00
rhymes
3a53d5797e Upgrade Rails to 5.2.3 (#1408) 2019-04-03 13:08:59 -04:00
Abraham Williams
9cb40e546b Enables Rails cops (#2186)
* Enable Rails cops

* Fix Rails/DynamicFindBy

* Fix Rails/HttpStatus

* Fix Rails/Blank

* Fix Rails/RequestReferer

* Fix Rails/ActiveRecordAliases

* Fix Rails/FindBy

* Fix Rails/Presence

* Fix Rails/Delegate

* Fix Rails/Validation

* Fix Rails/PluralizationGrammar

* Fix Rails/Present

* Fix Rails/Output

* Fix Rails/Blank

* Fix Rails/FilePath

* Fix Rails/InverseOf

* Fix Rails/LexicallyScopedActionFilter

* Add Rails/OutputSafety to TODO

* Add Rails/HasManyOrHasOneDependent to TODO

* Add Rails/SkipsModelValidations to TODO
2019-03-25 09:25:55 -04:00
Keshav Biswa
8d57d45ecc Rubocop Style cops enabled (#2056)
* Rubocop enabled style/alias

* Enabled Style/ArrayJoin Cop

* Enabled Style/Attr

* Enabled Case Equality

* Enabled CharacterLiteral

*  Enabled ColonMethodCall Cop

* Enabled CommentAnnotation cop

* Enabled PreferredHashMethods Cop

*  Enabled DoubleNegation Cop

* Enabled EachWithObject Cop

* Enabled EmptyLiteral Cop

* Enabled EvenOdd Cop

* Enabled IfWithSemicolon Cop

* Enabled Lambda and LambdaCall Cop

* Enabled LineEndConcatenation Cop

* Enabled ModuleFunction Cop;

* Enable NegatedIf and NegatedWhile Cop

* Enabled NilComparison Cop

* Enabled Not Cop

* Enabled NumericLiterals Cop

* Enabled OneLineConditional Cop

* Enabled PercentLiteralDelimiters Cop

* Excluded internal/users_controller from negated_if cop

* Reverted the double negation change from github_issue_tag and github_issue.rb"

* Enabled PerlBackrefs Cop

* Changed Regexp.last_match(1) to Regexp.last_match(0)

* Enabled proc cop

* Enabled RaiseArgs Cop

* Reverted Regexp.last_match(0) to Regexp.last_match(1)

* Enabled SelfAssignment Cop

* Enabled SingleLineMethods Cop

* Enabled SpecialGlobalVars Cop

* Enabled VariableInterpolation Cop

* Enabled WhenThen Cop

* Enabled WhileUntilModifier Cop

* Enabled WordArray Cop

* Enabled IfUnlessModifier Cop

* Enabled GuardClause Cop
2019-03-15 18:33:54 -04:00
Ben Halpern
27662eb924
Ben/shecoded tweaks (#2007)
* A few shecoded tweaks

* Refactor code
2019-03-08 08:16:10 -08:00