-
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
1 parent
c80d1c1
commit 9a78d96
Showing
21 changed files
with
94 additions
and
94 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 |
---|---|---|
@@ -1,41 +1,41 @@ | ||
# frozen_string_literal: true | ||
|
||
class Admin::ExtendedTrialsController < AdminController | ||
before_action :set_extended_trial, only: %i[edit update] | ||
class Admin::CampaignsController < AdminController | ||
before_action :set_campaign, only: %i[edit update] | ||
def new | ||
@extended_trial = ExtendedTrial.new(start_at: Time.current.beginning_of_day) | ||
@campaign = Campaign.new(start_at: Time.current.beginning_of_day) | ||
end | ||
|
||
def create | ||
@extended_trial = ExtendedTrial.new(extended_trial_params) | ||
if @extended_trial.save | ||
redirect_to admin_extended_trials_path, notice: 'お試し延長を作成しました。' | ||
@campaign = Campaign.new(campaign_params) | ||
if @campaign.save | ||
redirect_to admin_campaigns_path, notice: 'お試し延長を作成しました。' | ||
else | ||
render :new | ||
end | ||
end | ||
|
||
def index | ||
@extended_trials = ExtendedTrial.order(end_at: :desc) | ||
@campaigns = Campaign.order(end_at: :desc) | ||
end | ||
|
||
def edit; end | ||
|
||
def update | ||
if @extended_trial.update(extended_trial_params) | ||
redirect_to admin_extended_trials_path, notice: 'お試し延長を更新しました。' | ||
if @campaign.update(campaign_params) | ||
redirect_to admin_campaigns_path, notice: 'お試し延長を更新しました。' | ||
else | ||
render :edit | ||
end | ||
end | ||
|
||
private | ||
|
||
def set_extended_trial | ||
@extended_trial = ExtendedTrial.find(params[:id]) | ||
def set_campaign | ||
@campaign = Campaign.find(params[:id]) | ||
end | ||
|
||
def extended_trial_params | ||
params.require(:extended_trial).permit(:start_at, :end_at, :title) | ||
def campaign_params | ||
params.require(:campaign).permit(:start_at, :end_at, :title) | ||
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
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
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
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
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
nav.tab-nav.is-in-tab | ||
.container.is-padding-horizontal-0-sm-down | ||
ul.tab-nav__items | ||
- %w[all student_and_trainee inactive retired graduate adviser mentor trainee year_end_party extended_trial].each do |target| | ||
- %w[all student_and_trainee inactive retired graduate adviser mentor trainee year_end_party campaign].each do |target| | ||
li.tab-nav__item | ||
= link_to t("target.#{target}"), admin_users_path(target: target), class: (@target == target ? ['is-active'] : []) << 'tab-nav__item-link' |
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
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
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
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
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 |
---|---|---|
@@ -1,11 +1,11 @@ | ||
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html | ||
|
||
extended_trial1: | ||
campaign1: | ||
start_at: <%= Time.zone.today %> | ||
end_at: <%= Time.zone.today + 3.days %> | ||
title: 'GW特別キャンペーン' | ||
|
||
extended_trial2: | ||
campaign2: | ||
start_at: <%= Time.zone.today - 1.months %> | ||
end_at: <%= Time.zone.today - 1.months + 7.days %> | ||
title: 'GWスペシャルキャンペーン' |
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
Oops, something went wrong.