Skip to content

Commit 9bccb8b

Browse files
committed
Merge branch 'ichiroc-stretch3'
2 parents 965caaf + 3509816 commit 9bccb8b

File tree

8 files changed

+151
-1
lines changed

8 files changed

+151
-1
lines changed
+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
class Stretch3sController < ApplicationController
2+
def new
3+
@stretch3 = Stretch3.new
4+
end
5+
6+
def create
7+
@stretch3 = Stretch3.new(stretch3_params)
8+
if @stretch3.save
9+
# NOTE: coderdojo.jp ドメインから遷移すると Stretch3 側で ChatGPT2Scratch の API キーが不要になる処理が走る
10+
redirect_to 'https://stretch3.github.io', allow_other_host: true
11+
else
12+
render :new
13+
end
14+
end
15+
16+
private
17+
18+
def stretch3_params
19+
params.require(:stretch3).except(:term_of_use).permit(:email, :parent_name, :participant_name, :dojo_name)
20+
end
21+
end

app/models/stretch3.rb

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
class Stretch3 < ApplicationRecord
2+
validates :email, presence: true
3+
validates :parent_name, presence: true
4+
validates :participant_name, presence: true
5+
validates :dojo_name, presence: true
6+
end

app/views/stretch3s/new.html.haml

+100
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
- provide(:title, 'Stretch3 × AI 拡張ブロックの利用申請')
2+
- provide(:desc, 'Stretch3 から OpenAI API を呼び出せる拡張機能「ChatGPT2Scratch」が、全国の CoderDojo でご活用いただけるための利用申請フォームです。')
3+
- provide(:url, '/stretch3')
4+
- provide(:meta_image, '/img/stretch3_cover.webp')
5+
6+
:css
7+
.stretch3-notes {
8+
margin-top: 100px;
9+
font-size: 11.8px;
10+
line-height: 1.7em;
11+
color: #909090;
12+
}
13+
.stretch3-eyecatch {
14+
border-radius: 10px;
15+
object-fit: cover;
16+
}
17+
18+
.container
19+
%section.introduction{style: "padding: 50px 0px;"}
20+
%div.text-center
21+
%h1{style: "line-height: 1.4em; margin-bottom: 50px;"}
22+
Stretch3 × AI
23+
%br.ignore-pc
24+
利用申請フォーム
25+
= lazy_image_tag '/img/stretch3_cover.webp',
26+
alt: 'AI 拡張ブロック利用例のスクリーンショット画像',
27+
min: true,
28+
class: 'stretch3-eyecatch',
29+
style: 'box-shadow: 0 2.5rem 2rem -2rem hsl(200 50% 20% / 40%);'
30+
%p{style: 'margin-top: 70px;'}
31+
Stretch3 内にある AI 拡張ブロックの利用申請フォームです。
32+
%small<>
33+
(
34+
%a{href: '#'}<> &raquo; 詳細を見る
35+
)
36+
/
37+
%p
38+
この申請フォームは OpenAI の Chat API を呼び出す拡張機能 ChatGPT2Scratch を
39+
%br
40+
API キー不要で利用出来るようにするための申請フォームです。
41+
%br
42+
これにより本来有料の Chat API を無料で利用できます。
43+
%p{style: 'margin-bottom: 50px;'}
44+
利用規約は、
45+
%b<> 保護者の方が参加者と一緒に
46+
%br.ignore-pc
47+
ご確認いただくようお願い致します。
48+
49+
= form_with model: @stretch3, url: stretch3_path, class: 'form' do |f|
50+
.field
51+
= f.label :email, "メールアドレス"
52+
= f.email_field :email, required: true, autocomplete: "email", class: "form__field", placeholder: '例: [email protected]'
53+
.field
54+
= f.label :parent_name, "保護者の名前"
55+
= f.text_field :parent_name, required: true, autocomplete: "name", class: "form__field", placeholder: '例: 幸田 道場'
56+
.field
57+
= f.label :participant_name, "参加者の名前"
58+
= f.text_field :participant_name, required: true, autocomplete: "name", class: "form__field", placeholder: '例: 幸田 道子'
59+
.field
60+
= f.label :dojo_name, "道場名"
61+
= f.text_field :dojo_name, required: true, class: "form__field", placeholder: '例: CoderDojo 柏'
62+
.form__terms
63+
%h2.form__h2 利用規約
64+
%ol
65+
%li
66+
%small
67+
%a{href: 'https://learn.microsoft.com/ja-jp/azure/ai-services/responsible-use-of-ai-overview', target: '_blank'}
68+
Azure AI サービスにおける AI の責任ある使用
69+
%small
70+
%small
71+
%i.far.fa-external-link
72+
に従うこと
73+
%li
74+
%small
75+
%b<> 事前に保護者から同意を得ること
76+
%br
77+
(参考:
78+
%a{href: 'https://www.mext.go.jp/a_menu/other/mext_02412.html', target: '_blank'}
79+
文部科学省 - 生成AIの利活用に関するガイドライン
80+
%small
81+
%small
82+
%i.far.fa-external-link
83+
)
84+
%li
85+
%small
86+
CoderDojo 以外で利用する場合は、一般社団法人 CoderDojo Japan からの書面による許諾を事前に得るようお願いします。
87+
%p
88+
%pre{style: 'white-space: pre-wrap; margin-bottom: 30px; color: #505050;'}
89+
※ 本サービスは Azure AI の利用上限に達した場合、または上記規約に違反した場合などの理由により、予告なく利用が停止される場合もあります。あらかじめご了承いただけると幸いです。
90+
.field.text-center
91+
= f.check_box :term_of_use, required: true
92+
= f.label :term_of_use, "上記の利用規約に同意する", style: "display:inline"
93+
94+
= f.submit "同意して利用を始める", class: "form__submit"
95+
.text-center{style: 'color: gray;'}
96+
%small
97+
%small
98+
%b
99+
100+
ボタン押下後、Stretch3 のページへ移動します

