Skip to content

Refactor: Use /public folder for public docs: #1682

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

Merged
merged 3 commits into from
May 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Dojo 情報は次の手順で簡単に更新できます。
以上で完了です。提案された修正はメンテナーによってチェックされ、問題なければ提案された内容が反映されます。もし問題があってもメンテナー側で気付いて修正できるので、まずはお気軽に提案してみてください :wink:

> [!NOTE]
> https://coderdojo.jp/docs にあるドキュメントの編集方法も同様です。[db/docs](https://github.com/coderdojo-japan/coderdojo.jp/tree/main/db/docs)ディレクトリをブラウザで開き、修正したいファイルをクリックして、修正内容を提案してください。同ディレクトページの右上にある `Create new file` ボタンをクリックすると、新しいドキュメントの追記を提案することもできます。
> https://coderdojo.jp/docs にあるドキュメントの編集方法も同様です。[public/docs](https://github.com/coderdojo-japan/coderdojo.jp/tree/main/public/docs)ディレクトリをブラウザで開き、修正したいファイルをクリックして、修正内容を提案してください。同ディレクトページの右上にある `Create new file` ボタンをクリックすると、新しいドキュメントの追記を提案することもできます。


<div id='howto-update-kata'></div><br>
Expand Down
8 changes: 4 additions & 4 deletions app/models/document.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class Document
attr_reader :id, :filename
DIR_PATH = 'db/docs'
URL_PATH = 'docs'
DIR_PATH = 'public/docs'
URL_PATH = '/docs'

class << self
def all
Expand Down Expand Up @@ -33,7 +33,7 @@ def updated_at
return "2020-02-02T12:34:56+09:00" unless Rails.env.production?

# Call GitHub API in Production
uri = URI.parse("https://api.github.com/repos/coderdojo-japan/coderdojo.jp/commits?path=db/docs/&per_page=1")
uri = URI.parse("https://api.github.com/repos/coderdojo-japan/coderdojo.jp/commits?path=public/docs/&per_page=1")
json = Net::HTTP.get(uri)
data = JSON.parse(json)

Expand All @@ -52,7 +52,7 @@ def updated_at
end

def url
"/#{URL_PATH}/#{self.filename}"
"#{URL_PATH}/#{self.filename}"
end

def exists?
Expand Down
4 changes: 4 additions & 0 deletions config/initializers/mime_types.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@

# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf

# MarkdownファイルのMIMEタイプを設定
Mime::Type.register 'text/markdown', :md, %w( text/plain )
Rack::Mime::MIME_TYPES['.md'] = 'text/markdown; charset=utf-8'
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.