diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-02-14 23:22:44 +0300 |
---|---|---|
committer | James Edwards-Jones <jedwardsjones@gitlab.com> | 2017-02-01 01:53:58 +0300 |
commit | 7f12cb0eed06ad3f83126a3a8038e7fa658f4eac (patch) | |
tree | 36f2b0b2bed11d901db304df2043ba0eb17340a2 /app/controllers/projects/pages_controller.rb | |
parent | 84edc9a22f5d858cb02f32d22b66c92fb939378a (diff) |
Split PagesController into PagesController and PagesDomainsController
1. PagesController is used to show all domains and general overview of Pages
2. PagesDomainsController is used to manage pages domains
Diffstat (limited to 'app/controllers/projects/pages_controller.rb')
-rw-r--r-- | app/controllers/projects/pages_controller.rb | 54 |
1 files changed, 2 insertions, 52 deletions
diff --git a/app/controllers/projects/pages_controller.rb b/app/controllers/projects/pages_controller.rb index 2268d2d8aa2..b73f998392d 100644 --- a/app/controllers/projects/pages_controller.rb +++ b/app/controllers/projects/pages_controller.rb @@ -1,49 +1,13 @@ class Projects::PagesController < Projects::ApplicationController layout 'project_settings' - before_action :authorize_update_pages!, except: [:show] - before_action :authorize_remove_pages!, only: [:remove_pages] - before_action :label, only: [:destroy] - before_action :domain, only: [:show] - - helper_method :valid_certificate?, :valid_certificate_key? - helper_method :valid_key_for_certificiate?, :valid_certificate_intermediates? - helper_method :certificate, :certificate_key - - def index - @domains = @project.pages_domains.order(:domain) - end + before_action :authorize_update_pages! def show - end - - def new - @domain = @project.pages_domains.new - end - - def create - @domain = @project.pages_domains.create(pages_domain_params) - - if @domain.valid? - redirect_to namespace_project_pages_path(@project.namespace, @project) - else - render 'new' - end + @domains = @project.pages_domains.order(:domain) end def destroy - @domain.destroy - - respond_to do |format| - format.html do - redirect_to(namespace_project_pages_path(@project.namespace, @project), - notice: 'Domain was removed') - end - format.js - end - end - - def remove_pages project.remove_pages project.pages_domains.destroy_all @@ -54,18 +18,4 @@ class Projects::PagesController < Projects::ApplicationController end end end - - private - - def pages_domain_params - params.require(:pages_domain).permit( - :certificate, - :key, - :domain - ) - end - - def domain - @domain ||= @project.pages_domains.find_by(domain: params[:id].to_s) - end end |