Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create Default Nav Links In New Forem (RFC #237) #14345

Merged
merged 48 commits into from Aug 2, 2021

Conversation

msarit
Copy link
Contributor

@msarit msarit commented Jul 26, 2021

What type of PR is this? (check all applicable)

  • Refactor
  • Feature
  • Bug Fix
  • Optimization
  • Documentation Update

Description

As mentioned in the Static Nav Sections PR, this PR ensures that new forems have the default links prescribed by the Static Sections RFC.
❓❓ WHY do I have so many commits? I tried rebasing but that just added MORE commits! 😫

QA Instructions, Screenshots, Recordings

Run specs locally and ensure they pass.

UI accessibility concerns?

None.

Added/updated tests?

  • Yes
  • No, and this is why: please replace this line with details on why tests
    have not been included
  • I need help with writing tests

[Forem core team only] How will this change be communicated?

  • I've updated the Developer Docs and/or
    Admin Guide, or
    Storybook (for Crayons components)
  • I've updated the README or added inline documentation
  • I will share this change in a Changelog
    or in a forem.dev post
  • I will share this change internally with the appropriate teams
  • I'm not sure how best to communicate this change and need help
  • This change does not need to be communicated, and this is why not: please
    replace this line with details on why this change doesn't need to be
    shared

Archie character lamenting a test in class

lib/tasks/add_navigation_links.rake Show resolved Hide resolved
spec/tasks/add_navigation_links_spec.rb Outdated Show resolved Hide resolved
lib/tasks/forem.rake Outdated Show resolved Hide resolved
@msarit msarit marked this pull request as ready for review July 27, 2021 13:07
@pr-triage pr-triage bot added PR: unreviewed bot applied label for PR's with no review and removed PR: draft bot applied label for PR's that are a work in progress labels Jul 27, 2021
lib/tasks/add_navigation_links.rake Show resolved Hide resolved
lib/tasks/add_navigation_links.rake Show resolved Hide resolved
lib/tasks/forem.rake Show resolved Hide resolved
@@ -1,25 +1,69 @@
# rubocop:disable Metrics/BlockLength
namespace :navigation_links do
reading_icon = File.read(Rails.root.join("app/assets/images/twemoji/drawer.svg")).freeze
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's probably just code golf, but you could make a local helper method for image_content(*paths) and save a few bytes - the image_content exists for the one rainbowdev image not in the twemoji directory.

def image_content(*paths)
  File.read(Rails.root.join("app/assets/images/#{paths.join('/')}")).freeze
end

def twemoji(name)
  image_content("twemoji", "#{name}.svg")
end

reading_icon = twemoji("drawer")
contact_icon = twemoji("contact")
...

I'm sure this achieves the "unlikely to have a typo on only one line" goal of removing duplication while providing little concrete value in added readability.

@pr-triage pr-triage bot added PR: partially-approved bot applied label for PR's where a single reviewer approves changes and removed PR: unreviewed bot applied label for PR's with no review labels Jul 28, 2021
@pr-triage pr-triage bot added PR: unreviewed bot applied label for PR's with no review and removed PR: partially-approved bot applied label for PR's where a single reviewer approves changes labels Aug 2, 2021
Copy link
Contributor

@juliannatetreault juliannatetreault left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! 🚀 Also, TIL what a "twemoji" is. 😄

@pr-triage pr-triage bot added PR: partially-approved bot applied label for PR's where a single reviewer approves changes and removed PR: unreviewed bot applied label for PR's with no review labels Aug 2, 2021
@msarit msarit merged commit 812bfa2 into main Aug 2, 2021
@msarit msarit deleted the msarit/create-default-nav-links-new-forems branch August 2, 2021 16:52
@pr-triage pr-triage bot added PR: merged bot applied label for PR's that are merged and removed PR: partially-approved bot applied label for PR's where a single reviewer approves changes labels Aug 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: merged bot applied label for PR's that are merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants