Skip to content
This repository was archived by the owner on Mar 22, 2021. It is now read-only.

Commit d3a6642

Browse files
committed
adjusted docs app to new content structure
1 parent 9aa9da7 commit d3a6642

File tree

18 files changed

+132
-227
lines changed

18 files changed

+132
-227
lines changed

app/controllers/docs_app_controller.rb

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,21 @@ def api
99
render Docs::Pages::Api
1010
end
1111

12-
def components
13-
render Docs::Pages::Components
12+
def components_api
13+
render Docs::Pages::ComponentsApi
14+
end
15+
16+
def api
17+
render Docs::Pages::BaseApi
18+
end
19+
20+
def base_api
21+
render Docs::Pages::BaseApi
1422
end
1523

1624
def guides
1725
render Docs::Pages::Guides
1826
end
1927

20-
def spec
21-
render Docs::Pages::Spec
22-
end
2328

2429
end

app/javascript/css/custom-bootstrap.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ body {
3434
}
3535

3636
#hero {
37+
min-height: 160px;
3738
background-color: $m_light_grey;
3839
}
3940

app/matestack/components/header.rb

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ def response
66
button class: 'navbar-toggler', type: 'button', attributes: {"v-bind:class": "{ \"expanded-toggler\": open }", "@click": "sidebarToggle"} do
77
img path: 'menu/arrow.svg', class: 'left-closed'
88
end
9-
link class: 'navbar-brand my-0 p-0', path: :root_path do
9+
link class: 'navbar-brand my-0 p-0', path: "https://matestack.io" do
1010
img alt: 'matestack high quality software, simply delivered', path: 'logo/matestack_logo_orange.png', class: 'd-none d-sm-block'
1111
img alt: 'matestack high quality software, simply delivered', path: 'logo/matestack_logo_symbol.png', class: 'symbol d-block d-sm-none'
1212
end
@@ -17,23 +17,24 @@ def response
1717
div id: 'navbarSupportedContent', class: 'collapse navbar-collapse', attributes: {"v-bind:class": "{ \"show\": expanded }"} do
1818
ul class: 'navbar-nav nav-pills ml-auto align-items-center' do
1919
li class: 'nav-item' do
20-
transition class: "nav-link #{active_class(:guides)}",
20+
link class: "nav-link #{active_class(:guides)}",
2121
path: :guides_path,
2222
params: { key: 'README.md' },
2323
text: 'Guides'.upcase
2424
end
2525
li class: 'nav-item' do
26-
transition class: "nav-link #{active_class(:components)}",
27-
path: :api_path,
26+
link class: "nav-link #{active_class(:components)}",
27+
path: :components_api_path,
2828
params: { key: 'README.md' },
29-
text: 'Api'.upcase
29+
text: 'Components API'.upcase
3030
end
3131
li class: 'nav-item' do
32-
transition class: "nav-link #{active_class(:spec)}",
33-
path: :spec_path,
34-
params: { key: 'usage/README.md' },
35-
text: 'Specs'.upcase
32+
link class: "nav-link #{active_class(:components)}",
33+
path: :base_api_path,
34+
params: { key: 'README.md' },
35+
text: 'Base API'.upcase
3636
end
37+
3738
# TODO: Add button links for "sponsor"/"book us"
3839
end
3940
end

