1class Admin::HolidaysController < Admin::AdminController
 
2  before_action :require_sysadmin
 
3  before_action :fetch_holiday
 
4
 
5  def edit
 
6    respond_to do |format|
 
7      format.html
 
8    end
 
 9  end
 
 
11  def update
 
12    if @holiday.update(holiday_params)
 
13      redirect_to edit_admin_site_url, notice: :site_updated
 
14    else
 
15      respond_to do |format|
 
16        format.html { render :edit }
 
17      end
 
18    end
 
19  end
 
 
21  private
 
 
23  def fetch_holiday
 
24    @holiday = Holiday.instance
 
25  end
 
 
27  def holiday_params
 
28    params.require(:holiday).permit(*holiday_attributes)
 
29  end
 
 
31  def holiday_attributes
 
32    %i[christmas_start christmas_end easter_start easter_end]
 
33  end
 
34end