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

Allow fetching special files in the documentation #1698

Merged
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
a242a5a
Removed symlink, needs work to make contributing link work in windows…
EWright212 Jul 2, 2020
8f8431c
Hardcoded contributing link
EWright212 Jul 3, 2020
d3419ef
Removing hardcoding for special files
EWright212 Jul 3, 2020
6f71bb2
Removed all hardcoding for special files in case of future additions …
EWright212 Jul 3, 2020
d9ca5d5
Minor refactor
EWright212 Jul 3, 2020
39da36d
Refactor
EWright212 Jul 6, 2020
23ca18a
Refactor houndbot lint warnings
EWright212 Jul 6, 2020
6a25b06
Refactor lint houndbot warnings
EWright212 Jul 6, 2020
52b315d
Refactor lint houndbot warnings again
EWright212 Jul 6, 2020
c40b697
Update to ruby naming convention
EWright212 Jul 8, 2020
e587791
Change all instances of check special file to find special file
EWright212 Jul 8, 2020
dc2d271
find special file returns only one item instead of array
EWright212 Jul 8, 2020
f548edd
Remove p
EWright212 Jul 8, 2020
5a8cd6d
Refactor fix houndbot warnings
EWright212 Jul 8, 2020
a5f58a8
Logic in show method moved to private method
EWright212 Jul 8, 2020
1ed0804
Remove index method from docs controller but hardcoded
EWright212 Jul 8, 2020
6102412
index page included in finding special files
EWright212 Jul 8, 2020
b2ebae7
Refactor and remove ps
EWright212 Jul 8, 2020
7b1ea40
Update for Nick's comments - Refactor
EWright212 Jul 8, 2020
824fa19
Refactor - houndbot warnings
EWright212 Jul 8, 2020
0e8ba21
Refactor - houndbot warnings
EWright212 Jul 8, 2020
6337815
if statement to ternary
EWright212 Jul 8, 2020
27564b0
separated content returned on finding special files
EWright212 Jul 8, 2020
2e7179a
Refactor - make methods private
EWright212 Jul 8, 2020
3ae7eac
Revert "Remove index method from docs controller but hardcoded"
EWright212 Jul 9, 2020
57e92a3
Refactor - move find_special_file method to private
EWright212 Jul 9, 2020
fcc1acd
Update spec/example_app/app/controllers/docs_controller.rb
EWright212 Jul 31, 2020
60fefb1
Update spec/example_app/app/controllers/docs_controller.rb
EWright212 Jul 31, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion docs/contributing.md

This file was deleted.

21 changes: 20 additions & 1 deletion spec/example_app/app/controllers/docs_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
class DocsController < ApplicationController
SPECIAL_FILES = [
{
file: 'CONTRIBUTING',
page: 'contributing'
}
].freeze

REDCARPET_CONFIG = {
fenced_code_blocks: true,
autolink: true,
Expand All @@ -9,11 +16,23 @@ def index
end
nickcharlton marked this conversation as resolved.
Show resolved Hide resolved

def show
render_page "docs/#{params[:page]}"
render_correct_page
end

def find_special_file
nickcharlton marked this conversation as resolved.
Show resolved Hide resolved
SPECIAL_FILES.select { |page| page[:page] == params[:page] }.first
nickcharlton marked this conversation as resolved.
Show resolved Hide resolved
end

private

def render_correct_page
if !find_special_file.nil?
nickcharlton marked this conversation as resolved.
Show resolved Hide resolved
render_page find_special_file[:file]
EWright212 marked this conversation as resolved.
Show resolved Hide resolved
else
render_page "docs/#{params[:page]}"
EWright212 marked this conversation as resolved.
Show resolved Hide resolved
end
end

def render_page(name)
path = full_page_path(name)

Expand Down