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

リハーサルモードのオンオフフラグを追加 #2029

Merged
merged 6 commits into from
Sep 18, 2023
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
6 changes: 2 additions & 4 deletions app/controllers/admin/conferences_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@ def update

respond_to do |format|
if @conference_form.save
if @conference.opened?
path = "/#{@conference.abbr}/#{@conference.abbr == 'cndt2020' ? 'tracks' : 'ui/'}"
ActionCable.server.broadcast('waiting_channel', { msg: 'redirect to tracks', redirectTo: path })
end
ActionCable.server.broadcast('waiting_channel', { msg: 'redirect to tracks', redirectTo: "/#{@conference.abbr}/ui/" }) if @conference.opened?
redirect_path = if referrer_controller == 'admin/proposals'
admin_proposals_path
else
Expand All @@ -39,6 +36,7 @@ def update

def conference_params
params.require(:conference).permit(:conference_status,
:rehearsal_mode,
:cfp_result_visible,
:speaker_entry,
:attendee_entry,
Expand Down
4 changes: 3 additions & 1 deletion app/forms/conference_form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ class ConferenceForm
include ActiveModel::Validations

attr_accessor :conference_status
attr_accessor :rehearsal_mode
attr_accessor :cfp_result_visible
attr_accessor :speaker_entry
attr_accessor :attendee_entry
Expand Down Expand Up @@ -98,7 +99,7 @@ def save
return if invalid?

ActiveRecord::Base.transaction do
conference.update!(conference_status:, cfp_result_visible:, speaker_entry:, attendee_entry:, show_timetable:, show_sponsors:, capacity:, brief:, privacy_policy:, privacy_policy_for_speaker:)
conference.update!(conference_status:, rehearsal_mode:, cfp_result_visible:, speaker_entry:, attendee_entry:, show_timetable:, show_sponsors:, capacity:, brief:, privacy_policy:, privacy_policy_for_speaker:)
end
rescue => e
puts(e)
Expand All @@ -121,6 +122,7 @@ def load
def default_attributes
{
conference_status: conference.conference_status,
rehearsal_mode: conference.rehearsal_mode,
cfp_result_visible: conference.cfp_result_visible,
speaker_entry: conference.speaker_entry,
attendee_entry: conference.attendee_entry,
Expand Down
1 change: 1 addition & 0 deletions app/models/conference.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
# name :string(255)
# privacy_policy :text(65535)
# privacy_policy_for_speaker :text(65535)
# rehearsal_mode :boolean default(FALSE), not null
# show_sponsors :boolean default(FALSE)
# show_timetable :integer default("show_timetable_disabled")
# speaker_entry :integer default("speaker_entry_disabled")
Expand Down
9 changes: 9 additions & 0 deletions app/views/admin/conferences/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,15 @@
</div>
</div>

<h3>Rehearsal Mode</h3>

<div class="form-row form-group">
<div class="col-12 col-md-6">
<%= form.check_box :rehearsal_mode %>
<%= form.label :rehearsal_mode, 'On' %><br>
</div>
</div>

<h3>Proposal Result Visible Status</h3>

<div class="form-row form-group">
Expand Down
1 change: 1 addition & 0 deletions app/views/admin/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<h2><%= @conference.name %></h2>
<ul>
<li>カンファレンスステータス: <%= @conference.conference_status %></li>
<li>リハーサルモード: <%= @conference.rehearsal_mode ? 'オン' : 'オフ' %></li>
<li>CFPの結果公開: <%= @conference.cfp_result_visible ? '公開' : '非公開' %></li>
<li>登壇者のエントリー: <%= @conference.speaker_entry %></li>
<li>参加者の申し込み: <%= @conference.attendee_entry %></li>
Expand Down
1 change: 1 addition & 0 deletions app/views/api/v1/conferences/index.json.jbuilder
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ json.array!(@conferences) do |conference|
json.name(conference.name)
json.abbr(conference.abbr)
json.status(conference.conference_status)
json.rehearsalMode(conference.rehearsal_mode)
json.theme(conference.theme)
json.about(conference.about)
json.privacy_policy(conference.privacy_policy)
Expand Down
1 change: 1 addition & 0 deletions app/views/api/v1/conferences/show.json.jbuilder
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ json.id(@conference.id)
json.name(@conference.name)
json.abbr(@conference.abbr)
json.status(@conference.conference_status)
json.rehearsalMode(@conference.rehearsal_mode)
json.theme(@conference.theme)
json.about(@conference.about)
json.privacy_policy(@conference.privacy_policy)
Expand Down
18 changes: 8 additions & 10 deletions db/csv/cndf2023/talks.csv
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,11 @@ id,conference_id,title,abstract,talk_category_id,talk_difficulty_id,track_id,con
920,9,B5 ふがふが,ようやくそれはこの高等ん監獄を思いかもな、発音の校長をきっと聞いましがあるているたのん。よく何しろ三三一年が知れですから、陰では文へはそれが人達がするなてするるのに聞いたで。また始めいろいろ国をできがくるましたから、道楽に無論お話しのようで。,73,60,42,25,18:00,18:40,http://,1,0,,
921,9,C5 ぴよぴよ,ようやくそれはこの高等ん監獄を思いかもな、発音の校長をきっと聞いましがあるているたのん。よく何しろ三三一年が知れですから、陰では文へはそれが人達がするなてするるのに聞いたで。また始めいろいろ国をできがくるましたから、道楽に無論お話しのようで。,74,61,43,25,18:00,18:40,http://,1,0,,
922,9,Closing,intermission,,,41,25,18:50,19:00,http://,0,0,,
923,9,休憩,intermission,,,,25,,,http://,0,0,,
924,9,休憩,intermission,,,,25,,,http://,0,0,,
925,9,休憩,intermission,,,,25,,,http://,0,0,,
926,9,休憩,intermission,,,,25,,,http://,0,0,,
927,9,休憩,intermission,,,,25,,,http://,0,0,,
928,9,休憩,intermission,,,,25,,,http://,0,0,,
929,9,休憩,intermission,,,,25,,,http://,0,0,,
930,9,休憩,intermission,,,,25,,,http://,0,0,,
931,9,落選,ようやくそれはこの高等ん監獄を思いかもな、発音の校長をきっと聞いましがあるているたのん。よく何しろ三三一年が知れですから、陰では文へはそれが人達がするなてするるのに聞いたで。また始めいろいろ国をできがくるましたから、道楽に無論お話しのようで。,74,61,,,,,http://,0,0,,
932,9,落選,ようやくそれはこの高等ん監獄を思いかもな、発音の校長をきっと聞いましがあるているたのん。よく何しろ三三一年が知れですから、陰では文へはそれが人達がするなてするるのに聞いたで。また始めいろいろ国をできがくるましたから、道楽に無論お話しのようで。,74,61,,,,,http://,0,0,,
923,9,休憩,intermission,,,,25,13:00,14:00,http://,0,0,,
924,9,休憩,intermission,,,,25,14:40,15:00,http://,0,0,,
925,9,休憩,intermission,,,,25,15:40,16:00,http://,0,0,,
926,9,休憩,intermission,,,,25,16:40,17:00,http://,0,0,,
927,9,休憩,intermission,,,,25,17:40,18:00,http://,0,0,,
928,9,休憩,intermission,,,,25,18:40,18:50,http://,0,0,,
939,9,落選,ようやくそれはこの高等ん監獄を思いかもな、発音の校長をきっと聞いましがあるているたのん。よく何しろ三三一年が知れですから、陰では文へはそれが人達がするなてするるのに聞いたで。また始めいろいろ国をできがくるましたから、道楽に無論お話しのようで。,74,61,,,,,http://,0,0,,
940,9,落選,ようやくそれはこの高等ん監獄を思いかもな、発音の校長をきっと聞いましがあるているたのん。よく何しろ三三一年が知れですから、陰では文へはそれが人達がするなてするるのに聞いたで。また始めいろいろ国をできがくるましたから、道楽に無論お話しのようで。,74,61,,,,,http://,0,0,,
12 changes: 12 additions & 0 deletions db/migrate/20230915101121_add_rehearsal_mode_to_conferences.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
class AddRehearsalModeToConferences < ActiveRecord::Migration[7.0]
def up
add_column :conferences, :rehearsal_mode, :boolean, default: false, null: false
Conference.all.each do |conference|
conference.update!(rehearsal_mode: false)
end
end

def down
remove_column :conferences, :rehearsal_mode
end
end
1 change: 1 addition & 0 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@
t.string "brief"
t.string "committee_name", default: "CloudNative Days Committee", null: false
t.string "conference_status", default: "registered"
t.boolean "rehearsal_mode", default: false, null: false
t.integer "capacity"
t.index ["abbr", "conference_status"], name: "index_conferences_on_abbr_and_conference_status"
t.index ["abbr"], name: "index_conferences_on_abbr"
Expand Down
2 changes: 2 additions & 0 deletions schemas/swagger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1009,6 +1009,8 @@ components:
type: string
status:
type: string
rehearsalMode:
type: boolean
theme:
type: string
about:
Expand Down
1 change: 1 addition & 0 deletions spec/factories/conferences.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
# name :string(255)
# privacy_policy :text(65535)
# privacy_policy_for_speaker :text(65535)
# rehearsal_mode :boolean default(FALSE), not null
# show_sponsors :boolean default(FALSE)
# show_timetable :integer default("show_timetable_disabled")
# speaker_entry :integer default("speaker_entry_disabled")
Expand Down
1 change: 1 addition & 0 deletions spec/models/conference_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
# name :string(255)
# privacy_policy :text(65535)
# privacy_policy_for_speaker :text(65535)
# rehearsal_mode :boolean default(FALSE), not null
# show_sponsors :boolean default(FALSE)
# show_timetable :integer default("show_timetable_disabled")
# speaker_entry :integer default("speaker_entry_disabled")
Expand Down
2 changes: 1 addition & 1 deletion spec/requests/tracks_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
expect(response.body).to(include('Alice様へのお知らせ'))
end

context 'wnen announcement is not published' do
context 'when announcement is not published' do
before do
create(:speaker_announcement, speakers: [alice])
end
Expand Down
Loading