app/matestack/components/header.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ header {
3232
.nav-link {
3333
font-family: "Geometrica";
3434
color: $m_dark;
35-
font-size: 14px;
35+
font-size: 11px;
3636
letter-spacing: 1.14px;
3737
line-height: 28px;
3838
text-align: center;

app/matestack/components/md.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
.markdown-content {
22
margin-top: 40px;
33
h1 {
4+
margin-top: -116px;
5+
margin-bottom: 30px;
46
font-size: 26px;
57
line-height: 48px;
68
}

app/matestack/components/sidebar.rb

Lines changed: 51 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -11,93 +11,75 @@ def prepare
1111

1212
# TODO: Refactor below to work fine with new doc/api/guides structure! (esp. add /docs/ prefix to @github_component_docs_path)
1313
case @current_path
14-
when root_path
15-
# what shall we display inside side nav on home page?
16-
when components_path
17-
@github_component_docs_path = "#{@github_base_api_url}/docs/components"
18-
@tree = ::Rails.cache.fetch("components_remote_#{options[:path]}", expires_in: 1.hours) do
19-
JSON.parse(RestClient.get(@github_component_docs_path).body)
20-
end
21-
22-
when guides_path
23-
@github_component_docs_path = "#{@github_base_api_url}/guides"
24-
@tree = ::Rails.cache.fetch("guides_remote_#{options[:path]}", expires_in: 1.hours) do
14+
when base_api_path
15+
@github_component_docs_path = "#{@github_base_api_url}/docs/api/1-base"
16+
@tree = ::Rails.cache.fetch("base_remote_#{options[:path]}", expires_in: 1.hours) do
2517
JSON.parse(RestClient.get(@github_component_docs_path).body)
2618
end
27-
when spec_path
28-
@github_component_spec_path = "#{@github_base_api_url}/spec/usage/components"
29-
@tree = ::Rails.cache.fetch("spec_components_remote_#{options[:path]}", expires_in: 1.hours) do
30-
JSON.parse(RestClient.get(@github_component_spec_path).body)
19+
if @tree
20+
@tree.each do |item|
21+
if item["type"] == "file"
22+
@file_doc_links << item
23+
end
24+
end
3125
end
32-
33-
# TODO: missing "when"?
34-
@github_concept_specs_path = "#{@github_base_api_url}/spec/usage/base"
35-
@concept_specs_links = []
36-
@tree_spec_base = ::Rails.cache.fetch("spec_base_remote_#{options[:path]}", expires_in: 1.hours) do
37-
JSON.parse(RestClient.get(@github_concept_specs_path).body)
26+
@file_doc_links.sort_by! { |item| item['name'].scan(/\d+/).first.to_i }
27+
when components_api_path
28+
@github_component_docs_path = "#{@github_base_api_url}/docs/api/2-components"
29+
@tree = ::Rails.cache.fetch("components_remote_#{options[:path]}", expires_in: 1.hours) do
30+
JSON.parse(RestClient.get(@github_component_docs_path).body)
3831
end
39-
@tree_spec_base.each do |item|
40-
if item["type"] == "file"
41-
@concept_specs_links << item
32+
if @tree
33+
@tree.each do |item|
34+
if item["type"] == "file"
35+
@file_doc_links << item
36+
end
4237
end
4338
end
44-
else
45-
# TODO: refactor home page sidebar links
46-
if @current_page.starts_with?("/docs") && !@current_page.starts_with?("/docs/components")
47-
@menu_links = ["install", "concepts", "components", "integrations", "tooling", "extend", "architecture", "contribute"]
48-
@file_doc_links = []
39+
@file_doc_links.sort_by! { |item| item['name'].scan(/\d+/).first.to_i }
40+
when guides_path
41+
@github_component_docs_path = "#{@github_base_api_url}/docs/guides"
42+
@tree = ::Rails.cache.fetch("guides_remote_#{options[:path]}", expires_in: 1.hours) do
43+
JSON.parse(RestClient.get(@github_component_docs_path).body)
4944
end
50-
end
51-
if @tree
52-
@tree.each do |item|
53-
if item["type"] == "file"
54-
@file_doc_links << item
45+
if @tree
46+
@tree.each do |item|
47+
if item["type"] == "dir"
48+
@file_doc_links << item
49+
end
5550
end
5651
end
52+
@file_doc_links.sort_by! { |item| item['name'].scan(/\d+/).first.to_i }
5753
end
54+
5855
end
5956

6057
def response
61-
components {
62-
div id: 'custom-sidebar', class: 'container-fluid' do
63-
nav id: 'wrapper', class: 'bg-dark sidebar pt-5' do
64-
div class: 'sidebar-sticky menu' do
65-
ul id: 'listGroup', class: 'list-group list-group-flush' do
66-
case @current_path
67-
when '/'
68-
# TODO: add content for sidebar on start page
69-
when components_path
70-
partial :side_title, 'components'
71-
@file_doc_links.each do |item|
72-
partial :transition_link, :components_path, { key: item['name'], }, item['name'].gsub(".md", "")
73-
end
74-
when guides_path
75-
partial :side_title, 'guides'
76-
@file_doc_links.each do |item|
77-
partial :transition_link, :guides_path, { key: item['name'], }, item['name'].gsub(".md", "")
78-
end
79-
when spec_path
80-
partial :side_title, 'concept specs'
81-
@concept_specs_links.each do |item|
82-
partial :transition_link, :spec_path, { key: "usage/base/#{item['name']}" }, item['name'].gsub("_spec.rb", "")
83-
end
84-
partial :side_title, 'component specs'
85-
@file_doc_links.each do |item|
86-
partial :transition_link, :spec_path, { key: "usage/components/#{item['name']}" }, item['name'].gsub("_spec.rb", "")
87-
end
88-
else
89-
partial :side_title, 'documentation'
90-
if @current_page.starts_with?("/docs") && !@current_page.starts_with?("/docs/components")
91-
@menu_links.each do |item|
92-
partial :transition_link, :docs_path, { key: item }, item
93-
end
94-
end
58+
div id: 'custom-sidebar', class: 'container-fluid' do
59+
nav id: 'wrapper', class: 'bg-dark sidebar pt-5' do
60+
div class: 'sidebar-sticky menu' do
61+
ul id: 'listGroup', class: 'list-group list-group-flush' do
62+
case @current_path
63+
when base_api_path
64+
partial :side_title, 'base api'
65+
@file_doc_links.each do |item|
66+
partial :transition_link, :base_api_path, { key: item['name'], }, item['name'].gsub(".md", "")
67+
end
68+
when components_api_path
69+
partial :side_title, 'components api'
70+
@file_doc_links.each do |item|
71+
partial :transition_link, :components_api_path, { key: item['name'], }, item['name'].gsub(".md", "")
72+
end
73+
when guides_path
74+
partial :side_title, 'guides'
75+
@file_doc_links.each do |item|
76+
partial :transition_link, :guides_path, { key: "#{item['name']}/README.md" }, item['name'].split("-").last.humanize.camelcase
9577
end
9678
end
9779
end
9880
end
9981
end
100-
}
82+
end
10183
end
10284

10385
private

app/matestack/docs/app.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ def response
44
docs_header
55
main class: 'pt-5' do
66
docs_sidebar currentPage: context[:request].path
7-
page_content
7+
yield_page
88
end
9-
docs_footer
9+
# docs_footer
1010
end
1111

1212
end

app/matestack/docs/pages/api.rb

Lines changed: 0 additions & 7 deletions
This file was deleted.

app/matestack/docs/pages/base.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ def prepare
66
# Final TODO: change branch to master
77
# Final TODO: change line below to call GitHub API like in sidebar (?)
88
@github_base_url = 'https://raw.githubusercontent.com/matestack/matestack-ui-core'
9-
@branch = '06_07_2020_pwengerter_update_guides'
9+
@branch = 'master'
1010
case context[:params][:format]
1111
when 'md'
1212
@file = context[:params][:key] + '.md'
@@ -30,8 +30,8 @@ def hero
3030
div class: 'container' do
3131
div class: 'row py-3' do
3232
div class: 'col-md-4 offset-md-3 col-12' do
33-
heading size: 2, class: 'my-3 pr-3', text: @file.gsub('.md', '').gsub('.rb', '').gsub('/README', '').camelcase
34-
heading size: 5, class: 'my-3', text: @sub_title.upcase
33+
# heading size: 2, class: 'my-3 pr-3', text: @file.gsub('.md', '').gsub('.rb', '').gsub('/README', '').camelcase
34+
# heading size: 5, class: 'my-3', text: @sub_title.upcase
3535
end
3636
end
3737
end

app/matestack/docs/pages/base_api.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
class Docs::Pages::BaseApi < Docs::Pages::Base
2+
def prepare
3+
super
4+
@github_api_md_path = "#{@github_base_url}/#{@branch}/docs/api/1-base/#{@file}"
5+
@sub_title = "Base API Documentation"
6+
end
7+
end
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
class Docs::Pages::ComponentsApi < Docs::Pages::Base
2+
def prepare
3+
super
4+
@github_api_md_path = "#{@github_base_url}/#{@branch}/docs/api/2-components/#{@file}"
5+
@sub_title = "Components API Documentation"
6+
end
7+
end

app/matestack/docs/pages/home.rb

Lines changed: 0 additions & 46 deletions
This file was deleted.

app/matestack/docs/pages/spec.rb

Lines changed: 0 additions & 7 deletions
This file was deleted.

app/views/layouts/application.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
</head>
1616

1717
<body>
18-
<div id="matestack_ui">
18+
<div id="matestack-ui">
1919
<%= yield %>
2020
</div>
2121
</body>

bin/webpack-dev-server

100644100755
File mode changed.

0 commit comments

Comments
 (0)