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
Include "Help make this better" text on track topic pages #3475
Merged
Merged
Changes from 1 commit
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
5d9789e
Include "Help make this better" text on track topic pages
c1ebad9
Remove unuses X::Docs::Track class
dea1dc1
Use "refute" instead of "assert !"
9b714d6
Clarify method name
1a44a1e
Refactor Presenters::Track#docs
827a210
Don't stub out the object under test
3afedaa
Clean up Presenters::Track tests
d690e72
Fix broken link on fallback content page
33cdb68
Check for template existance and read template in same method
2b34498
Explicitly name file outputs for clarity
483e17f
Define location and file format for shared track topic templates in s…
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,13 +47,15 @@ def topic_content(topic_key) | |
end | ||
|
||
def contributing_instructions(topic_key) | ||
populate_template_with_trackler_data(File.read("./x/docs/md/track/BETTER.md")).gsub('TOPIC', topic_key.to_s.upcase) | ||
template = File.read("./x/docs/md/track/BETTER.md") | ||
populate_template_with_trackler_data(template).gsub('TOPIC', topic_key.to_s.upcase) | ||
end | ||
|
||
def fallback_topic_content(topic_key) | ||
filepath = "./x/docs/md/track/#{topic_key.upcase}.md" | ||
return '' unless File.exist?(filepath) | ||
populate_template_with_trackler_data(File.read(filepath)) | ||
template_filepath = "./x/docs/md/track/#{topic_key.upcase}.md" | ||
return '' unless File.exist?(template_filepath) | ||
template = File.read(template_filepath) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I like this 👍 |
||
populate_template_with_trackler_data(template) | ||
end | ||
|
||
def populate_template_with_trackler_data(template) | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The signatures of these 2 methods look very similar.
def contributing_instructions(topic_key)
and
def fallback_topic_content(topic_key)
I wonder if keyword arguments could help us here by making explicit what topic_key is going to be used for.
def contributing_instructions(replacement_value: topic_key)
and
def fallback_topic_content(file_basename: topic_key)
What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a little torn. Do you think it's important that whatever's calling these methods knows how
topic_key
will be used for?Here's the place where we're calling these methods now:
I think it's nice that
topic_content
doesn't need to know the implementation ofcontributing_instructions
orfallback_topic_content
. Instead, it passes along thetopic_key
and it gets back the relevant content.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You make a good point, I think I'd become so focused on those two methods that I lost track of the context.