docbrown/app/controllers/admin
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
..
settings Add Admin:Settings controllers (#13851) 2021-06-08 10:13:55 +07:00
tags Move AssignTagModerator from labor to services (#11826) 2020-12-17 09:51:26 +07:00
users Confirmations that users GDPR data was deleted (#11039) 2020-12-14 12:49:45 +03:00
application_controller.rb Add config post route for admin api (#11698) 2020-12-22 15:50:34 -05:00
articles_controller.rb Pin posts to feed (#13807) 2021-06-04 10:54:53 +02:00
badge_achievements_controller.rb Add the Ability to Remove Badge Achievements From Users (#9896) [deploy] 2020-08-25 11:14:47 -06:00
badges_controller.rb [15-min-fix] Remove badge slug field b/c auto-gen by title (#13649) 2021-05-05 13:49:43 -04:00
broadcasts_controller.rb RFC#50-P5 Prepares the admin restructure to be tested (#13114) 2021-04-15 14:53:46 +02:00
chat_channels_controller.rb RFC 50: fix some more hardcoded paths (#13473) 2021-04-26 17:49:54 +02:00
comments_controller.rb [deploy] Move /internal to `/admin (#9639) 2020-08-07 10:36:26 -04:00
consumer_apps_controller.rb Push Notification multi app support (#13304) 2021-04-21 17:13:01 -06:00
data_update_scripts_controller.rb Navigation Items and Role access for Data Update Scripts (#12292) 2021-02-09 17:41:14 +02:00
display_ads_controller.rb RFC#50-P5 Prepares the admin restructure to be tested (#13114) 2021-04-15 14:53:46 +02:00
email_messages_controller.rb Remove resource_admin dashboards (Administrate) (#11792) 2020-12-08 12:38:13 -06:00
events_controller.rb RFC#50-P5 Prepares the admin restructure to be tested (#13114) 2021-04-15 14:53:46 +02:00
feedback_messages_controller.rb Remove <provider>_created_at columns (#13264) 2021-04-29 10:24:16 -05:00
html_variants_controller.rb RFC#50-P5 Prepares the admin restructure to be tested (#13114) 2021-04-15 14:53:46 +02:00
invitations_controller.rb Don't update last_buffered timestamp when creating a suggested tweet (#12537) 2021-02-04 10:00:21 -05:00
listing_categories_controller.rb RFC#50-P5 Prepares the admin restructure to be tested (#13114) 2021-04-15 14:53:46 +02:00
listings_controller.rb [deploy] Move /internal to `/admin (#9639) 2020-08-07 10:36:26 -04:00
moderator_actions_controller.rb [deploy] Move /internal to `/admin (#9639) 2020-08-07 10:36:26 -04:00
mods_controller.rb Move AssignTagModerator from labor to services (#11826) 2020-12-17 09:51:26 +07:00
navigation_links_controller.rb RFC#50-P5 Prepares the admin restructure to be tested (#13114) 2021-04-15 14:53:46 +02:00
organization_memberships_controller.rb [deploy] Move /internal to `/admin (#9639) 2020-08-07 10:36:26 -04:00
organizations_controller.rb [deploy] Move /internal to `/admin (#9639) 2020-08-07 10:36:26 -04:00
overview_controller.rb Add open reports count to admin overview (#13346) 2021-04-12 12:03:11 -05:00
pages_controller.rb RFC #74, Pt. 2: Private Forem Landing Page (#13819) 2021-06-10 11:46:24 -06:00
permissions_controller.rb [deploy] Move /internal to `/admin (#9639) 2020-08-07 10:36:26 -04:00
podcasts_controller.rb Allow admin to add users as podcast owners (MLH Fellowship) (#11728) [deploy] 2020-12-17 10:55:16 -07:00
privileged_reactions_controller.rb Upgrade rubocop* packages to the latest version and fix violations (#11972) 2020-12-21 18:29:43 +01:00
profile_field_groups_controller.rb Profile Admin updates (#10133) 2020-09-02 12:32:25 +02:00
profile_fields_controller.rb [deploy] Add display_area & show_in_onboarding to the profile setup ui (#10158) 2020-09-02 16:30:33 -05:00
reactions_controller.rb [deploy] Move /internal to `/admin (#9639) 2020-08-07 10:36:26 -04:00
response_templates_controller.rb RFC#50-P5 Prepares the admin restructure to be tested (#13114) 2021-04-15 14:53:46 +02:00
secrets_controller.rb [deploy] Move /internal to `/admin (#9639) 2020-08-07 10:36:26 -04:00
settings_controller.rb Add Admin:Settings controllers (#13851) 2021-06-08 10:13:55 +07:00
sponsorships_controller.rb RFC#50-P5 Prepares the admin restructure to be tested (#13114) 2021-04-15 14:53:46 +02:00
tags_controller.rb Fix tag alias problems (#12480) 2021-02-03 11:58:59 -05:00
tools_controller.rb RFC#50-P5 Prepares the admin restructure to be tested (#13114) 2021-04-15 14:53:46 +02:00
users_controller.rb Replacing granular admin email settings with one default email (#13853) 2021-05-28 12:17:08 +03:00
webhook_endpoints_controller.rb [deploy] Move /internal to `/admin (#9639) 2020-08-07 10:36:26 -04:00
welcome_controller.rb Clean up SiteConfig (#13738) 2021-05-18 09:38:31 +07:00