config/routes.rb

+2
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@
6969
get "/podcast", to: redirect('/podcasts')
7070
get "/podcasts/feed" => "podcasts#feed"
7171
get "/stats" => "stats#show"
72+
get "/stretch3" => "stretch3s#new"
73+
post "/stretch3" => "stretch3s#create"
7274
get "/pokemon" => "pokemons#new"
7375
#post "/pokemon" => "pokemons#create"
7476
#get "/pokemon/download" => "pokemons#show"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
class CreateStretch3s < ActiveRecord::Migration[7.0]
2+
def change
3+
create_table :stretch3s do |t|
4+
t.string :email, null: false
5+
t.string :parent_name, null: false
6+
t.string :participant_name, null: false
7+
t.string :dojo_name, null: false
8+
9+
t.timestamps
10+
end
11+
end
12+
end

db/schema.rb

+10-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#
1111
# It's strongly recommended that you check this file into your version control system.
1212

13-
ActiveRecord::Schema[7.0].define(version: 2024_06_18_025325) do
13+
ActiveRecord::Schema[7.0].define(version: 2025_03_15_124619) do
1414
# These are extensions that must be enabled in order to support this database
1515
enable_extension "pg_stat_statements"
1616
enable_extension "plpgsql"
@@ -91,6 +91,15 @@
9191
t.index ["region"], name: "index_prefectures_on_region"
9292
end
9393

94+
create_table "stretch3s", force: :cascade do |t|
95+
t.string "email", null: false
96+
t.string "parent_name", null: false
97+
t.string "participant_name", null: false
98+
t.string "dojo_name", null: false
99+
t.datetime "created_at", null: false
100+
t.datetime "updated_at", null: false
101+
end
102+
94103
create_table "upcoming_events", force: :cascade do |t|
95104
t.integer "dojo_event_service_id", null: false
96105
t.string "event_id", null: false

public/img/stretch3_cover.png

84.2 KB
Loading

public/img/stretch3_cover.webp

30.1 KB
Binary file not shown.

0 commit comments

Comments
 (0)