-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
113 additions
and
0 deletions.
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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'csv' | ||
|
||
class Paper::HomeController < PaperController | ||
CSV_FILE_NAME = 'カリキュラム一覧.csv' | ||
|
||
def index | ||
ignore_practice_ids = [6, 19, 23, 25, 57] | ||
@categories = Course.find(1).categories.where.not(id: ignore_practice_ids) | ||
|
||
respond_to do |format| | ||
format.html | ||
format.csv do | ||
send_data(csv_data, filename: CSV_FILE_NAME) | ||
end | ||
end | ||
end | ||
|
||
private | ||
|
||
def csv_data | ||
CSV.generate do |csv| | ||
csv << %w[章番号 章 章の目的 単元番号 所要時間 単元 URL].freeze | ||
@categories.each_with_index do |category, i| | ||
category.practices.each_with_index do |practice, h| | ||
csv << [ | ||
i + 1, | ||
category.name, | ||
category.description, | ||
"#{i + 1}-#{h + 1}", | ||
time_format, | ||
practice.title, | ||
"https://bootcamp.fjord.jp/practices/#{practice.id}" | ||
] | ||
end | ||
end | ||
end | ||
end | ||
end |
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# frozen_string_literal: true | ||
|
||
class PaperController < ApplicationController | ||
before_action :require_admin_login | ||
layout 'paper' | ||
end |
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/* eslint no-console:0 */ | ||
// This file is automatically compiled by Webpack, along with any other files | ||
// present in this directory. You're encouraged to place your actual application logic in | ||
// a relevant structure within app/javascript and only use these pack files to reference | ||
// that code so it'll be compiled. | ||
// | ||
// To reference this file, add <%= javascript_pack_tag 'application' %> to the appropriate | ||
// layout file, like app/views/layouts/application.html.erb | ||
|
||
import '../stylesheets/paper' |
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.book-name | ||
font-size: 3em | ||
|
||
img | ||
max-width: 90% |
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
doctype html | ||
html(lang='ja') | ||
head | ||
= javascript_include_tag 'application' | ||
= javascript_pack_tag 'application' | ||
= stylesheet_pack_tag 'paper', media: 'all' | ||
body | ||
= yield |
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 |
---|---|---|
@@ -0,0 +1,36 @@ | ||
.book-name フィヨルドブートキャンプカリキュラム | ||
|
||
div(style="page-break-before:always") | ||
|
||
h2 目次 | ||
|
||
- @categories.each_with_index do |category, i| | ||
| #{i + 1} #{category.name} | ||
br | ||
- category.practices.each_with_index do |practice, h| | ||
| #{i + 1}.#{h + 1} | ||
= link_to practice.title, "##{practice.id}" | ||
br | ||
|
||
div(style="page-break-before:always") | ||
|
||
- @categories.each_with_index do |category, i| | ||
h3.category_name | ||
| #{i + 1} #{category.name} | ||
= category.description | ||
|
||
div(style="page-break-before:always") | ||
|
||
- category.practices.each_with_index do |practice, h| | ||
h3.practice_title(id="#{practice.id}") | ||
| #{i + 1}.#{h + 1} #{practice.title.strip} | ||
|
||
div(style="page-break-before:always") | ||
|
||
.a-long-text.is-md.js-markdown-view = practice.description | ||
|
||
h2 終了条件 | ||
|
||
= practice.goal | ||
|
||
div(style="page-break-before:always") |
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
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# frozen_string_literal: true | ||
|
||
Rails.application.routes.draw do | ||
namespace :paper do | ||
root to: "home#index", as: :root | ||
end | ||
end |