2017-08-17 22:00:37 +05:30
|
|
|
class Projects::PagesController < Projects::ApplicationController
|
|
|
|
layout 'project_settings'
|
|
|
|
|
|
|
|
before_action :require_pages_enabled!
|
|
|
|
before_action :authorize_read_pages!, only: [:show]
|
|
|
|
before_action :authorize_update_pages!, except: [:show]
|
|
|
|
|
|
|
|
def show
|
|
|
|
@domains = @project.pages_domains.order(:domain)
|
|
|
|
end
|
|
|
|
|
|
|
|
def destroy
|
|
|
|
project.remove_pages
|
2018-11-20 20:47:30 +05:30
|
|
|
project.pages_domains.destroy_all # rubocop: disable DestroyAll
|
2017-08-17 22:00:37 +05:30
|
|
|
|
|
|
|
respond_to do |format|
|
|
|
|
format.html do
|
2017-09-10 17:25:29 +05:30
|
|
|
redirect_to project_pages_path(@project),
|
|
|
|
status: 302,
|
|
|
|
notice: 'Pages were removed'
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2018-05-09 12:01:36 +05:30
|
|
|
|
|
|
|
def update
|
|
|
|
result = Projects::UpdateService.new(@project, current_user, project_params).execute
|
|
|
|
|
|
|
|
respond_to do |format|
|
|
|
|
format.html do
|
|
|
|
if result[:status] == :success
|
|
|
|
flash[:notice] = 'Your changes have been saved'
|
|
|
|
else
|
|
|
|
flash[:alert] = 'Something went wrong on our end'
|
|
|
|
end
|
|
|
|
|
|
|
|
redirect_to project_pages_path(@project)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def project_params
|
|
|
|
params.require(:project).permit(:pages_https_only)
|
|
|
|
end
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|