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

Adds skills folder to repo and loads markdown for each skill #302 #336

Closed
wants to merge 11 commits into from

Conversation

lumodon
Copy link

@lumodon lumodon commented Sep 27, 2017

Fixes #286
Previous PR: #302

Overview

  1. We modified the skills digest to include 'markdownFilePath'
  2. Changed helper function 'renderMarkdown' & associated helpers to be abstract - used for modules AND skills
  3. Created new bin meta-helper for generating folders and initial file markdowns (not useful anymore, keeping until told otherwise)
  4. Includes styling for skills markdown view
  5. Modified skills view file itself
  6. Modified skills route to use 'renderMarkdown' helper

Configuration Changes

Modifies package.json scripts section - script: test to include 'skills' folder in tests
No tests written yet

@@ -9,7 +9,7 @@
"dev": "nodemon web-server",
"start": "node web-server",
"db:migrate": "knex migrate:latest",
"test": "mocha -G -r ./mocha.config.js $(find digest web-server database backoffice | grep .test.js) ",
"test": "mocha -G -r ./mocha.config.js $(find digest web-server database backoffice skills | grep .test.js) ",
Copy link
Contributor

Choose a reason for hiding this comment

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

i dont think we'll put any tests in there. please remove this change

@@ -15,6 +15,7 @@ module.exports = digest => {
rawText,
modules: [],
path: `/skills/${encodeURIComponent(id)}`,
markdownFilePath: `/skills/${id}.md`,
Copy link
Contributor

Choose a reason for hiding this comment

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

i know i asked for this but i've changed my mind :)

@@ -1,10 +1,13 @@
# Grocery Queries Exercise

___Note:__ This module assumes you've already installed postgresql via homebrew. If you have not done that please do back and do the [Installfest](../Installfest) module._
___Note:__ This module assumes you've already installed postgresql via homebrew. If you
Copy link
Contributor

Choose a reason for hiding this comment

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

these changes should not be in this PR. please remove

Copy link
Author

@lumodon lumodon Sep 27, 2017

Choose a reason for hiding this comment

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

Very curious that our README somehow picked up those changes. Not even sure what or whose branch that is from. Will revert... just curiously commenting.

edit: git blame helped here. Somehow my "Fixes last minute mistakes" commit introduced this new mistake.

Copy link
Contributor

Choose a reason for hiding this comment

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

Very curious that our README somehow picked up those changes.
Well technically you committed these changes and worse you submitted them for reviews. This is the perfect time for you to focus on leveling up your git hygiene. Get into the habit of always using git add -p and before you open a PR always: rebase off upstream/master and consider squashing and polishing your commits. double or even triple check the diff.

@@ -133,7 +133,7 @@ module.exports = app => {
})
}

response.renderMarkdown = function(markdown){
response.renderMarkdown = function(markdown, viewPage='markdown', extraArgs){
Copy link
Contributor

Choose a reason for hiding this comment

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

i dont want to do this this way. please restore these helpers and see my comment in the routes file

Copy link
Contributor

Choose a reason for hiding this comment

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

add this helper response.renderMarkdownFileToHTML that does most of what renderMarkdownFile does but yields the HTML. then update renderMarkdownFile to use the renderMarkdownFileToHTML

@@ -31,9 +31,11 @@ module.exports = app => {
queries.getChecksForUserAndLabels({userId, labels})
.then(checks => {
const checked = !!checks[skill.id]
response.render('skills/show', {skill, checked, title: skill.name})
Copy link
Contributor

Choose a reason for hiding this comment

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

revert you changes to the helpers and make a new helper called renderMarkdownFileToHTML

const markdownHTML = response.renderMarkdownFileToHTML(`/skills/${skill.id}/README.md`)
response.render('skills/show', {markdownHTML, skill, checked, title: skill.name})

Copy link
Author

@lumodon lumodon Sep 28, 2017

Choose a reason for hiding this comment

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

@deadlyicon I can't imagine doing this without being async. Are you okay with:

response.renderMarkdownFileToHTML(`/skills/${skill.id}/README.md`)
.then( markdownHTML => {
  response.render('skills/show', {markdownHTML, skill, checked, title: skill.name})
})

Copy link
Contributor

Choose a reason for hiding this comment

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

of course! it has to be asyc because we read files async :)


h1.skill-show-page-heading
input.skill-checkbox(type="checkbox", data-label=skill.id, checked=checked)
span !{renderSkill(skill)}
span.skill-markdown !{content}
Copy link
Contributor

Choose a reason for hiding this comment

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

this span is inside of the h1, outdent it 1 level

Copy link
Contributor

Choose a reason for hiding this comment

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

also make it a div by removing span

li
a(href=sourceUrl target="_blank") View On GitHub
li
a(href=editeUrl target="_blank") Improve This Page

h1.skill-show-page-heading
Copy link
Contributor

Choose a reason for hiding this comment

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

remove this h1 with the checkbox. We're going to need to write some client javascript to dynamically add this checkbox on page load since we cannot easily modify the HTML we get from the markdown file. Ignore that for now and just remove this h1 and input

@jaredatron
Copy link
Contributor

please rebase this branch off upstream/master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants